I’ve been trying to get Instance export (via ONX_Model) working for the last week or so, but I’m still having mysterious issues. The procedure I’m using is something like this:
create new ON_InstanceDefinition
Create object and add it to file using AddManagedModelGeometryComponent
get its uuid via ModelComponentId
pass the uuid to instance def with AddInstanceGeometryId
create new ON_InstanceRef
set its m_instance_definition_uuid to the ON_InstanceDefintion's uuid
add the ON_InstanceRef to file using AddManagedModelGeometryComponent
Obviously this has a bit of wrongness in that it seems to add the geometry to BOTH the overall file and the instance definition. But after export and then import again, every ON_InstanceRef I created is imported, but none of their ON_InstanceRefs have any geometry in them at all.
Any hints or pointers to documentation / examples I’m missing?
Yes! I thought it was likely to be the SetMode(ON::idef_object) thing, but that didn’t help. (Though I bet it helps with the side issue I was worried about.)
However, switching from using AddModelComponent to AddManagedModelComponent did the trick! Now I’m back in business and moving forward again…