Click or drag to resize

GetObjectGeometryAttributeFilter Property

The geometry attribute filter provides a secondary filter that can be used to restrict which objects can be selected. Control of the type of geometry (points, curves, surfaces, meshes, etc.) is provided by GetObject.SetGeometryFilter. The geometry attribute filter is used to require the selected geometry to have certain attributes (open, closed, etc.). The default attribute filter permits selection of all types of geometry.

Namespace:  Rhino.Input.Custom
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
public GeometryAttributeFilter GeometryAttributeFilter { get; set; }

Property Value

Type: GeometryAttributeFilter
partial class Examples
  public static Rhino.Commands.Result CircleCenter(Rhino.RhinoDoc doc)
    Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
    go.SetCommandPrompt("Select objects");
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
    go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve;
    go.GetMultiple(1, 0);
    if( go.CommandResult() != Rhino.Commands.Result.Success )
      return go.CommandResult();

    Rhino.DocObjects.ObjRef[] objrefs = go.Objects();
    if( objrefs==null )
      return Rhino.Commands.Result.Nothing;

    double tolerance = doc.ModelAbsoluteTolerance;
    for( int i=0; i<objrefs.Length; i++ )
      // get the curve geometry
      Rhino.Geometry.Curve curve = objrefs[i].Curve();
      if( curve==null )
      Rhino.Geometry.Circle circle;
      if( curve.TryGetCircle(out circle, tolerance) )
        Rhino.RhinoApp.WriteLine("Circle{0}: center = {1}", i+1, circle.Center);
    return Rhino.Commands.Result.Success;
import Rhino
import scriptcontext

def CircleCenter():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select objects")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve
    go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve
    go.GetMultiple(1, 0)
    if go.CommandResult()!=Rhino.Commands.Result.Success:
        return go.CommandResult()

    objrefs = go.Objects()
    if not objrefs: return Rhino.Commands.Result.Nothing

    tolerance = scriptcontext.doc.ModelAbsoluteTolerance
    for i, objref in enumerate(objrefs):
        # get the curve geometry
        curve = objref.Curve()
        if not curve: continue
        rc, circle = curve.TryGetCircle( tolerance )
        if rc:
            print "Circle", i+1, ": center = ", circle.Center
    return Rhino.Commands.Result.Success

if __name__=="__main__":
See Also