Skip to content

Commit

Permalink
Ensure parametric design while adding features.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianPommerening committed May 8, 2022
1 parent 4eb3a94 commit d9baedc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FingerJoints.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": {
"": "An add-in for making finger joints."
},
"version": "1.3.0",
"version": "1.4.0",
"runOnStartup": true,
"supportedOS": "windows|mac",
"editEnabled": true
Expand Down
8 changes: 8 additions & 0 deletions FingerJoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,21 @@ def doExecute(self):
def createCustomFeature(self, inputs, toolBody0, toolBody1):
app = adsk.core.Application.get()
activeComponent = app.activeProduct.activeComponent
design = activeComponent.parentDesign

# Temporarily switch to parametric design
previousDesignType = design.designType
design.designType = adsk.fusion.DesignTypes.ParametricDesignType

# We will later group all created features into a custom feature.
# For that reason, we have to remember the first and last feature that is part of this group.
tool0Feature = createBaseFeature(activeComponent, toolBody0, "tool0")
createCutFeature(activeComponent, inputs.body0, tool0Feature)
tool1Feature = createBaseFeature(activeComponent, toolBody1, "tool1")
createCutFeature(activeComponent, inputs.body1, tool1Feature)

design.designType = previousDesignType

def onDestroy(self, args: adsk.core.CommandEventArgs):
super(CreateFingerJointCommand, self).onDestroy(args)
if args.terminationReason == adsk.core.CommandTerminationReason.CompletedTerminationReason:
Expand Down

0 comments on commit d9baedc

Please sign in to comment.