Guid
-
New for 2014 is a guid for ComponentInstances and Groups. I have done a little experimenting and it seems that this guid is persistent when a file is saved and re-opened. It is also persistent when the entities inside the collection are changed (ie, the guid is persistent when the definition is changed).
The behavior of the ComponentDefinition guid (introduced in Version 6) is completely different. THIS guid is not persistent between models and changes any time the definition is changed:
http://www.sketchup.com/intl/en/developer/docs/ourdoc/componentdefinition#guid
It would be really nice to have the new version of guid work for both the types of objects...
Now for the question: Is there any way to get the object referenced by the guid? Something like:
ObjectSpace._id2ref(obj_id)
This would allow storing the guid in an attribute dictionary somewhere and then recalling the object quickly.
Thanks,
Karen
-
Yes, you are correct in your observation, the Group.guid and ComponentInstance.guid is persistent throughout their lifetime regardless of their changes. This was added to support the IFC exporter.
The old ComponentDefinition.guid is still not persistent, it changes. I'm not aware of the historical reasons for this.
Currently there is no API method to fetch an entity from a guid.
That is a feature that is often requested and we have it on our list. -
Thanks.
Advertisement