public class ObjRef : IDisposable
Represents a reference to a Rhino object.

Constructors

ObjRef

#Since v7.0 Obsolete v7.6
public ObjRef(Guid id, ComponentIndex ci)
obsoleteUse version that takes a document.
Initializes a new object reference from a guid and component index. The component index is used to specify a "piece" of the geometry
id (Guid)The object's Id
ci (ComponentIndex)a portion of the object

ObjRef

#Since v5.0 Obsolete v7.6
public ObjRef(Guid id)
obsoleteUse version that takes a document.
Initializes a new object reference from a globally unique identifier (Guid).
id (Guid)The ID.

ObjRef

#Since v7.0
public ObjRef(ObjRef other)
Copy constructor
other (ObjRef)

ObjRef

#Since v7.6
public ObjRef(RhinoDoc doc, Guid id, ComponentIndex ci)
Initializes a new object reference from a guid and component index. The component index is used to specify a "piece" of the geometry
doc (RhinoDoc)The Rhino document
id (Guid)The object's Id
ci (ComponentIndex)a portion of the object

ObjRef

#Since v7.6
public ObjRef(RhinoDoc doc, Guid id)
Initializes a new object reference from a globally unique identifier (Guid).
doc (RhinoDoc)The Rhino document
id (Guid)The ID.

ObjRef

#Since v5.0
public ObjRef(RhinoObject rhinoObject, PickContext pickContext)
Initialized a new object reference from a Rhino object and pick context
rhinoObject (RhinoObject)
pickContext (PickContext)

ObjRef

#Since v5.0
public ObjRef(RhinoObject rhinoObject)
Initializes a new object reference from a Rhino object.
rhinoObject (RhinoObject)The Rhino object.

Finalizer

~ObjRef

#
~ObjRef()
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().

Properties

Document

#Since v8.0
public RhinoDoc Document { get; }
Gets the document that owns this object reference.

GeometryComponentIndex

#Since v5.0
public ComponentIndex GeometryComponentIndex { get; }
Gets the component index of the referenced (sub) geometry. Some objects have sub-objects that are valid pieces of geometry. For example, breps have edges and faces that are valid curves and surfaces. Each sub-object has a component index that is > 0. The parent geometry has a component index = -1.

ObjectId

#Since v5.0
public Guid ObjectId { get; }
Returns the id of the referenced Rhino object.

RuntimeSerialNumber

#Since v5.0
[CLSCompliant(false)] public uint RuntimeSerialNumber { get; }
If > 0, then this is the value of a Rhino object's serial number field. The serial number is used instead of the pointer to prevent crashes in cases when the RhinoObject is deleted but an ObjRef continues to reference the Rhino object. The value of RuntimeSerialNumber is not saved in archives because it generally changes if you save and reload an archive.

Methods

Brep

#ExampleSince v5.0
public Brep Brep()
Gets the brep if this reference geometry is one.
A boundary representation; or null on error.

ClippingPlaneSurface

#Since v5.0
public ClippingPlaneSurface ClippingPlaneSurface()
Gets the clipping plane surface if this reference targeted one.
A clipping plane surface, or null if this reference targeted something else.

Curve

#ExampleSince v5.0
public Curve Curve()
Gets the curve if this reference targeted one.
A curve, or null if this reference targeted something else.

CurveParameter

#ExampleSince v5.0
public Curve CurveParameter(out double parameter)
If the reference geometry is a curve or edge with a selection point, then this gets the parameter of the selection point.
Remarks: If a curve was selected and CurveParameter is called and the SelectionMethod() is not 1 (point pick on object), the curve will be returned and parameter will be set to the start parameter of the picked curve. This can be misleading so it may be necessary to call SelectionMethod() first, before calling CurveParameter to get the desired information.
parameter (out double)The parameter of the selection point.
If the selection point was on a curve or edge, then the curve/edge is returned, otherwise null.

Dispose

#Since v5.0
public void Dispose()
Actively reclaims unmanaged resources that this instance uses.

Dispose

#
protected virtual void Dispose(bool disposing)
For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

disposing (bool)true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.

Edge

#Since v5.0
public BrepEdge Edge()
Gets the edge if this reference geometry is one.
A boundary representation edge; or null on error.

Face

#Since v5.0
public BrepFace Face()
If the referenced geometry is a brep face, a brep with one face, or a surface, this returns the brep face.
A boundary representation face; or null on error.

Geometry

