Call a .NET module from out-of-process ActiveX VBA?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello;
I have been working on a program on and off for about a year using ActiveX to access a dwg file but I keep bumping into the limitations of AutoCAD's VBA api. Specifically, there are entity properties exposed in .NET that are not exposed in the ActiveX API. For example, if you have a rotated dimension, you can not access the start points of the extension lines with ActiveX but you can with .NET.
The program I am working on must run in the process space of Revit but I need to access the dwg file in the process space of Autocad. As Kean Walmsley of Through The Interface once said:
"COM’s big advantage – and frankly the main reason I use it at all – is that it was designed to be used across processes. While .NET Remoting is possible with some applications, AutoCAD’s managed interface was not designed to work across the process boundary (just as ObjectARX was not)."
So the solution seems to be to create a .NET dll that is a COM server. A daunting task. As outlined 15 years ago here:
Interfacing-an-external-com-application-with-a-net-module-in-process-to-autocad-redux (Through The I...
So I was wondering if anyone knew of a sample source code or a framework that I could easily insert some functions to expose the properties I need? And only those properties - no need to recreate the whole car; just the parts that are missing.
Or perhaps someone might know of more recent info about how to create a COM server for Autocad?
I am using Autocad 2023 and Revit 2020 and up. Program should also run on some earlier and later versions of AutoCad.
Sincerely;
Michelle