fix: wait for AutoCAD command-queue readiness barrier
This commit is contained in:
@@ -204,7 +204,7 @@ internal sealed class FirstLimitedApplyAutomationCoordinator
|
||||
{
|
||||
fixtureDocumentActivated = true;
|
||||
transitions.Add("FixtureDocumentActiveAfterOpen");
|
||||
TryActivateProjectAndVerifyContext();
|
||||
QueueReadinessBarrier();
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex) { FailFromCallback("Start", ex, "AUTOMATION_START_FAILED"); }
|
||||
@@ -270,11 +270,23 @@ internal sealed class FirstLimitedApplyAutomationCoordinator
|
||||
transitions.Add("CommandQueued:" + command);
|
||||
document.SendStringToExecute(command + " ", true, false, false);
|
||||
}
|
||||
private void QueueReadinessBarrier()
|
||||
{
|
||||
if (IsTerminal || document is null) return;
|
||||
transitions.Add("ReadinessBarrierQueued");
|
||||
document.SendStringToExecute("PHP_REC_AUTOMATION_READY ", true, false, false);
|
||||
}
|
||||
private void OnCommandEnded(object sender, CommandEventArgs e)
|
||||
{
|
||||
RunCallback("CommandEnded", () =>
|
||||
{
|
||||
var name = e.GlobalCommandName?.Trim().TrimStart('.', '_').ToUpperInvariant();
|
||||
if (name == "PHP_REC_AUTOMATION_READY")
|
||||
{
|
||||
transitions.Add("ReadinessBarrierCompleted");
|
||||
TryActivateProjectAndVerifyContext();
|
||||
return;
|
||||
}
|
||||
if (name is not ("PXP-OA" or "UNDO" or "U")) return;
|
||||
completed.Add(name);
|
||||
transitions.Add("CommandCompleted:" + name);
|
||||
|
||||
Reference in New Issue
Block a user