How to get instance visibility when its ON::idef_object

Hi, I’m reading a 3dm file, but have some instance visible that should not be. how can i get an object visibility, while model_geometry->Mode() == ON::idef_object ?
Thanks in advance.
#C++

Moved to Developer category.

thanks

Hi @elghorrim.sara,

Check the model geometry component’s attributes, ON_3dmObjectAttributes::Mode() to see if it’s visible or not.

You might also check to see if the layer the object resides on is on or off.

– Dale

Hi Dale, thanks for your reply,

Yes i did extract model geometry component attributes, and its mode is : idef_object, the layer is visible.

is there another thing that i should check, or it means that the geometry should be visible
?

Hi @elghorrim.sara,

If ON_3dmObjectAttributes::Mode() returns ON::idef_object, then the object is part of an ON_InstanceDefinition. An ON_InstanceDefinition defines the geometry used by instance references.

You can also use ON_3dmObjectAttributes::IsInstanceDefinitionObject() to determine if an object is part of an instance definition.

If you open the file in Rhino, you won’t see instance definition objects, as they make up instance definitions. Rhino’s Insert command lets you insert an instance of this definition, what we call an instance reference, or ON_InstanceRef.

More on reading instance definitions:

– Dale

1 Like