Skip to content

Commit

Permalink
added parameter mode check
Browse files Browse the repository at this point in the history
  • Loading branch information
pludikar committed Jul 6, 2024
1 parent f88d9c7 commit dd58494
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion UserParameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

_app = adsk.core.Application.get()
_design: adsk.fusion.Design = cast(adsk.fusion.Design, _app.activeProduct)
_ui = _app.userInterface

DB_TOOL_DIA = "dbToolDia"
DB_OFFSET = "dbOffset"
Expand All @@ -15,7 +16,22 @@
DB_RADIUS = "dbRadius"
COMMENT = "Do NOT change formula"

userParams: adsk.fusion.UserParameters = _design.userParameters

try:
userParams: adsk.fusion.UserParameters = _design.userParameters
except RuntimeError:
if _design.designType != adsk.fusion.DesignTypes.ParametricDesignType:
returnValue = _ui.messageBox(
"DogBone only works in Parametric Mode \n Do you want to change modes?",
"Change to Parametric mode",
adsk.core.MessageBoxButtonTypes.YesNoButtonType,
adsk.core.MessageBoxIconTypes.WarningIconType,
)
if returnValue != adsk.core.DialogResults.DialogYes:
raise RuntimeError("DogBone only works in Parametric Mode")
_design.designType = adsk.fusion.DesignTypes.ParametricDesignType


default_length_units = _design.unitsManager.defaultLengthUnits


Expand Down

0 comments on commit dd58494

Please sign in to comment.