From 697463f61e94c540f3081f19677a6a9a7ce6671f Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 13 Feb 2026 22:32:12 -0500 Subject: [PATCH] feat: disable SolidWorks user input during export Sets CommandInProgress to block user interaction with SolidWorks while the DXF export is running, preventing accidental interference. Co-Authored-By: Claude Opus 4.6 --- ExportDXF/Forms/MainForm.cs | 3 +++ ExportDXF/Services/SolidWorksService.cs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) 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.