Author Topic: how can i find a entity by object's handle or objectid?  (Read 2224 times)

0 Members and 1 Guest are viewing this topic.

netcai

  • Mosquito
  • Posts: 12
how can i find a entity by object's handle or objectid?
« on: March 31, 2018, 05:00:09 AM »
I want to create a connection in two objects.So I store an entity's handle in another's ExtensionDictionary,but when these two objects in a block or xref,or array,the entity's handle will changed.So the connection will be lost. I alse tried to use objectid,the problem is same.

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: how can i find a entity by object's handle or objectid?
« Reply #1 on: March 31, 2018, 05:21:31 PM »
I think the issue you're running into is that when you create an array or block from the first two entities the new entities created in the block or array have new handles/ObjectId, which is unrelated to either of the originals. If you want to keep track of the new entity, you'll need to store it's handle as well.

When I'm trying to link two entities together, I store the handle.

huaxiamengqing

  • Guest
Re: how can i find a entity by object's handle or objectid?
« Reply #2 on: June 14, 2018, 11:40:11 AM »
Well, I also want to know how can i get entity by a handle or objectid--


Gasty

  • Newt
  • Posts: 90
Re: how can i find a entity by object's handle or objectid?
« Reply #4 on: June 16, 2018, 11:10:38 PM »
Hi,

I'm not exactly sure about the use case, but you can add Xdata to an entity, Xdata has a special code for handles (1005 if I recall well)  and if that entity get involved in a nesting process, like a block or array, you can explode in memory that complex object, and search for the handle stored in the original object/entity. In .NET you can do that (explode the complex object) inside a not committed transaction.

Gaston Nunez