Skip to content

Commit a0ef73c

Browse files
authored
Add info section to generators (#65)
* Added info section for bin generator * Added info section for baseplate generator
1 parent eb2f36f commit a0ef73c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

commands/commandCreateBaseplate/entry.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
BASEPLATE_WIDTH_INPUT = 'plate_width'
6161
BASEPLATE_LENGTH_INPUT = 'plate_length'
6262
BASEPLATE_TYPE_DROPDOWN = 'plate_type_dropdown'
63+
INFO_GROUP_ID = 'info_group'
6364

6465
BASEPLATE_TYPE_LIGHT = 'Light'
6566
BASEPLATE_TYPE_FULL = 'Full'
@@ -84,10 +85,14 @@
8485

8586
SHOW_PREVIEW_INPUT = 'show_preview'
8687

88+
INFO_TEXT = ("<b>Help:</b> Info for inputs can be found "
89+
"<a href=\"https://github.com/Le0Michine/FusionGridfinityGenerator/wiki/Baseplate-generator-options\">"
90+
"Here on our GitHub</a>.")
91+
8792
INPUTS_VALID = True
8893

8994
def getErrorMessage():
90-
stackTrace = traceback.format_exc();
95+
stackTrace = traceback.format_exc()
9196
return f"An unknonwn error occurred, please validate your inputs and try again:\n{stackTrace}"
9297

9398
def showErrorInMessageBox():
@@ -156,6 +161,9 @@ def command_created(args: adsk.core.CommandCreatedEventArgs):
156161
# https://help.autodesk.com/view/fusion360/ENU/?contextId=CommandInputs
157162
inputs = args.command.commandInputs
158163

164+
infoGroup = inputs.addGroupCommandInput(INFO_GROUP_ID, 'Info')
165+
infoGroup.children.addTextBoxCommandInput("info_text", "Info", INFO_TEXT, 3, True)
166+
159167
# Create a value input field and set the default using 1 unit of the default length unit.
160168
defaultLengthUnits = app.activeProduct.unitsManager.defaultLengthUnits
161169
basicSizesGroup = inputs.addGroupCommandInput(BASIC_SIZES_GROUP, 'Basic size')

commands/commandCreateBin/entry.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +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'
6465

6566
BIN_BASE_WIDTH_UNIT_INPUT_ID = 'base_width_unit'
6667
BIN_BASE_LENGTH_UNIT_INPUT_ID = 'base_length_unit'
@@ -112,6 +113,10 @@
112113
SHOW_PREVIEW_INPUT = 'show_preview'
113114
SHOW_PREVIEW_MANUAL_INPUT = 'show_preview_manual'
114115

116+
INFO_TEXT = ("<b>Help:</b> Info for inputs can be found "
117+
"<a href=\"https://github.com/Le0Michine/FusionGridfinityGenerator/wiki/Bin-generator-options\">"
118+
"Here on our GitHub</a>.")
119+
115120
def defaultUiState():
116121
return InputState(
117122
groups={},
@@ -153,7 +158,7 @@ def defaultUiState():
153158
# json.dumps(asdict(uiState))
154159

155160
def getErrorMessage():
156-
stackTrace = traceback.format_exc();
161+
stackTrace = traceback.format_exc()
157162
return f"An unknonwn error occurred, please validate your inputs and try again:\n{stackTrace}"
158163

159164
def showErrorInMessageBox():
@@ -408,6 +413,9 @@ def command_created(args: adsk.core.CommandCreatedEventArgs):
408413
# https://help.autodesk.com/view/fusion360/ENU/?contextId=CommandInputs
409414
inputs = args.command.commandInputs
410415

416+
infoGroup = inputs.addGroupCommandInput(INFO_GROUP_ID, 'Info')
417+
infoGroup.children.addTextBoxCommandInput("info_text", "Info", INFO_TEXT, 3, True)
418+
411419
# Create a value input field and set the default using 1 unit of the default length unit.
412420
defaultLengthUnits = app.activeProduct.unitsManager.defaultLengthUnits
413421
basicSizesGroup = inputs.addGroupCommandInput(BIN_BASIC_SIZES_GROUP, 'Basic sizes')

0 commit comments

Comments
 (0)