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

Converting COM TO NET object

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
311 Views, 4 Replies

Converting COM TO NET object

Hi all,
Need guidence.
I am trying to convert COM object (retrived from AcadSelectionSet) to .net object. I am getting an exception.

Is these any betterway to do this. Fianl result must be “Entity” object.

ObjectId tempID = new ObjectId(acadSelect.Item(objectNumber).ObjectID)
Entity en = (Entity)tempID.GetObject(OpenMode.ForWrite, false, true); // Exception

Where acadSelect is an AcadSelectionSet

A help on this is appreciated.
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Use the DBObject.FromAcadObject() static method.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5789604@discussion.autodesk.com...
Hi all,
Need guidence.
I am trying to convert COM object (retrived from AcadSelectionSet) to .net object. I am getting an exception.

Is these any betterway to do this. Fianl result must be “Entity” object.

ObjectId tempID = new ObjectId(acadSelect.Item(objectNumber).ObjectID)
Entity en = (Entity)tempID.GetObject(OpenMode.ForWrite, false, true); // Exception

Where acadSelect is an AcadSelectionSet

A help on this is appreciated.
Message 3 of 5
Anonymous
in reply to: Anonymous

As per your suggestion, I used this static method but I end up with same exception. Any further suggestion on this?
For your reference I have attached an image.

ObjectId tempID = Autodesk.AutoCAD.DatabaseServices.DBObject.FromAcadObject(acadSelect.Item(objectNumber));

Entity en = (Entity)tempID.GetObject(OpenMode.ForWrite,false, false);
Message 4 of 5
Anonymous
in reply to: Anonymous

No further suggestions with the little
information you've provided, sorry.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5790493@discussion.autodesk.com...
As per your suggestion, I used this static method but I end up with same exception. Any further suggestion on this?
For your reference I have attached an image.

ObjectId tempID = Autodesk.AutoCAD.DatabaseServices.DBObject.FromAcadObject(acadSelect.Item(objectNumber));

Entity en = (Entity)tempID.GetObject(OpenMode.ForWrite,false, false);
Message 5 of 5
Anonymous
in reply to: Anonymous

OK. I was able to solve this problem. Transaction Manager did the trick.
Thanks, for your assistance.

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