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

Get DBObject information from Handle

12 REPLIES 12
Reply
Message 1 of 13
tommy.yang
609 Views, 12 Replies

Get DBObject information from Handle

Hi,
I used AutoLISP for years, I knew a function 'handent' which can get id of entity from it's handle, I want to know what is the same method to achieve this function
Great appreciation for your reply, thanks in advance.
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: tommy.yang

Type 'handle' in the object browser. If your just getting started this is
a invaluable resource.

wrote in message news:5490370@discussion.autodesk.com...
Hi,
I used AutoLISP for years, I knew a function 'handent' which can get id of
entity from it's handle, I want to know what is the same method to achieve
this function
Great appreciation for your reply, thanks in advance.
Message 3 of 13
tommy.yang
in reply to: tommy.yang

Thanks for your reply.
Perhaps I did not describe my problem clearly, what I meant was: when I got a handle value of an entity, I must find it's object information using this handle value, but I cannot find a way in C# for .net.
In the software I had developed using the language of AutoLISP, it used xdata of entity to save handle of other entity in order to build relation between two entities, because Autodesk said the handle of entity could maintain the unique value after dwging' reopen, so, if I use C# instead, I must get a way which can get information of object with the given handle.
Please give me further help, thank you very much, and I feel so regret for my poor english too. Message was edited by: tommy.yang
Message 4 of 13
Anonymous
in reply to: tommy.yang

db.GetObjectID(...)
wrote in message news:5490610@discussion.autodesk.com...
Thanks for your reply.
Perhaps I did not describe my problem clearly, what I meant was: when I got
a handle value of an entity, I must find it's object information using this
handle value, but I cannot find a way in C# for .net.
In the software I had developed using the language of AutoLISP, it used
xdata of entity to save handle of other entity in order to build relation
between two entities, because Autodesk said the handle of entity could
maintain the unique value after dwging' reopen, so, if I use C# instead, I
must get a way which can get information of object with the given handle.
Please give me further help, thank you very much, and I feel so regret for
my poor english too.

Message was edited by: tommy.yang
Message 5 of 13
Anonymous
in reply to: tommy.yang


Have a look at

 


size=2>Database.GetObjectId Method 

 

It's not so easy to find in the browser
:-)

 

/// kwb

 

 

Thanks for your reply.
Perhaps
I did not describe my problem clearly, what I meant was: when I got a handle
value of an entity, I must find it's object information using this handle value,
but I cannot find a way in C# for .net.
In the software I had developed
using the language of  AutoLISP, it  used xdata of entity to save
handle of other entity in order to build relation between two entities, because
Autodesk said the handle of entity could maintain the unique value after dwging'
reopen,  so, if I use C# instead, I must get a way which can get
information of object with the given handle.
Please give me further help,
thank you very much, and I feel so regret for my poor english
too.

Message was edited by: tommy.yang
Message 6 of 13
Anonymous
in reply to: tommy.yang


Looks like I should refresh my newsreader before
answering 🙂

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Have a look at

 


size=2>Database.GetObjectId Method 

 

It's not so easy to find in the browser
🙂

 

/// kwb

 

 

Thanks for your
reply.
Perhaps I did not describe my problem clearly, what I meant was:
when I got a handle value of an entity, I must find it's object information
using this handle value, but I cannot find a way in C# for .net.
In the
software I had developed using the language of  AutoLISP, it  used
xdata of entity to save handle of other entity in order to build relation
between two entities, because Autodesk said the handle of entity could
maintain the unique value after dwging' reopen,  so, if I use C# instead,
I must get a way which can get information of object with the given
handle.
Please give me further help, thank you very much, and I feel so
regret for my poor english too.

Message was edited by:
tommy.yang
Message 7 of 13
Anonymous
in reply to: tommy.yang


🙂


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Looks like I should refresh my newsreader before
answering 🙂

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Have a look at

 


size=2>Database.GetObjectId Method 

 

It's not so easy to find in the browser
🙂

 

/// kwb

 

 

Thanks for your
reply.
Perhaps I did not describe my problem clearly, what I meant was:
when I got a handle value of an entity, I must find it's object information
using this handle value, but I cannot find a way in C# for .net.
In the
software I had developed using the language of  AutoLISP, it  used
xdata of entity to save handle of other entity in order to build relation
between two entities, because Autodesk said the handle of entity could
maintain the unique value after dwging' reopen,  so, if I use C#
instead, I must get a way which can get information of object with the given
handle.
Please give me further help, thank you very much, and I feel so
regret for my poor english too.

