Just starting to use Rhino3d .net package to parse 3dm files. Later, my goal will be to develop a Rhino plugin (with Rhino.Common) to get the tree structure of the active model. I don’t know if a such plugin exists.
Rhino3d .net package works quite fine, but I still encounter some problems :
I can’t see how to match an object (in AllObjects) with his block InstanceDefinition. Each object.Attributes has a bool IsInstanceDefinitionObject, but i can’t see any InstanceDefinitionIndex. The goal is to “assemble” objects by block.
Moreover i can’t see how to explore blocks recursively when it comes with nested blocks. The Instance definition object need to have a InstanceDefinitionIndex to be able to rebuild the hiearchy.
I can’t see how to get the xform transformation of an InstanceDefinition. I can see xform object when debugging, but the attribute is not accessible !
How to get the group index of an object ? I can see Attributes.GetGroupList(), why a list ? A solid can be in more than one group ?
group.Name does’t not match the right name set in Rhino, I always get “GroupXX”. I figure out the group name is on the solid. The name of the group is on its objects, so that the real object’s name is replaced by the group’s name.
Unfortunatly Rhino3dm works in a different than Rhino.Common. A 3dm file is loaded as a memory object using var doc = File3dm.Read(filepath), so that it’s not possible to execute commands, one can only explore the doc object.
It is best to walk through the instance definition table to get lists of objects that are in the instance definitions. This is what Nathan is showing in his sample
Now, i can retrieve everything when using Rhino3dm in good way.
1 - Except, AllGroups doesn’t contained the groups of a block, so that i can’t make the matching through Attributes.GetGroupList of an InstanceReferenceGeometry.
2 - Moreover, something strange, much more about Rhino, the material of a layer in a block seems to not be transfered (either linked or incrusted).