what is the use of _AcDb.Handle.IsOne

what is the use of _AcDb.Handle.IsOne

essam-salah
Collaborator Collaborator
574 Views
8 Replies
Message 1 of 9

what is the use of _AcDb.Handle.IsOne

essam-salah
Collaborator
Collaborator

Hi,

as its a self described title i want to know a use case for _AcDb.Handle.IsOne  ?

thanks in advance

0 Likes
Accepted solutions (1)
575 Views
8 Replies
Replies (8)
Message 2 of 9

BlackBox_
Advisor
Advisor

https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseSer...

 

There isn't much use for Handle == 1 (or Entity 0). 


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 3 of 9

essam-salah
Collaborator
Collaborator

@BlackBox_ 

i already read the documentation, another question can we know if the object exists or not using Handle ?

0 Likes
Message 4 of 9

_gile
Consultant
Consultant

@essam-salah  a écrit :

can we know if the object exists or not using Handle ?


You can use the undocumented Database.TryGetObjectId method.

Signature:

 

public bool Autodesk.AutoCAD.DatabaseServices.Database.TryGetObjectId(
    Autodesk.AutoCAD.DatabaseServices.Handle objHandle, 
    out Autodesk.AutoCAD.DatabaseServices.ObjectId id)

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 9

essam-salah
Collaborator
Collaborator

@_gile 

thanks for the post, so how to check if the Id is exist?

0 Likes
Message 6 of 9

_gile
Consultant
Consultant
Accepted solution

TryGetObjectId returns true, if the supplied Handle is bound to an ObjectId (and set this ObjectId to the out parameter); false, if the supplied Handle is not bound to an ObjectId (and set the out parameter to OnjectId.Null).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 7 of 9

daniel_cadext
Advisor
Advisor

It’s probably something internal, since it’s been around forever,A handle of One seems to always point to the AcDbBlockTable

 

“since all databases start with the same handseed value of 1 and go up from there”

 

I also wonder the purpose of mLow and mHigh?  Maybe to increase the address range back in the days of 16bit computers  

 

Sorry if I went off topic

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 8 of 9

artc2
Autodesk
Autodesk
Handles are 64-bit. mLow and mHigh are to allow 64-bit handles on 32-bit computers.
Message 9 of 9

daniel_cadext
Advisor
Advisor

Ah, that make more sense

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes