Unable to get running Instance of AutoCAD using API

Unable to get running Instance of AutoCAD using API

Anonymous
Not applicable
578 Views
0 Replies
Message 1 of 1

Unable to get running Instance of AutoCAD using API

Anonymous
Not applicable

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;
}
}

0 Likes
579 Views
0 Replies
Replies (0)