From 7238f7e4a21c9c401819ac547b45f58d5c5f6abc Mon Sep 17 00:00:00 2001 From: dangjinghao Date: Tue, 30 Jun 2026 18:07:10 +0800 Subject: [PATCH] Pop up a message box if the current sketch is fully constrained --- commands/showUnderconstrained/entry.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/commands/showUnderconstrained/entry.py b/commands/showUnderconstrained/entry.py index dbcaddf..a12ab44 100644 --- a/commands/showUnderconstrained/entry.py +++ b/commands/showUnderconstrained/entry.py @@ -1,4 +1,5 @@ import adsk.core +import adsk.fusion import os from ...lib import fusionAddInUtils as futil from ... import config @@ -74,5 +75,10 @@ def stop(): def command_created(args: adsk.core.CommandCreatedEventArgs): # General logging for debug. # futil.log(f"{CMD_NAME} Command Created Event") - - app.executeTextCommand("sketch.showunderconstrained") + sketch = adsk.fusion.Sketch.cast(app.activeEditObject) + if not sketch: + ui.messageBox("There is no sketch currently being edited.") + elif sketch.isFullyConstrained: + ui.messageBox("The current sketch is fully constrained.") + else: + app.executeTextCommand("sketch.showunderconstrained") \ No newline at end of file