Message 1 of 1
Unable to get running Instance of AutoCAD using API

Not applicable
01-03-2021
10:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Guys!
I am unable to get the running instance of AutoCAD 2016 even if the software is running.
I have referenced to the required DLLs. The same code gives me the running instance on different machine.
I am using Microsoft Visual Studio Professional 2019.
Please see the code snippet
public AcadApplication GetApplication()
{
try
{
AcadApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application");
return AcadApp;
}
catch (Exception ex)
{
MessageBox.Show("Please launch AutoCAD & open a drawing file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
}