Hey guys,
If you could look at my stackoverflow.com question and see if you could help out, it would be much appreciated. Essentailly, I'm trying to launch AutoCAD from a C# library, but it is giving me an error message and not launching. Like I said, if you have experience and know what could help out, just let me know here or on my stackoverflow.com question.
Regards,
Archer
Try this:
using System.IO;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
[CommandMethod("OpenDrawing", CommandFlags.Session)]
public static void OpenDrawing()
{
string strFileName = "C:\\campus.dwg";
DocumentCollection acDocMgr = Application.DocumentManager;
if (File.Exists(strFileName))
{
acDocMgr.Open(strFileName, false);
}
else
{
acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " + strFileName +
" does not exist.");
}
}
From:
AutoCAD .NET Developer's Guide
cad-pe, I appreciate the help, but I think this is supposed to be invoked in-process as an AutoCAD command after NETLOADing the .dll, no? I'm looking for a way to open AutoCAD from a C# program and then invoke commands on it.