.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is an ObjectID.Handle?

5 REPLIES 5
Reply
Message 1 of 6
nshupeFMPE3
2942 Views, 5 Replies

What is an ObjectID.Handle?

Hello, 

I'm new to AutoCAD and programming for AutoCAD. But I'm being given the chance to learn which is great! I've been given code for our plugin which has special tools we need for our application. I'm trying to maintain and add functionality to this. 

I just ran across something that I'm not familiar with, which is an ObjectID.Handle? What's it's use over or different from an ObjectID?

Side note, is there a good place to ask these kind of simple questions, since I'll prob have many? Or a good resource to use to look these things up?

Labels (4)
5 REPLIES 5
Message 2 of 6
_gile
in reply to: nshupeFMPE3

Hi,

The Handle is a persisitent indentifier which is unique per drawing.

The ObjectId is a non-persitent identifier (reassigned each time the drawing is opened) which is unique per session.

In an AutoCAD session, you can get the Handle of a DBObject from its ObjectId using the ObjectId.Handle property.

On the other hand, you can get the the ObjectId of a DBObject from its Handle (and its Database) with the Database.GetObjectId() method.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 6
Anonymous
in reply to: _gile

Thank you very much, that is a great answer. Where would one find this information so I don't need to ask these small questions?

 

Thanks for your help!

Message 4 of 6
_gile
in reply to: Anonymous

All the links provided in my previous messsge come from here:
https://help.autodesk.com/view/OARX/2022/ENU/
Specifically 'ObjectARX Managed .NET Developer's Guide' and 'ObjectARX Managed .NET Reference Guide' sections.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 6
Anonymous
in reply to: _gile

Thanks again, this will help a lot!

Message 6 of 6
fsztuczny
in reply to: nshupeFMPE3

From myself I will add that if you open multiple drawings, the handle may have the same value for different objects in different drawings. ObjectId is unique even if you have multiple drawings open and several different objects in the diferrent drawings have a handle with the same value. You have to be very careful to avoid confusion by using the handle between different drawings.

If you want a store a handle of an object in a drawing (in Xrecord for example), always use handle because it is unique and constatnt in the drawing. Handle shall be unique in the drawing, even if you delete the object and add a new one. If you want to open object, use the ObjectId, because it is unique among drawings.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta