Hi:
I am programmitically trying to add a document, perform some operations(insert blocks, titles), save and close the document. This is done in a loop to work with a set of documents. AutoCAD crashes on me giving a fatal error exception.
To test a simpler case, I just created a loop and then created, opened, saved and closed the doc in the loop. What I observed is that, even though I am saving and closing the document, the document actually does not close immediately. The close occurs at the end of the loop. Does anyone have any suggestions to correct this. I would like close a doc completely before the next one opens.
For xCounter = 0 To 10
_GlobalShare.AcadDoc = Autodesk.AutoCAD.ApplicationServices.Application _
.DocumentManager.Add(rtbDwgTemplate.Text)
dwgName = _DwgDirectory & "\" & "Saumitra_" & xCounter & ".dwg"
_GlobalShare.AcadDoc.Database.SaveAs (dwgName, DwgVersion.Current)
_GlobalShare.AcadDoc.CloseAndDiscard()
_GlobalShare.AcadDoc.Dispose()
_GlobalShare.AcadDoc = Nothing
Next
Thanks
Saumitra