VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Custom Objects - Access Type & Properties From .NET?

2 REPLIES 2
Reply
Message 1 of 3
jason.teagle
578 Views, 2 Replies

Custom Objects - Access Type & Properties From .NET?

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?

 

2 REPLIES 2
Message 2 of 3

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
Message 3 of 3

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.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

ā€Boost