Hello
I have a serious problem with saving drawings that are modified using "sendstringtoexecute".
When my code only does the "sendstringtoexecute" commands, everything is fine, and AutoCad's manual closure of open drawings works.
'------------------------------------------
Dim p As Document
p = oApp.DocumentManager.Open("C:\Users\konta\Documents\dd.dwg", False)
p.SendStringToExecute("_-overkill" & vbCr & "_all" & vbCr & vbCr & vbCr, True, False, False)
p.SendStringToExecute("_Point" & vbCr & "1,1,0" & vbCr, True, False, False)
p.SendStringToExecute("_qsave" & vbCr, True, False, False)
'-----------------------------------------------------------
However, if he tries to add any form of closing the drawing to the source code, the drawings are closed but remain unchanged, which I made a few lines above, even if one of the "sendstringtoexecute" commands was "qsave". To close drawings, I tried to use:
1.
p.CloseAndDiscard
2.
Dim drawAcad As AcadDocument
drawAcad = p.GetAcadDocument
drawAcad.Close()
PS.
To avoid "COM Exception", or "Drawing is Busy" when closing drawings I have set comandsFlagon Sesion. As below
<CommandMethod("BMCzyszczenie", CommandFlags.Session)>
What can I do to save in drawings changes made with "sendstringto execute"
Thanks you in advance
Michal Wojcicki
Solved! Go to Solution.
Solved by Michal_W. Go to Solution.
Solved by _gile. Go to Solution.
SendStringToExcecute runs asynchronously, i.e. after all other instructions.
You can try to also close the document with SendStringToExecute:
p.SendStringToExecute("_close" & vbCr, True, False, False)
But if your code only scripts AutoCAD commands, it would be simpler to make a script and call it in a batch process with SciptPro 2.
Thank you very much for the reply.
All clear.🙂
In my case it turned out to be more functional using the command "sendcommand"
Can't find what you're looking for? Ask the community or share your knowledge.