AutoCAD/Code reopen current drawing
Mr. R, i've been using autocad for several years now. I also know the basic concept of programming in autolisp. However, I've been reading up on c# & recently purchased my book & copy of Visual Studio. Very intimidating I might add. I'm looking for a simple code in c# for autocad to reopen the current drawing (disregarding any changes to its dbase & not saving any data at all). I'm still not sure how to start the code but anything you can provide I can surely dissect and learn from. Thank you for your time.
First you need create the Project of type Class Library and take the below mentioned dlls as reference which are exist in AutoCAD installation folder or Object ARX SDK installed folder.
Before using the below code please go through the SDK Help documents which gives you more information.
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public static void OpenDrawing(string strFileName )
DocumentCollection acDocMgr = AcadApp.DocumentManager;
acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " + strFileName +
" does not exist.");
public void CloseDrawing()
Document oDoc = AcadApp.DocumentManager.MdiActiveDocument as Document;
The above code is not tested. I am not having the environment.
The remain things you can get from the documents available with the Object ARX SDK. I think this will provide you a start with AutoCAD with c#. Still you need any information...don't hesitate to post me a question.