Keeping a reference to specific piece of geo inside a Block

Hi,

How would I go about keeping a reference to a piece of geometry inside a BlockDefinition?

My initial attempt was to use the Guid, but it’s not static across BlockEdits.

  1. Create a block with 1 geo inside.
  2. Edit the block.
  3. Note the Guid of the geo.
  4. Save the Block.
  5. Edit the Block.
  6. The Guid of the geo is now something other than before :cloud_with_lightning:

Any ideas? :slightly_smiling_face:

Have you tried tagging the object with your own user data?

– Dale

Thanks for the suggestion!
I haven’t tried that yet. It feels a bit dirty essentially implementing my own .Id across the application. If that was my own suggestion I would think I was doing something wrong :grin:

Do you think it’s fast enough to do that everywhere? I make quite extensive use of DocEvents such as selection-, addobject-, removeobject, etc. already and they all use the “real” id. Querying for the UserData Id all the time sounds slow, but it might not be?

The RhinoDoc.AddRhinoObject event, etc. triggers on BlockEdit enter, and exit for all objects in the Block, and original Doc respectively. I ended up relying on them, and just doing the bookkeeping required to handle it.