Visual Basic Customization

Visual Basic Customization

Reply
Valued Contributor
jason.teagle
Posts: 64
Registered: ‎06-22-2010
Message 1 of 3 (280 Views)

Custom Objects - Access Type & Properties From .NET?

280 Views, 2 Replies
04-29-2012 08:07 AM

As of AutoCAD 2010 (or later only?), if I have a custom object defined by a loaded DBX (so not a proxy), it is described as being of type _ComObject. I understand why, but I wonder, is it possible yet to be able to access its true type (e.g. MyCustomObjectType) and read / write its [custom] properties and / or call its custom methods from .NET? I suspect that even if the methods were available in the COM wrapper class (the same one used to produce the entries in the Property Inspector for the object) it still might not be possible. I found some old articles but they were no later than 2009 and only talked about Overrules (if that's the right term) - but I don't just want to override certain behaviour. I would like to be able to create and manipulate custom objects as if they were built-in objects - so the DBX defines what they are and what they do, and the .NET side actually does the work by setting properties or calling methods - just like it would for a standard object.

 

Possible? Dreaming?

 

Board Manager
StephenPreston
Posts: 377
Registered: ‎05-22-2006
Message 2 of 3 (248 Views)

Re: Custom Objects - Access Type & Properties From .NET?

05-08-2012 10:40 PM in reply to: jason.teagle

You can access a custom object from .NET if the creator of that object has provided a .NET wrapper for it.

You can access a custom object from COM if the creator of that object has provided a COM wrapper for it.

You can access a custom object from C++if the creator of that object has provided C++ headers and libs for it.

 

Many custom object developers do provide .NET wrappers, so its worth asking the developer of the custom objects you're using.

 

Also, if a custom object is derived from (say) a Line, then you can cast that object to be a Line class and access that level of methods and properties. But you can't access the methods/propoerties added in the derived class without the wrapper.

 

Cheers,

Stephen Preston
Autodesk Developer Network
Valued Contributor
jason.teagle
Posts: 64
Registered: ‎06-22-2010
Message 3 of 3 (245 Views)

Re: Custom Objects - Access Type & Properties From .NET?

05-08-2012 11:41 PM in reply to: StephenPreston

It will be us creating the custom object, so we have full control of what it exposes. Can you point me to any tutorials on how to create a .NET wrapper for a custom object, if possible, please? I'd like to explore this option.

 

Thanks.

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.