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

How to convert .NET ObjectId to COM int ObjectID?

8 REPLIES 8
Reply
Message 1 of 9
wesbird
961 Views, 8 Replies

How to convert .NET ObjectId to COM int ObjectID?

Hi,
I am working (actually learning) .Net in 2006. I need work with CAO which still COM based. so I use Interop to create a general function. When I work with LinkTemplate.CreateLink, it required ObjectID as int, in .Net, OjbectId as a kind of Object and I did not find any Method/properties to convert it int (Long actually).

Did anyone have the same problem before? How do you handle it? It will great if you can some example.

Thank you a lot and appreciate your help
Wes
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: wesbird

See the ObjectId.OldId property.

Dan

wrote in message news:4972035@discussion.autodesk.com...
Hi,
I am working (actually learning) .Net in 2006. I need work with CAO which
still COM based. so I use Interop to create a general function. When I work
with LinkTemplate.CreateLink, it required ObjectID as int, in .Net, OjbectId
as a kind of Object and I did not find any Method/properties to convert it
int (Long actually).

Did anyone have the same problem before? How do you handle it? It will great
if you can some example.

Thank you a lot and appreciate your help
Wes
Message 3 of 9
wesbird
in reply to: wesbird

Thank you,
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
Message 4 of 9
Anonymous
in reply to: wesbird

See ObjectId.OldId property

Albert
wrote in message news:4972035@discussion.autodesk.com...
Hi,
I am working (actually learning) .Net in 2006. I need work with CAO which
still COM based. so I use Interop to create a general function. When I work
with LinkTemplate.CreateLink, it required ObjectID as int, in .Net, OjbectId
as a kind of Object and I did not find any Method/properties to convert it
int (Long actually).

Did anyone have the same problem before? How do you handle it? It will great
if you can some example.

Thank you a lot and appreciate your help
Wes
Message 5 of 9
wesbird
in reply to: wesbird

Now I have the reverse problem, how to convert COM int ObjectID to .NET object ObjectId?




Thank you,
Wes
Windows 10 64 bit, AutoCAD (ACA, Map) 2023
Message 6 of 9
Anonymous
in reply to: wesbird

Do you use the Object Browser? If so, you'd see a public constructor for
ObjectId which takes an "int oldId" parameter.

Dan

wrote in message news:4974621@discussion.autodesk.com...
Now I have the reverse problem, how to convert COM int ObjectID to .NET
object ObjectId?




Thank you,
Wes
Message 7 of 9
smcclure
in reply to: wesbird

Does this constructor exist in 2005? I do not see it...

Is there a better way to convert an AcadBlockReference to a BlockReference?
Message 8 of 9
Anonymous
in reply to: wesbird

In AutoCAD 2005 ObjectId.OldId property can be get and put.
In AutoCAD 2006+ this property is read-only but there is constructor ObjectIId(int). You can check version of AutoCAD and use appropriate method for converting.
Message 9 of 9
smcclure
in reply to: wesbird

Thanks!

- Scott

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