.NET

Reply
Distinguished Contributor
wesbird
Posts: 343
Registered: ‎12-05-2003
Message 1 of 9 (286 Views)

How to convert .NET ObjectId to COM int ObjectID?

286 Views, 8 Replies
09-30-2005 07:53 AM
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
*J. Daniel Smith
Message 2 of 9 (285 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

09-30-2005 08:14 AM 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
Distinguished Contributor
wesbird
Posts: 343
Registered: ‎12-05-2003
Message 3 of 9 (285 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

09-30-2005 08:22 AM in reply to: wesbird
Thank you,
*Albert Szilvasy
Message 4 of 9 (285 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

09-30-2005 08:37 AM 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
Distinguished Contributor
wesbird
Posts: 343
Registered: ‎12-05-2003
Message 5 of 9 (285 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

10-04-2005 07:23 AM in reply to: wesbird
Now I have the reverse problem, how to convert COM int ObjectID to .NET object ObjectId?




Thank you,
Wes
*J. Daniel Smith
Message 6 of 9 (285 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

10-04-2005 09:44 AM 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
Valued Contributor
smcclure
Posts: 60
Registered: ‎06-08-2006
Message 7 of 9 (285 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

08-22-2006 12:50 PM 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?
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 8 of 9 (286 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

08-22-2006 02:32 PM 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.
Valued Contributor
smcclure
Posts: 60
Registered: ‎06-08-2006
Message 9 of 9 (286 Views)

Re: How to convert .NET ObjectId to COM int ObjectID?

08-22-2006 03:21 PM in reply to: wesbird
Thanks!

- Scott

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community