Rhino C++ API  7.18
Public Member Functions | Public Attributes | List of all members
ON_ObjRef Class Reference

#include <opennurbs_objref.h>

Inheritance diagram for ON_ObjRef:
CRhinoObjRef CRhinoMeshRef

Public Member Functions

 ON_ObjRef ()
 
 ON_ObjRef (const ON_ObjRef &src)
 
 ~ON_ObjRef ()
 
void DecrementProxyReferenceCount ()
 
void Destroy ()
 
ON_ObjRefoperator= (const ON_ObjRef &src)
 
const ON_ObjectProxyObject (int proxy_object_index) const
 
int ProxyReferenceCount () const
 
bool Read (ON_BinaryArchive &)
 
void RemapObjectId (const ON_SimpleArray< ON_UuidPair > &uuid_remap)
 
bool SetParentIRef (const ON_InstanceRef &iref, ON_UUID iref_id, int idef_geometry_index)
 
void SetProxy (ON_Object *proxy1, ON_Object *proxy2, bool bCountReferences)
 
bool Write (ON_BinaryArchive &) const
 

Public Attributes

ON_SimpleArray< ON_ObjRef_IRefIDm__iref
 
ON_COMPONENT_INDEX m_component_index
 
ON_ObjRefEvaluationParameter m_evp
 
const ON_Geometrym_geometry
 
int m_geometry_type
 
ON::osnap_mode m_osnap_mode
 
const ON_Geometrym_parent_geometry
 
ON_3dPoint m_point
 
unsigned int m_runtime_sn
 
ON_UUID m_uuid
 

Constructor & Destructor Documentation

◆ ON_ObjRef() [1/2]

ON_ObjRef::ON_ObjRef ( )

◆ ON_ObjRef() [2/2]

ON_ObjRef::ON_ObjRef ( const ON_ObjRef src)

◆ ~ON_ObjRef()

ON_ObjRef::~ON_ObjRef ( )

Member Function Documentation

◆ DecrementProxyReferenceCount()

void ON_ObjRef::DecrementProxyReferenceCount ( )

Description: Expert user tool to decrement reference counts. Most users will never need to call this tool. It is called by ~ON_ObjRef and used in rare cases when a ON_ObjRef needs to reference an object only by uuid and component index.

◆ Destroy()

void ON_ObjRef::Destroy ( )

◆ operator=()

ON_ObjRef& ON_ObjRef::operator= ( const ON_ObjRef src)

◆ ProxyObject()

const ON_Object* ON_ObjRef::ProxyObject ( int  proxy_object_index) const

Parameters: proxy_object_index - [in] 1 or 2. Returns: A pointer to the requested proxy object.

◆ ProxyReferenceCount()

int ON_ObjRef::ProxyReferenceCount ( ) const

Returns: 0: This ON_ObjRef is not counting references. >0: Number of references.

◆ Read()

bool ON_ObjRef::Read ( ON_BinaryArchive )

◆ RemapObjectId()

void ON_ObjRef::RemapObjectId ( const ON_SimpleArray< ON_UuidPair > &  uuid_remap)

Description: This tool is used in rare situations when the object ids stored in the uuid list need to be remapped. Parameters: uuid_remap - [in] Is it critical that uuid_remap[] be sorted with respect to ON_UuidPair::CompareFirstUuid.

◆ SetParentIRef()

bool ON_ObjRef::SetParentIRef ( const ON_InstanceRef iref,
ON_UUID  iref_id,
int  idef_geometry_index 
)

◆ SetProxy()

void ON_ObjRef::SetProxy ( ON_Object proxy1,
ON_Object proxy2,
bool  bCountReferences 
)

Description: Expert user tool to initialize the ON_ObjRef m__proxy1, m__proxy2, and m__proxy_ref_count fields.

◆ Write()

bool ON_ObjRef::Write ( ON_BinaryArchive ) const

Member Data Documentation

◆ m__iref

ON_SimpleArray<ON_ObjRef_IRefID> ON_ObjRef::m__iref

If m__iref[] is not empty, then m_uuid identifies and instance reference (ON_InstanceRef/CRhinoInstanceObject) and m__iref[] records the chain of instance references from the base piece of geometry to the instance reference. The top level instance reference is last in the list.

◆ m_component_index

ON_COMPONENT_INDEX ON_ObjRef::m_component_index

◆ m_evp

ON_ObjRefEvaluationParameter ON_ObjRef::m_evp

If m_point != ON_3dPoint::UnsetPoint and m_evp.m_t_type != 0, then m_evp records the records the m_geometry evaluation parameters for the m_point.

◆ m_geometry

const ON_Geometry* ON_ObjRef::m_geometry

The m_geometry and m_parent_geometry pointers are runtime values that point to the object being referenced. The destructor ~ON_ObjRef does not delete the objects these pointers reference.

m_geometry_type records the type of geometry m_geometry points to.

When the referenced object is a subobject, like a part of a brep or mesh, m_geometry points to the subobject and m_parent_geometry points to the parent object, like the brep or mesh. In this case m_component_index records the location of the subobject.

Parts of instance reference objects: When the geometry belongs to an instance reference m_uuid is the id of the CRhinoInstanceObject, m_parent_geometry points to the instance definition geometry or a transformed proxy, and m_geometry points to the piece of m_geometry. The m__iref[] array records the connection between the instance reference and the geometry the ON_ObjRef refers to.

For example if the ON_ObjRef is to an edge of a brep in and instance reference, m_uuid would be the Rhino id of the CRhinoInstanceObject, m_parent_geometry would point to a, possibly proxy, ON_Brep object, m_geometry would point to the ON_BrepEdge in the ON_Brep, m_component_index would record the edge's index in the ON_Brep.m_E[] array and m_geometry_type would be ON::curve_object or ON::brep_edge. m__iref->Last() would contain the information about the top level instance reference. If the brep was at the bottom of a chain of instance references, m__iref[0] would be the reference that immediately used the brep.

◆ m_geometry_type

int ON_ObjRef::m_geometry_type

◆ m_osnap_mode

ON::osnap_mode ON_ObjRef::m_osnap_mode

If the point was the result of some type of object snap, then the object snap is recorded here.

◆ m_parent_geometry

const ON_Geometry* ON_ObjRef::m_parent_geometry

◆ m_point

ON_3dPoint ON_ObjRef::m_point

If m_point != ON_3dPoint::UnsetPoint, then the ObjRef resolves to a point location. The point location is saved here so the information can persist if the object itself vanishes.

◆ m_runtime_sn

unsigned int ON_ObjRef::m_runtime_sn

If m_runtime_sn > 0, then it is the value of a Rhino object's CRhinoObject::m_runtime_object_serial_number field. The serial number is used instead of the pointer to prevent crashes in cases when the CRhinoObject is deleted but an ON_ObjRef continues to reference the Rhino object. The value of m_runtime_sn is not saved in archives because it generally changes if you save and reload an archive.

◆ m_uuid

ON_UUID ON_ObjRef::m_uuid

In Rhino, this uuid is the persistent id of the CRhinoObject that owns the referenced geometry. The value of the CRhinoObject id is stored on ON_3dmObjectAttributes.m_uuid.