diff --git a/ExportDXF/Forms/MainForm.cs b/ExportDXF/Forms/MainForm.cs
index ba2ee81..c003f14 100644
--- a/ExportDXF/Forms/MainForm.cs
+++ b/ExportDXF/Forms/MainForm.cs
@@ -341,6 +341,8 @@ namespace ExportDXF.Forms
LogMessage($"Started at {DateTime.Now:t}");
LogMessage($"Exporting to: {_fileExportService.OutputFolder}");
+ _solidWorksService.SetCommandInProgress(true);
+
await Task.Run(() => _exportService.Export(exportContext), token);
LogMessage("Done.");
@@ -356,6 +358,7 @@ namespace ExportDXF.Forms
}
finally
{
+ _solidWorksService.SetCommandInProgress(false);
UpdateUIForExportComplete();
_cancellationTokenSource?.Dispose();
_cancellationTokenSource = null;
diff --git a/ExportDXF/Services/SolidWorksService.cs b/ExportDXF/Services/SolidWorksService.cs
index 6d736f4..734e8be 100644
--- a/ExportDXF/Services/SolidWorksService.cs
+++ b/ExportDXF/Services/SolidWorksService.cs
@@ -88,6 +88,13 @@ namespace ExportDXF.Services
/// True to enable user control, false to disable.
void EnableUserControl(bool enable);
+ ///
+ /// Sets whether a command is in progress. When true, user input to
+ /// SolidWorks is disabled and interactive dialogs are suppressed.
+ ///
+ /// True to block user input, false to re-enable.
+ void SetCommandInProgress(bool inProgress);
+
///
/// Gets the SolidWorks application instance.
///
@@ -188,6 +195,15 @@ namespace ExportDXF.Services
}
}
+ ///
+ public void SetCommandInProgress(bool inProgress)
+ {
+ if (_sldWorks != null)
+ {
+ _sldWorks.CommandInProgress = inProgress;
+ }
+ }
+
///
/// Gets the native SolidWorks application instance.
/// Use this when you need direct access to the SolidWorks API.