Community
Hello,
We followed the procedure that you have mentioned in the ADN knowledge base article id TS58585 (How to close AutoCAD drawing immediately after opening).
It works fine in AutoCAD 2010, 2011.
But, it crashes AutoCAD in AutoCAD 2012, 2013.
Please find the attached arx project to reproduce this case.
Thanks.
Hi,
Try below steps.
from On_kLoadDwgMsg use "executeInApplicationContext" and provide a callback function
acDocManager->executeInApplicationContext(closeDoc,curDoc());
Then in the callback function start your command. Make sure your command is in session/application context.
void closeDoc(void *pDoc) { AcApDocument *pADoc = (AcApDocument*)pDoc; acDocManager->sendStringToExecute(pADoc, L"_closeMe "); }
in the custom command, close the document.
static void adsMyGroupcloseMe () { acDocManager->closeDocument(curDoc()); }