.NET

.NET

Reply
Active Member
SuperFly
Posts: 6
Registered: ‎08-12-2005
Message 1 of 7 (315 Views)

Extract Properties from AcadEntity

315 Views, 6 Replies
09-22-2005 02:03 PM
I'm trying to populate textboxes in a Windows App. with properties of a 3DSolid. I got the app to open a document with the solid and I can assign the solid to a variable - but I get an exception when I try to assign the 3DSolid's properties to variables. I can see the correct value in the Watch window though. For instance: Assume MySS is a selection set with 1 element being the solid.

Dim MySolid as Acad3DSolid
MySolid = MySS.Item(0)

Dim MyVolume as Double = MySolid.Volume

Last line is no good ==> Unhandled exception "System.EngineExecutionException"

but when I break and enter MySolid.MyVolume in the Watch window - it shows the correct value and says it's type "Double"

Could there be something wrong with my refs?

I've got AutoCad 2006 Type Library and AutoCAD/ObjectDBX Common 16.0 Type Library referenced.

Please help - this is driving me nuts.
*Norman Yuan
Message 2 of 7 (315 Views)

Re: Extract Properties from AcadEntity

09-22-2005 04:55 PM in reply to: SuperFly
If it is VB6, your code

Dim MySolid as Acad3DSolid
MySolid = MySS.Item(0)

looks fine. I am not sure, though, in VB.NET, implicit type conversion is
still OK. Since MySS.Item(0) returns an object, if you use C#, you
definitely need to cast it into Acad3DSolid:

MySolid=(Acad3DSolid)MySS.Item[0];

So, just try this in your VB.NET:

MySolid=CType(MySS.Item(0), Acad3DSolid)

wrote in message news:4964775@discussion.autodesk.com...
I'm trying to populate textboxes in a Windows App. with properties of a
3DSolid. I got the app to open a document with the solid and I can assign
the solid to a variable - but I get an exception when I try to assign the
3DSolid's properties to variables. I can see the correct value in the Watch
window though. For instance: Assume MySS is a selection set with 1 element
being the solid.

Dim MySolid as Acad3DSolid
MySolid = MySS.Item(0)

Dim MyVolume as Double = MySolid.Volume

Last line is no good ==> Unhandled exception
"System.EngineExecutionException"

but when I break and enter MySolid.MyVolume in the Watch window - it shows
the correct value and says it's type "Double"

Could there be something wrong with my refs?

I've got AutoCad 2006 Type Library and AutoCAD/ObjectDBX Common 16.0 Type
Library referenced.

Please help - this is driving me nuts.
Active Member
SuperFly
Posts: 6
Registered: ‎08-12-2005
Message 3 of 7 (315 Views)

Re: Extract Properties from AcadEntity

09-23-2005 05:37 AM in reply to: SuperFly
Yeah, I'm in .NET - I tried the conversion, but still no good. The line:

Dim MyVolume as Double = MySolid.Volume

gives this exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in MyProgram.exe

Additional information: Invalid argument color in IAcadEntity::smileytongue:ut_Color

Could this be a bug? Anyone try to do this before?
*Tony Tanzillo
Message 4 of 7 (315 Views)

Re: Extract Properties from AcadEntity

09-23-2005 07:13 AM in reply to: SuperFly
Is your code changing the color of the object somewhere?

--
http://www.caddzone.com

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

wrote in message news:4965236@discussion.autodesk.com...
Yeah, I'm in .NET - I tried the conversion, but still no good. The line:

Dim MyVolume as Double = MySolid.Volume

gives this exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in MyProgram.exe

Additional information: Invalid argument color in IAcadEntity::smileytongue:ut_Color

Could this be a bug? Anyone try to do this before?
Active Member
SuperFly
Posts: 6
Registered: ‎08-12-2005
Message 5 of 7 (315 Views)

Re: Extract Properties from AcadEntity

09-23-2005 07:19 AM in reply to: SuperFly
No - I'm not altering the entity at all. I open a file with a pre-existing solid, assign it to a variable using a selection set, and then just try to grab the volume. The color thing is very confusing. By the way - the file is .DXF - could this have anything to do with it? I'll try to save it as a dwg and try again.
Active Member
SuperFly
Posts: 6
Registered: ‎08-12-2005
Message 6 of 7 (315 Views)

Re: Extract Properties from AcadEntity

09-23-2005 08:15 AM in reply to: SuperFly
Update: I tried changing to a DWG file to no avail. However, I also tried creating the solid from scratch entirely through my .NET app - in this case, the resulting solid properties were assignable. This however is not an option because of speed constraints - wondering if this enlightens anyone to what's going on in my pre-existing solid case.
Distinguished Contributor
fantum
Posts: 313
Registered: ‎12-06-2004
Message 7 of 7 (315 Views)

Re: Extract Properties from AcadEntity

09-23-2005 09:17 AM in reply to: SuperFly
Sounds like your existing solid may have nothing in it. Where did you get it?

Never mind. I see where you managed to get a volume in the watch window. Message was edited by: fantum
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.