Skip to content

Commit 6dca441

Browse files
committed
fix: register info group to ui state to preserve its state
1 parent a0ef73c commit 6dca441

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

commands/commandCreateBaseplate/entry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
local_handlers = []
4646

4747
# Input groups
48+
INFO_GROUP = 'info_group'
4849
BASIC_SIZES_GROUP = 'basic_sizes'
4950
XY_DIMENSIONS_GROUP = 'xy_dimensions'
5051
PLATE_FEATURES_GROUP = 'plate_features'
@@ -60,7 +61,6 @@
6061
BASEPLATE_WIDTH_INPUT = 'plate_width'
6162
BASEPLATE_LENGTH_INPUT = 'plate_length'
6263
BASEPLATE_TYPE_DROPDOWN = 'plate_type_dropdown'
63-
INFO_GROUP_ID = 'info_group'
6464

6565
BASEPLATE_TYPE_LIGHT = 'Light'
6666
BASEPLATE_TYPE_FULL = 'Full'
@@ -160,12 +160,13 @@ def command_created(args: adsk.core.CommandCreatedEventArgs):
160160

161161
# https://help.autodesk.com/view/fusion360/ENU/?contextId=CommandInputs
162162
inputs = args.command.commandInputs
163+
# Create a value input field and set the default using 1 unit of the default length unit.
164+
defaultLengthUnits = app.activeProduct.unitsManager.defaultLengthUnits
163165

164-
infoGroup = inputs.addGroupCommandInput(INFO_GROUP_ID, 'Info')
166+
infoGroup = inputs.addGroupCommandInput(INFO_GROUP, 'Info')
165167
infoGroup.children.addTextBoxCommandInput("info_text", "Info", INFO_TEXT, 3, True)
168+
uiState.registerCommandInput(infoGroup)
166169

167-
# Create a value input field and set the default using 1 unit of the default length unit.
168-
defaultLengthUnits = app.activeProduct.unitsManager.defaultLengthUnits
169170
basicSizesGroup = inputs.addGroupCommandInput(BASIC_SIZES_GROUP, 'Basic size')
170171
basicSizesGroup.isExpanded = uiState.getState(BASIC_SIZES_GROUP)
171172
uiState.registerCommandInput(basicSizesGroup)
@@ -405,6 +406,7 @@ def generateBaseplate(args: adsk.core.CommandEventArgs):
405406

406407
def initUiState():
407408
global uiState
409+
uiState.initValue(INFO_GROUP, True, adsk.core.GroupCommandInput.classType())
408410
uiState.initValue(BASIC_SIZES_GROUP, True, adsk.core.GroupCommandInput.classType())
409411
uiState.initValue(XY_DIMENSIONS_GROUP, True, adsk.core.GroupCommandInput.classType())
410412
uiState.initValue(PLATE_FEATURES_GROUP, True, adsk.core.GroupCommandInput.classType())

commands/commandCreateBin/entry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
BIN_BASE_FEATURES_GROUP_ID = 'bin_base_features_group'
6262
USER_CHANGES_GROUP_ID = 'user_changes_group'
6363
PREVIEW_GROUP_ID = 'preview_group'
64-
INFO_GROUP_ID = 'info_group'
64+
INFO_GROUP = 'info_group'
6565

6666
BIN_BASE_WIDTH_UNIT_INPUT_ID = 'base_width_unit'
6767
BIN_BASE_LENGTH_UNIT_INPUT_ID = 'base_length_unit'
@@ -413,7 +413,7 @@ def command_created(args: adsk.core.CommandCreatedEventArgs):
413413
# https://help.autodesk.com/view/fusion360/ENU/?contextId=CommandInputs
414414
inputs = args.command.commandInputs
415415

416-
infoGroup = inputs.addGroupCommandInput(INFO_GROUP_ID, 'Info')
416+
infoGroup = inputs.addGroupCommandInput(INFO_GROUP, 'Info')
417417
infoGroup.children.addTextBoxCommandInput("info_text", "Info", INFO_TEXT, 3, True)
418418

419419
# Create a value input field and set the default using 1 unit of the default length unit.

0 commit comments

Comments
 (0)