.NET

Reply
Valued Contributor
jason.teagle
Posts: 70
Registered: ‎06-22-2010
Message 1 of 3 (208 Views)
Accepted Solution

C# Equivalent of MyEntityType::desc()?

208 Views, 2 Replies
03-28-2012 05:38 AM

Sorry for the rather basic question but I'm coming from the ObjectARX side and now trying to get some code going in C#. I've got the DLL / NETLOAD mechanism working just fine, so I can get AutoCAD to execute my custom commands.

 

What I'm struggling with is trying to make a list of either entity types (Type class) or class types (RXClass class). I would like to pass a list of such types to another method. Although I can declare a List<Type> or List<RXClass> with no problems, I can't add the types I want to it.

 

In ObjectARX I would use MyEntityType::desc() to get an AcRxClass pointer that I could use. I've tried Type.GetType("Autodesk.AutoCAD.DatabaseServices.Entity", true) or just Type.GetType("Entity", true) but both throw the exception "Could not load bla bla bla from Assembly XXX". What bothers me is that XXX is *my* DLL's name... it seems to think they are types defined by me. I'm trying to get the type or class of AutoCAD's own entities (Line, Circle, or the more generic Entity in this case).

 

I don't see why I should have to have / create an actual object of the desired type just to get hold of that type - MyEntityType::desc() doesn't require an actual object of that type, so I was hoping for a C# equivalent.

 

Can someone point me in the right direction, please?

 

 

How about ? ?

RXClass.GetClass(typeof(Entity));

Valued Mentor
jeff
Posts: 337
Registered: ‎05-12-2009
Message 2 of 3 (204 Views)

Re: C# Equivalent of MyEntityType::desc()?

03-28-2012 06:18 AM in reply to: jason.teagle

How about ? ?

RXClass.GetClass(typeof(Entity));

You can also find your answers @ TheSwamp
Valued Contributor
jason.teagle
Posts: 70
Registered: ‎06-22-2010
Message 3 of 3 (200 Views)

Re: C# Equivalent of MyEntityType::desc()?

03-28-2012 06:24 AM in reply to: jeff

Ahhhhhh... brilliant! Thank you so much. That was driving me bonkers! I didn't know about typeof() (I've not done much C#... obviously)... you can bet I'll remember that one in the future.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!