Object GUIDs in Linked & Embeded Block change when I save the referenced file

Hello,
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.
Thanks
Ian

Yes, I would say that it is, if I understand, which I may not - what are you trying to do? You may need to get at the geometry from the block objects, not by Ids.

-Pascal

Pascal,
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.

Hopefully there is a work-around.
Thanks

Ian

Hi Ian - I have not delved into this at all yet but what comes to mind before breakfast is that you can add your own ‘guid’ like marker as user text on the objects in the source file.

-Pascal

Pascal,
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

Thanks
Ian

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)


-Pascal

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?

Thanks again for the help
Ian

Hi Ian - do all of the objects in the blocks, or a large proportion, have user text?

@NavArch - Here’s what I’d look at from RhinoCommon if you decide to test this idea:
https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_DocObjects_Tables_ObjectTable_FindByUserString.htm

You’d get at that by
import scriptcontext
objs = scriptcontext.doc.Objects.FindByUserString(etc etc )

-Pascal

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.

Ian

Hi Ian - that limitation on worksessions is not easy to overcome - you’re not alone in your request but it is, I gather, not possible yet to make Rhino work that way…

-Pascal