.NET

.NET

Reply
Distinguished Contributor
368 Posts
0 Kudos
Registered: ‎12-05-2003
Post 1 of 9

How to convert .NET ObjectId to COM int ObjectID?

330 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
Vault Pro 2014, Windows 7 64 bit, AutoCAD (ACA, Map) 2014
*J. Daniel Smith
Post 2 of 9

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
368 Posts
0 Kudos
Registered: ‎12-05-2003
Post 3 of 9

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

09-30-2005 08:22 AM in reply to: wesbird
Thank you,
Vault Pro 2014, Windows 7 64 bit, AutoCAD (ACA, Map) 2014
*Albert Szilvasy
Post 4 of 9

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
368 Posts
0 Kudos
Registered: ‎12-05-2003
Post 5 of 9

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
Vault Pro 2014, Windows 7 64 bit, AutoCAD (ACA, Map) 2014
*J. Daniel Smith
Post 6 of 9

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
60 Posts
1 Kudo
Registered: ‎06-08-2006
Post 7 of 9

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
303 Posts
1 Kudo
Registered: ‎09-26-2004
Post 8 of 9

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
60 Posts
1 Kudo
Registered: ‎06-08-2006
Post 9 of 9

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

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

- Scott
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!