I’ve succesfully accessed the GUIDs of individual objects in a linked and embedded Block using Python. Unfortunately, I’ve found that if I change something in the reference file and then save the file, then when I update the linked block in my active model the GUIDs of the individual objects in the block change.
Is this expected behavior?
It would be really nice if the GUIDs of the individual objects in the linked block stayed the same. I’m trying to access specific objects using Python based upon their GUIDs, but every time the block is updated I loose my links because the GUIDs are different.
Any help on this matter would be greatly appreciated.
I’m trying to access the usertext in the individual objects of the block. I’m creating leaders in paperspace to annotate based upon the usertext. So it is necessary that the GUIDs are static. Right now, because the GUIDs do change, the usertext function for text entities fails because it can’t find the correct object.
Thanks for thinking about this issue. I’d need to see an example becuase I’m not sure how the ‘GUID like’ marker would help. Can I point the AttributeUserText function of Text to that ‘GUID like’ marker instead of an actual GUID? I want the text to be able to update if I change the usertext value.
I suppose if there isn’t an automatic function, then if there was a way to at least run a script that could update the annotations that might work too. In that case I would still need a way to point back to the correct object in the block to tell the script which individual object to query
Hi Ian - I’m thinking that if on the original objects you add user text with key “IansGUID” and a value of either a guid like text - maybe even the object’s actual GUID or some other tag that makes sense to you. Then in the block you have your script look for IansGUID,as user text rather than the real GUID.
id = rs.GetObject()
rs.SetUserText(id, 'IansGUID', id)
Ok, I think I follow. That has some interesting possibilities.
For each annotation object I could set a usertext value for the block GUID which shouldn’t change, and a usertext value for IansGUID. Then I could write a script which could loop through each annotation and query the object in the block to check for updated usertext.
The only thing I’m not sure of is if there is a quick way to find an object by usertext value? The only way I can think of is to loop through every individual object and check the value. My blocks are very large so this could be very time intensive to update all of my annotations. Is there a Python or RhinoCommon method to select an object from a list of object GUIDs based upon a usertext value?
They all have usertext, so that built-in function is what I was looking for. I might give that a shot as it seems like my best bet.
BTW, whats the reason that worksessions don’t store the detail layerstates and visibilitystates? If I could use worksessions that would solve my usertext issues completely, but because worksessions can’t be used for creating drawings I’m forced to go the Block route.