Search the Community
Showing results for tags 'discard'.
-
.Net Document.CloseAndDiscard() throws error AutoCAD Map 3D 2014
Geomap_Chris posted a topic in .NET, ObjectARX & VBA
This was working in Map 3D 2013... Basically, what I want to do is: open a dxf file copy it's database to a new dwg file close the dxf I modified the code a little bit to try and make it work with Map 2014, but without success. Here is my code now: // Open dxf DocumentDocument doc = AcadUtil.DocumentManager.Open(dxfFileName, false); // Lock Document so nothing interferes using (DocumentLock docLock = doc.LockDocument()) { [indent]// Save drawing as DWG file using (Transaction tr = doc.Database.TransactionManager.StartTransaction()) { [/indent] [indent][indent]doc.Database.SaveAs(fileName + ".dwg", DwgVersion.Newest); tr.Commit(); [/indent] } [/indent]} // Set document active so we can close it if (Application.DocumentManager.MdiActiveDocument != doc) { [indent]Application.DocumentManager.MdiActiveDocument = doc; [/indent] } // Dispose db doc.Database.Dispose(); // Close document doc.CloseAndDiscard(); Code throws error on doc.CloseAndDiscard(); FatalExecutionEngineError was detected... I have tryed multiple different things, and now I don't know what to do to make this work. I read about system variable FIBERWORLD... It is set to 1. What am I doing wrong?? Thanks for your help.