52
52
PLATE_FEATURES_GROUP = 'plate_features'
53
53
MAGNET_SOCKET_GROUP = 'magnet_cutout_group'
54
54
SCREW_HOLE_GROUP = 'screw_hole_group'
55
+ SIDE_PADDING_GROUP = 'side_padding_group'
55
56
ADVANCED_PLATE_SIZE_GROUP = 'advanced_plate_size_group'
56
57
INPUT_CHANGES_GROUP = 'input_changes_group'
57
58
PREVIEW_GROUP = 'preview_group'
75
76
BASEPLATE_SCREW_DIAMETER_INPUT = 'screw_diameter'
76
77
BASEPLATE_SCREW_HEIGHT_INPUT = 'screw_head_diameter'
77
78
79
+ BASEPLATE_WITH_SIDE_PADDING_INPUT = 'with_side_padding'
80
+ BASEPLATE_SIDE_PADDING_LEFT_INPUT = 'side_padding_left'
81
+ BASEPLATE_SIDE_PADDING_TOP_INPUT = 'side_padding_top'
82
+ BASEPLATE_SIDE_PADDING_RIGHT_INPUT = 'side_padding_right'
83
+ BASEPLATE_SIDE_PADDING_BOTTOM_INPUT = 'side_padding_bottom'
84
+
78
85
BASEPLATE_EXTRA_THICKNESS_INPUT = 'extra_bottom_thickness'
79
86
BASEPLATE_BIN_Z_CLEARANCE_INPUT = 'bin_z_clearance'
80
87
BASEPLATE_HAS_CONNECTION_HOLE_INPUT = 'has_connection_hole'
@@ -237,6 +244,36 @@ def command_created(args: adsk.core.CommandCreatedEventArgs):
237
244
screwHeadSizeInput .tooltip = "Must be greater than screw diameter"
238
245
uiState .registerCommandInput (screwHeadSizeInput )
239
246
247
+ sidePaddingGroup = plateFeaturesGroup .children .addGroupCommandInput (SIDE_PADDING_GROUP , 'Side padding' )
248
+ sidePaddingGroup .isExpanded = uiState .getState (SIDE_PADDING_GROUP )
249
+ uiState .registerCommandInput (sidePaddingGroup )
250
+ generateSidePaddingInput = sidePaddingGroup .children .addBoolValueInput (BASEPLATE_WITH_SIDE_PADDING_INPUT , 'Add side padding' , True , '' , uiState .getState (BASEPLATE_WITH_SIDE_PADDING_INPUT ))
251
+ uiState .registerCommandInput (generateSidePaddingInput )
252
+
253
+ sidePaddingLeftInput = sidePaddingGroup .children .addValueInput (BASEPLATE_SIDE_PADDING_LEFT_INPUT , 'Padding left' , defaultLengthUnits , adsk .core .ValueInput .createByReal (uiState .getState (BASEPLATE_SIDE_PADDING_LEFT_INPUT )))
254
+ sidePaddingLeftInput .minimumValue = 0
255
+ sidePaddingLeftInput .isMinimumInclusive = True
256
+ sidePaddingLeftInput .tooltip = "Must be equal or greater than 0"
257
+ uiState .registerCommandInput (sidePaddingLeftInput )
258
+
259
+ sidePaddingTopInput = sidePaddingGroup .children .addValueInput (BASEPLATE_SIDE_PADDING_TOP_INPUT , 'Padding top' , defaultLengthUnits , adsk .core .ValueInput .createByReal (uiState .getState (BASEPLATE_SIDE_PADDING_TOP_INPUT )))
260
+ sidePaddingTopInput .minimumValue = 0
261
+ sidePaddingTopInput .isMinimumInclusive = True
262
+ sidePaddingTopInput .tooltip = "Must be equal or greater than 0"
263
+ uiState .registerCommandInput (sidePaddingTopInput )
264
+
265
+ sidePaddingRightInput = sidePaddingGroup .children .addValueInput (BASEPLATE_SIDE_PADDING_RIGHT_INPUT , 'Padding right' , defaultLengthUnits , adsk .core .ValueInput .createByReal (uiState .getState (BASEPLATE_SIDE_PADDING_RIGHT_INPUT )))
266
+ sidePaddingRightInput .minimumValue = 0
267
+ sidePaddingRightInput .isMinimumInclusive = True
268
+ sidePaddingRightInput .tooltip = "Must be equal or greater than 0"
269
+ uiState .registerCommandInput (sidePaddingRightInput )
270
+
271
+ sidePaddingBottomInput = sidePaddingGroup .children .addValueInput (BASEPLATE_SIDE_PADDING_BOTTOM_INPUT , 'Padding bottom' , defaultLengthUnits , adsk .core .ValueInput .createByReal (uiState .getState (BASEPLATE_SIDE_PADDING_BOTTOM_INPUT )))
272
+ sidePaddingBottomInput .minimumValue = 0
273
+ sidePaddingBottomInput .isMinimumInclusive = True
274
+ sidePaddingBottomInput .tooltip = "Must be equal or greater than 0"
275
+ uiState .registerCommandInput (sidePaddingBottomInput )
276
+
240
277
advancedPlateSizeGroup = plateFeaturesGroup .children .addGroupCommandInput (ADVANCED_PLATE_SIZE_GROUP , 'Advanced plate size options' )
241
278
advancedPlateSizeGroup .isExpanded = uiState .getState (ADVANCED_PLATE_SIZE_GROUP )
242
279
uiState .registerCommandInput (advancedPlateSizeGroup )
@@ -399,6 +436,11 @@ def generateBaseplate(args: adsk.core.CommandEventArgs):
399
436
baseplateGeneratorInput .hasScrewHoles = inputsState .hasScrewHoles
400
437
baseplateGeneratorInput .screwHolesDiameter = inputsState .screwHoleSize
401
438
baseplateGeneratorInput .screwHeadCutoutDiameter = inputsState .screwHeadSize
439
+ baseplateGeneratorInput .hasPadding = inputsState .hasPadding
440
+ baseplateGeneratorInput .paddingLeft = inputsState .paddingLeft
441
+ baseplateGeneratorInput .paddingTop = inputsState .paddingTop
442
+ baseplateGeneratorInput .paddingRight = inputsState .paddingRight
443
+ baseplateGeneratorInput .paddingBottom = inputsState .paddingBottom
402
444
baseplateGeneratorInput .bottomExtensionHeight = inputsState .extraBottomThickness
403
445
baseplateGeneratorInput .binZClearance = inputsState .verticalClearance
404
446
baseplateGeneratorInput .hasConnectionHoles = inputsState .hasConnectionHoles
@@ -410,7 +452,7 @@ def generateBaseplate(args: adsk.core.CommandEventArgs):
410
452
411
453
if des .designType == 1 :
412
454
# group features in timeline
413
- plateGroup = des .timeline .timelineGroups .add (newCmpOcc .timelineObject .index , newCmpOcc .timelineObject .index + gridfinityBaseplateComponent .features .count + gridfinityBaseplateComponent .constructionAxes .count + gridfinityBaseplateComponent .sketches .count )
455
+ plateGroup = des .timeline .timelineGroups .add (newCmpOcc .timelineObject .index , newCmpOcc .timelineObject .index + gridfinityBaseplateComponent .features .count + gridfinityBaseplateComponent .constructionAxes .count + gridfinityBaseplateComponent .constructionPlanes . count + gridfinityBaseplateComponent . sketches .count )
414
456
plateGroup .name = baseplateName
415
457
except UnsupportedDesignTypeException as err :
416
458
args .executeFailed = True
@@ -432,6 +474,7 @@ def initUiState():
432
474
uiState .initValue (SCREW_HOLE_GROUP , True , adsk .core .GroupCommandInput .classType ())
433
475
uiState .initValue (ADVANCED_PLATE_SIZE_GROUP , True , adsk .core .GroupCommandInput .classType ())
434
476
uiState .initValue (INPUT_CHANGES_GROUP , True , adsk .core .GroupCommandInput .classType ())
477
+ uiState .initValue (SIDE_PADDING_GROUP , True , adsk .core .GroupCommandInput .classType ())
435
478
uiState .initValue (PREVIEW_GROUP , True , adsk .core .GroupCommandInput .classType ())
436
479
437
480
uiState .initValue (BASEPLATE_BASE_UNIT_WIDTH_INPUT , DIMENSION_DEFAULT_WIDTH_UNIT , adsk .core .ValueCommandInput .classType ())
@@ -447,6 +490,12 @@ def initUiState():
447
490
uiState .initValue (BASEPLATE_MAGNET_HEIGHT_INPUT , const .DIMENSION_MAGNET_CUTOUT_DEPTH , adsk .core .ValueCommandInput .classType ())
448
491
uiState .initValue (BASEPLATE_WITH_SCREWS_INPUT , True , adsk .core .BoolValueCommandInput .classType ())
449
492
493
+ uiState .initValue (BASEPLATE_WITH_SIDE_PADDING_INPUT , False , adsk .core .BoolValueCommandInput .classType ())
494
+ uiState .initValue (BASEPLATE_SIDE_PADDING_LEFT_INPUT , 0 , adsk .core .BoolValueCommandInput .classType ())
495
+ uiState .initValue (BASEPLATE_SIDE_PADDING_TOP_INPUT , 0 , adsk .core .BoolValueCommandInput .classType ())
496
+ uiState .initValue (BASEPLATE_SIDE_PADDING_RIGHT_INPUT , 0 , adsk .core .BoolValueCommandInput .classType ())
497
+ uiState .initValue (BASEPLATE_SIDE_PADDING_BOTTOM_INPUT , 0 , adsk .core .BoolValueCommandInput .classType ())
498
+
450
499
uiState .initValue (BASEPLATE_SCREW_DIAMETER_INPUT , const .DIMENSION_PLATE_SCREW_HOLE_DIAMETER , adsk .core .ValueCommandInput .classType ())
451
500
uiState .initValue (BASEPLATE_SCREW_HEIGHT_INPUT , const .DIMENSION_SCREW_HEAD_CUTOUT_DIAMETER , adsk .core .ValueCommandInput .classType ())
452
501
uiState .initValue (BASEPLATE_EXTRA_THICKNESS_INPUT , const .BASEPLATE_EXTRA_HEIGHT , adsk .core .ValueCommandInput .classType ())
@@ -493,6 +542,11 @@ def getInputsState():
493
542
uiState .getState (BASEPLATE_WITH_SCREWS_INPUT ),
494
543
uiState .getState (BASEPLATE_SCREW_DIAMETER_INPUT ),
495
544
uiState .getState (BASEPLATE_SCREW_HEIGHT_INPUT ),
545
+ uiState .getState (BASEPLATE_WITH_SIDE_PADDING_INPUT ),
546
+ uiState .getState (BASEPLATE_SIDE_PADDING_LEFT_INPUT ),
547
+ uiState .getState (BASEPLATE_SIDE_PADDING_TOP_INPUT ),
548
+ uiState .getState (BASEPLATE_SIDE_PADDING_RIGHT_INPUT ),
549
+ uiState .getState (BASEPLATE_SIDE_PADDING_BOTTOM_INPUT ),
496
550
uiState .getState (BASEPLATE_EXTRA_THICKNESS_INPUT ),
497
551
uiState .getState (BASEPLATE_BIN_Z_CLEARANCE_INPUT ),
498
552
uiState .getState (BASEPLATE_HAS_CONNECTION_HOLE_INPUT ),
0 commit comments