I'm trying to convert by cide a lot of mechanical dwg by code.
Unfortunatly the method saveas (acDoc.Database.SaveAs) is not completly working with mechanical drawing (Mechanical 2010), so I'm trying to use SendStringToExecute command.
Unfortunatly SendStringToExecuteis not synchronous, so the instruction after SendStringToExecute (acDoc.CloseAndDiscard) is executed before the SendStringToExecute is completed.
How can I understand when the SendStringToExecute command is completed?
Hi,
>> How can I understand when the SendStringToExecute command is completed?
Split your code into two procedures
Sub A
...run any code
...define EventHandler for CommandEnded or reachedQuiescentState that addresses to be handled by Sub B
...SendCommand("_SAVE" & vbnewline)
End Sub A
Sub B
...do your close or whatever has to be done after savign
...
End Sub B
Good luck, - alfred -
Thanks for your answer Alfred, but I would like using SendStringToExecute not SendCommand and what do you mean with
...define EventHandler for CommandEnded or reachedQuiescentState that addresses to be handled by Sub B
I don't know CommandEnded
In vbNET I use AddHandler <object>, AddressOf saveDWG and I cannot find a object CommandEnded
Hi,
as long as you start a VB.NET-defined command you can't start any commands in it (as long as these command are not handled as transparent commands). So it's SendCommand or SendStringToExecute or any P/Invoke versions, it does not matter, the thing is "a command is running". A CIRCLE-command can't run inside a LINE-command
>> I don't know CommandEnded
>> In vbNET I use
Dim pAcadDoc As ApplicationServices.Document = ApplicationServices.Application.DocumentManager.MdiActiveDocument AddHandler pAcadDoc.CommandEnded, AddressOf ....
- alfred -