diff --git a/commands/commandCreateBaseplate/entry.py b/commands/commandCreateBaseplate/entry.py index f60919e..9174ba4 100644 --- a/commands/commandCreateBaseplate/entry.py +++ b/commands/commandCreateBaseplate/entry.py @@ -459,7 +459,7 @@ def generateBaseplate(args: adsk.core.CommandEventArgs): if des.designType == 1: # group features in timeline - plateGroup = des.timeline.timelineGroups.add(newCmpOcc.timelineObject.index, newCmpOcc.timelineObject.index + gridfinityBaseplateComponent.features.count + gridfinityBaseplateComponent.constructionAxes.count + gridfinityBaseplateComponent.constructionPlanes.count + gridfinityBaseplateComponent.sketches.count) + plateGroup = des.timeline.timelineGroups.add(newCmpOcc.timelineObject.index, newCmpOcc.timelineObject.index + gridfinityBaseplateComponent.features.count + gridfinityBaseplateComponent.constructionAxes.count + gridfinityBaseplateComponent.constructionPlanes.count + gridfinityBaseplateComponent.sketches.count + gridfinityBaseplateComponent.jointOrigins.count) plateGroup.name = baseplateName except UnsupportedDesignTypeException as err: args.executeFailed = True diff --git a/lib/gridfinityUtils/baseGenerator.py b/lib/gridfinityUtils/baseGenerator.py index 802649c..14ef34e 100644 --- a/lib/gridfinityUtils/baseGenerator.py +++ b/lib/gridfinityUtils/baseGenerator.py @@ -169,6 +169,12 @@ def createSingleGridfinityBaseBody( targetComponent ) + # create the initial joint origin that will be duplicated into every base plate cutout + jointGeometry = adsk.fusion.JointGeometry.createByPlanarFace(baseBottomExtrude.endFaces.item(0), None, adsk.fusion.JointKeyPointTypes.CenterKeyPoint) + jointInput = targetComponent.jointOrigins.createInput(jointGeometry) + jointInput.isFlipped = True + targetComponent.jointOrigins.add(jointInput) + if input.hasBottomChamfer: # chamfer bottom section chamferFeatures: adsk.fusion.ChamferFeatures = features.chamferFeatures diff --git a/lib/gridfinityUtils/baseplateGenerator.py b/lib/gridfinityUtils/baseplateGenerator.py index 5dd92fa..69aa65f 100644 --- a/lib/gridfinityUtils/baseplateGenerator.py +++ b/lib/gridfinityUtils/baseplateGenerator.py @@ -194,6 +194,18 @@ def createGridfinityBaseplate(input: BaseplateGeneratorInput, targetComponent: a patternInput.quantityTwo = adsk.core.ValueInput.createByReal(input.baseplateLength) patternInput.distanceTwo = adsk.core.ValueInput.createByReal(input.baseLength) rectangularPattern = rectangularPatternFeatures.add(patternInput) + + # replicate joint origins in the same pattern (unfortunately we can't use the rectangular pattern): + baseOrigin = targetComponent.jointOrigins.item(0) + for multX in range(input.baseplateWidth): + for multY in range(input.baseplateLength): + if multX != 0 or multY != 0: + jointInput = targetComponent.jointOrigins.createInput(baseOrigin.geometry) + jointInput.isFlipped = True + jointInput.offsetX = adsk.core.ValueInput.createByReal(multX * input.baseWidth) + jointInput.offsetY = adsk.core.ValueInput.createByReal(multY * input.baseLength) + targetComponent.jointOrigins.add(jointInput) + cuttingTools = cuttingTools + list(rectangularPattern.bodies) # create baseplate body