Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8530

CRhinoObjRef creation

$
0
0

@gennaro wrote:

Hi everybody,
I am currently using CRhinoObjRef to store information of objects, subobjects and grips.
My problem is that I still do not have clear how to build correctly a CRhinoObjRef instance.

I have noticed that, for example, when I create a CRhinoObjRef from of an extrusion object it behaves in a different way than a CRhinoObjRef created from the copy of such object.
For instance, the CRhinoObjRef created from the original returns a brep when I use the Brep() method.
The CRhinoObjRef created from the copy of the object do not return anything.
Here a short example:

CRhinoGetObject go;
go.SetCommandPrompt( L"Select comp" );
go.SetGeometryFilter(CRhinoGetObject::surface_object);
go.GetObjects( 1, 1 );
if( go.CommandResult() != CRhinoCommand::success )
	return go.CommandResult();

CRhinoObjRef& objref1 = go.Object(0);
CRhinoObject * objDup = objref1.Object()->Duplicate();
CRhinoObjRef newObj (objDup);

RhinoApp().Print( L"objref1:: (brep? %d) - (type ? %d) \n", 0!=objref1.Brep(), objref1.m_component_index.m_type);
RhinoApp().Print( L"objDup:: (brep? %d) - (type ? %d) \n", 0!=newObj.Brep(), newObj.m_component_index.m_type);

that returns (when I select a face)

objref1:: (brep? 1) - (type ? 3)
objDup:: (brep? 0) - (type ? 0)

It means, I guess, that CRhinoObjRef has to be built in a proper way ( can one thing be the proxy? )
Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8530

Trending Articles