Message was edited by:
tommy.yang
Message 8 of 13
Anonymous
in reply to: tommy.yang

Hi Paul. It might be less confusing for a
new learner if you used class names rather
than the names of variables you commonly
use, as per Kerry's response.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Paul Richardson" wrote in message news:5490627@discussion.autodesk.com...
db.GetObjectID(...)
wrote in message news:5490610@discussion.autodesk.com...
Thanks for your reply.
Perhaps I did not describe my problem clearly, what I meant was: when I got
a handle value of an entity, I must find it's object information using this
handle value, but I cannot find a way in C# for .net.
In the software I had developed using the language of AutoLISP, it used
xdata of entity to save handle of other entity in order to build relation
between two entities, because Autodesk said the handle of entity could
maintain the unique value after dwging' reopen, so, if I use C# instead, I
must get a way which can get information of object with the given handle.
Please give me further help, thank you very much, and I feel so regret for
my poor english too.

Message was edited by: tommy.yang
Message 9 of 13
tommy.yang
in reply to: tommy.yang

Let me express my great appreciation for your help, I do it successfully with db.GetObject method, thank you very much
Message 10 of 13
Anonymous
in reply to: tommy.yang

Agreed! Good point 🙂
"Tony Tanzillo" wrote in message
news:5490785@discussion.autodesk.com...
Hi Paul. It might be less confusing for a
new learner if you used class names rather
than the names of variables you commonly
use, as per Kerry's response.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Paul Richardson" wrote in message
news:5490627@discussion.autodesk.com...
db.GetObjectID(...)
wrote in message news:5490610@discussion.autodesk.com...
Thanks for your reply.
Perhaps I did not describe my problem clearly, what I meant was: when I got
a handle value of an entity, I must find it's object information using this
handle value, but I cannot find a way in C# for .net.
In the software I had developed using the language of AutoLISP, it used
xdata of entity to save handle of other entity in order to build relation
between two entities, because Autodesk said the handle of entity could
maintain the unique value after dwging' reopen, so, if I use C# instead, I
must get a way which can get information of object with the given handle.
Please give me further help, thank you very much, and I feel so regret for
my poor english too.

Message was edited by: tommy.yang
Message 11 of 13
Anonymous
in reply to: tommy.yang


>It's not so easy to find in the
browser

You're right! I spend way to much time reading the
object browser so I start

to think stuff is easy to find!


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">


Have a look at

 


size=2>Database.GetObjectId Method 

 

It's not so easy to find in the browser
🙂

 

/// kwb

 

 

Thanks for your
reply.
Perhaps I did not describe my problem clearly, what I meant was:
when I got a handle value of an entity, I must find it's object information
using this handle value, but I cannot find a way in C# for .net.
In the
software I had developed using the language of  AutoLISP, it  used
xdata of entity to save handle of other entity in order to build relation
between two entities, because Autodesk said the handle of entity could
maintain the unique value after dwging' reopen,  so, if I use C# instead,
I must get a way which can get information of object with the given
handle.
Please give me further help, thank you very much, and I feel so
regret for my poor english too.

Message was edited by:
tommy.yang
Message 12 of 13
aslam
in reply to: tommy.yang

Hi guys,
I m facing the problem in this. When i directly call a method which retrieve the Object id from database then it workds well but when i try to do the same in THREAD, then it thorw NullReferenceException. Here is the Method which i m using

void StoreSomething(string handleString)
{

ObjectId objectId = Application.DocumentManager.MdiActiveDocument.Database.GetObjectId(false, GetHandle(handleString), 1);
}

GetHandle(string handle)
{
return new Autodesk.AutoCAD.DatabaseServices.Handle(Int64.Parse(hexstr, System.Globalization.NumberStyles.HexNumber));
}

Here when i call StoreSomethig() directly then it works fine but when i call this in a multithreading then i gives exceptions.

Thanks...
Message 13 of 13
Anonymous
in reply to: tommy.yang

just published :

http://through-the-interface.typepad.com/through_the_interface/2007/02/getting_access_.html


wrote in message news:5490370@discussion.autodesk.com...
Hi,
I used AutoLISP for years, I knew a function 'handent' which can get id of
entity from it's handle, I want to know what is the same method to achieve
this function
Great appreciation for your reply, thanks in advance.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost