convert ObjectId to MapObjectId

convert ObjectId to MapObjectId

Anonymous
Not applicable
834 Views
2 Replies
Message 1 of 3

convert ObjectId to MapObjectId

Anonymous
Not applicable
Hi,

I basically need to iterate through every single objects in my drawings (the drawing project and attached drawings). Then I need to keep in memory the ID of each objects. It seems that MapObjectId is what I should use (instead of ObjectId which is not persistent through load/unload of attached drawings).

I have to ways to iterate through my objects:

1) Iterate on the project drawing's objects. But then how am I supposed to convert ObjectId to MapObjectID ? It seems that I need to know which drawing the object is coming from. Is there a way to obtain an object's origin ? or directly convert an ObjectId to a MapObjectId (with some static methods) ?


2) Iterate on each attached drawings and for each objects build a MapObjectId (via MapObjectId.Init() function). Then I still need to iterate through the project drawing's objects. The problem is I will get all attached objects one more time. This obviously a huge performance issue. Is there a way to "avoid" attached objects and only iterate through project's drawing's objects ?


TIA
0 Likes
835 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
My needs changed and therefore I don't use this approach anymore. However for the sake of for the sake of completeness, here is the simple way to do what I wanted:

Iterate on project drawing objects
Get the object's origin drawing using: HostMapApplicationServices.Application.ActiveProject.GetSourceDrawingId(id);
Build a MapObjectId using: MapObjectId.Init();

Beware of exception thrown if the object is not queried from an attached drawing.
0 Likes
Message 3 of 3

Anonymous
Not applicable

Could you please add a sample of your code that uses MapObjectId? I would help A LOT !! Thanks 

0 Likes