Skip to content

Commit c4a3c78

Browse files
committed
Add option to only generate sketch
1 parent e194c92 commit c4a3c78

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

lib/panelUtils/panel_generate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ def addRefLine(panelLine: adsk.fusion.SketchLine, offset: float):
178178
slotCenterLine = sketchSlot(sketch, slotStartPoint, slotEndPoint, opts.slotDiameter)[0]
179179
constrainPointToPoint(sketch, slotCenterLine.startSketchPoint, referencePoint)
180180

181-
# return
181+
if opts.sketchOnly:
182+
return
182183

183184
# Extrusions
184185
if opts.supportType == "solid":

lib/panelUtils/panel_inputs.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, inputs: adsk.core.CommandInputs, options):
2121

2222
self.widthInHp = adsk.core.IntegerSpinnerCommandInput.cast(self.inputs.itemById("widthInHp"))
2323
self.panelHeight = adsk.core.ValueCommandInput.cast(self.inputs.itemById("panelHeight"))
24+
self.sketchOnly = adsk.core.BoolValueCommandInput.cast(self.inputs.itemById("sketchOnly"))
2425
self.supportSolidHeight = adsk.core.ValueCommandInput.cast(self.inputs.itemById("supportSolidHeight"))
2526
self.supportShellHeight = adsk.core.ValueCommandInput.cast(self.inputs.itemById("supportShellHeight"))
2627
self.supportShellWallThickness = adsk.core.ValueCommandInput.cast(self.inputs.itemById("supportShellWallThickness"))
@@ -31,15 +32,18 @@ def __init__(self, inputs: adsk.core.CommandInputs, options):
3132
self.updateUiState()
3233

3334
def updateUiState(self):
35+
sketchOnly = self.sketchOnly.value
3436
supportTypeName = self.supportType.selectedItem.name
3537
supportTypeId = self.options.getIdForSupportTypeName(supportTypeName)
36-
self.supportSolidHeight.isVisible = supportTypeId == "solid"
37-
self.supportShellHeight.isVisible = supportTypeId == "shell"
38+
self.panelHeight.isVisible = not sketchOnly
39+
self.supportSolidHeight.isVisible = supportTypeId == "solid" and not sketchOnly
40+
self.supportShellHeight.isVisible = supportTypeId == "shell" and not sketchOnly
3841
self.supportShellWallThickness.isVisible = supportTypeId == "shell"
3942

4043
def updateOptionsFromInputs(self):
4144
self.options.widthInHp = int(self.widthInHp.value)
4245
self.options.panelHeight = self.panelHeight.value
46+
self.options.sketchOnly = self.sketchOnly.value
4347
self.options.supportSolidHeight = self.supportSolidHeight.value
4448
self.options.supportShellHeight = self.supportShellHeight.value
4549
self.options.supportShellWallThickness = self.supportShellWallThickness.value
@@ -50,6 +54,7 @@ def updateOptionsFromInputs(self):
5054
def updateInputsFromOptions(self):
5155
self.widthInHp.value = self.options.widthInHp
5256
self.panelHeight.value = self.options.panelHeight
57+
self.sketchOnly.value = self.options.sketchOnly
5358
self.supportSolidHeight.value = self.options.supportSolidHeight
5459
self.supportShellHeight.value = self.options.supportShellHeight
5560
self.supportShellWallThickness.value = self.options.supportShellWallThickness
@@ -105,6 +110,8 @@ def initializeInputs(self):
105110
for name in self.options.anchorPointNames:
106111
anchorPointDropdown.listItems.add(name, name == self.options.anchorPointName)
107112

113+
self.inputs.addBoolValueInput("sketchOnly", "Sketch only", True, "", self.options.sketchOnly)
114+
108115
supportGroup = self.inputs.addGroupCommandInput("supportGroup", "Reinforcement")
109116
supportGroup.isExpanded = True
110117

lib/panelUtils/panel_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(self, persistFile: str):
5252
{
5353
"formatId": "3u_eurorack",
5454
"widthInHp": 6,
55+
"sketchOnly": False,
5556
"panelHeight": 0.2,
5657
"anchorPoint": "top-left",
5758
"supportType": "none",
@@ -62,6 +63,7 @@ def __init__(self, persistFile: str):
6263
)
6364
self.formatId: str
6465
self.widthInHp: int
66+
self.sketchOnly: bool
6567
self.panelHeight: float
6668
self.anchorPoint: str
6769
self.supportType: str

0 commit comments

Comments
 (0)