#Since v5.0
public GeometryBase Geometry()
Gets the geometry linked to the object targeted by this reference.
The geometry.

Hatch

#Since v5.0
public Hatch Hatch()
Gets the hatch if the referenced geometry is one.
A hatch; or null if the referenced object is not a hatch

InstanceDefinitionPart

#Since v6.0
public RhinoObject InstanceDefinitionPart()
If sub-object selection is enabled and a piece of an instance reference is selected, this will return the selected piece.

Light

#Since v5.0
public Light Light()
Gets the light if the referenced geometry is one.
A light; or null if the referenced object is not a light, or on error.

Mesh

#Since v5.0
public Mesh Mesh()
Gets the mesh if the referenced geometry is one.
A mesh; or null if the referenced object is not a mesh, or on error.

Object

#ExampleSince v5.0
public RhinoObject Object()
Returns the referenced Rhino object.

Point

#Since v5.0
public Point Point()
Gets the point if the referenced geometry is one.
A point; or null if the referenced object is not a point, or on error.

PointCloud

#Since v5.0
public PointCloud PointCloud()
Gets the point cloud if the referenced geometry is one.
A point cloud; or null if the referenced object is not a point cloud, or on error.

SelectionMethod

#Since v5.0
public SelectionMethod SelectionMethod()
Gets the method used to select this object.
The method used to select this object.

SelectionPoint

#ExampleSince v5.0
public Point3d SelectionPoint()
If the object was selected by picking a point on it, then SelectionPoint() returns the point where the selection occurred, otherwise it returns Point3d.Unset.
The point where the selection occurred or Point3d.Unset on failure.

SelectionView

#Since v6.5
public RhinoView SelectionView()
If the object was interactively selected in a particular viewport, then SelectionView() returns the view where the object was selected.

SelectionViewDetailSerialNumber

#Since v6.5
[CLSCompliant(false)] public uint SelectionViewDetailSerialNumber()
If the object was interactively selected in a page space detail view, then SelectionViewDetailSerialNumber() returns the CRhinoObject serial number of the detail view object. Use SelectionView() to get the page view that contains the detail view object. If SelectionViewDetailSerialNumber() returns 0, then the selection did not happen in a detail view.

SetSelectionComponent

#Since v5.0
public void SetSelectionComponent(ComponentIndex componentIndex)
When an object is selected by picking a sub-object, SetSelectionComponent may be used to identify the sub-object.
componentIndex (ComponentIndex)

SubD

#Since v7.0
public SubD SubD()
Gets the SubD if the referenced geometry is one.
A SubD; or null if the referenced object is not a SubD, or on error.

SubDEdge

#Since v8.15
public SubDEdge SubDEdge()
Gets the SubDEdge if the referenced geometry is one.
A SubDEdge; or null if the referenced object is not a SubDEdge, or on error.

SubDFace

#Since v7.0
public SubDFace SubDFace()
Gets the SubDFace if the referenced geometry is one.
A SubDFace; or null if the referenced object is not a SubDFace, or on error.

SubDVertex

#Since v8.15
public SubDVertex SubDVertex()
Gets the SubDVertex if the referenced geometry is one.
A SubDVertex; or null if the referenced object is not a SubDVertex, or on error.

Surface

#ExampleSince v5.0
public Surface Surface()
Gets the surface if the referenced geometry is one.
A surface; or null if the referenced object is not a surface, or on error.

SurfaceParameter

#Since v5.0
public Surface SurfaceParameter(out double u, out double v)
If the reference geometry is a surface, brep with one face, or surface edge with a selection point, then this gets the surface parameters of the selection point.
u (out double)The U value is assigned to this out parameter during the call.
v (out double)The V value is assigned to this out parameter during the call.
If the selection point was on a surface, then the surface is returned.

TextDot

#Since v5.0
public TextDot TextDot()
Gets the text dot if the referenced geometry is one.
A text dot; or null if the referenced object is not a text dot, or on error.

TextEntity

#Since v5.0
public TextEntity TextEntity()
Gets the text entity if the referenced geometry is one.
A text entity; or null if the referenced object is not a text entity, or on error.

Trim

#Since v5.8
public BrepTrim Trim()
If the referenced geometry is an edge of a surface, this returns the associated brep trim.
A boundary representation trim; or null on error

Vertex

#Since v9.0
public BrepVertex Vertex()
If the referenced geometry is a brep vertex, this returns the brep vertex.
A boundary representation vertex; or null if the referenced geometry is not a brep vertex, or on error.