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

Find exact type of a COM Acad Object

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
bert.vanpeteghem
594 Views, 3 Replies

Find exact type of a COM Acad Object

Hi,

 

Here's what I'm trying to do:

 

Use .NET to select a Part Reference (Acad Mechanical). For .NET this is simply an entity (or EntityImp to be precise).

 

Now, I'd like to get more information out of that entity, which (as far as I know with ACADM) is only possible through ARX or VBA.

 

So, first question: How can I do this? I'm trying to go from the .NET Acad Entity to a Interop MPartReference.

 

Is it possible through for example selectedEntity.AcadObject ?

 

Second question: I won't know what kind of entity is selected in advance. I need to know the COM type of the entity. How can I handle that best?

 

Thanks,

 

Bert

3 REPLIES 3
Message 2 of 4
caddzone
in reply to: bert.vanpeteghem

That's one of the unfortunate problems with COM, a COM object can't

tell you what interfaces it supports, you can only ask it if it supports

an interface, and it can say yes or no.

 

The ObjectName property is the only way you can tell what type of

object it is (the ObjectARX runtime class name).



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Message 3 of 4
bert.vanpeteghem
in reply to: caddzone

Just for the sake of completeness, as I think caddzone mentioned, this is possible through the following piece of code:

 

var dbObject = foo as DBObject;

var typeName = dbObject.GetRXClass().Name;

Message 4 of 4
caddzone
in reply to: bert.vanpeteghem

I believe the OP was referring to a COM object and COM types, not a
managed .NET object wrapper or .NET types. In his case, the objects

he's working with do not have managed .NET wrappers.

 



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


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