Click or drag to resize

ObjectTableGetObjectList Method (Type)

[Missing <summary> documentation for "M:Rhino.DocObjects.Tables.ObjectTable.GetObjectList(System.Type)"]

Namespace:  Rhino.DocObjects.Tables
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public IEnumerable<RhinoObject> GetObjectList(
	Type typeFilter
)

Parameters

typeFilter
Type: SystemType

[Missing <param name="typeFilter"/> documentation for "M:Rhino.DocObjects.Tables.ObjectTable.GetObjectList(System.Type)"]

Return Value

Type: IEnumerableRhinoObject

[Missing <returns> documentation for "M:Rhino.DocObjects.Tables.ObjectTable.GetObjectList(System.Type)"]

Examples
using Rhino;
using Rhino.DocObjects;
using Rhino.Commands;
using Rhino.Geometry;

namespace examples_cs
{
  public class ChangeDimensionStyleCommand : Rhino.Commands.Command
  {
    public override string EnglishName
    {
      get { return "csChangeDimensionStyle"; }
    }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      foreach (var rhino_object in doc.Objects.GetObjectList(ObjectType.Annotation))
      {
        var annotation_object = rhino_object as AnnotationObjectBase;
        if (annotation_object == null) continue;

        var annotation = annotation_object.Geometry as AnnotationBase;
        if (annotation == null) continue;

        if (annotation.Index == doc.DimStyles.CurrentDimensionStyleIndex) continue;

        annotation.Index = doc.DimStyles.CurrentDimensionStyleIndex;
        annotation_object.CommitChanges();
      }

      doc.Views.Redraw();

      return Result.Success;
    }
  }
}
Python
from Rhino import *
from Rhino.DocObjects import *
from Rhino.Commands import *
from Rhino.Geometry import *
from scriptcontext import doc

def RunCommand():
  for annotation_object in doc.Objects.GetObjectList(ObjectType.Annotation):
    if not isinstance (annotation_object, AnnotationObjectBase):
      continue

    annotation = annotation_object.Geometry

    if annotation.Index == doc.DimStyles.CurrentDimensionStyleIndex:
      continue

    annotation.Index = doc.DimStyles.CurrentDimensionStyleIndex
    annotation_object.CommitChanges()

  doc.Views.Redraw()
  return Result.Success

if __name__ == "__main__":
  RunCommand()
See Also