@@ -65,7 +65,7 @@ def createGridfinityBase(
6565 basePlateSketch : adsk .fusion .Sketch = sketches .add (baseConstructionPlane )
6666 rectangleOrigin = basePlateSketch .modelToSketchSpace (input .originPoint )
6767 createRectangle (actual_base_width , actual_base_length ,rectangleOrigin , basePlateSketch )
68-
68+
6969 # extrude top section
7070 topSectionExtrudeDepth = adsk .core .ValueInput .createByReal (const .BIN_BASE_TOP_SECTION_HEIGH )
7171 topSectionExtrudeInput = extrudeFeatures .createInput (basePlateSketch .profiles .item (0 ),
@@ -122,8 +122,11 @@ def createGridfinityBase(
122122 cutoutBodies = adsk .core .ObjectCollection .create ()
123123
124124 baseBottomPlane = baseBottomExtrude .endFaces .item (0 )
125- baseCenterPoint = adsk .core .Point3D .create (actual_base_width / 2 , actual_base_length / 2 , baseBottomPlane .boundingBox .minPoint .z )
126- baseHoleCenterPoint = adsk .core .Point3D .create (baseCenterPoint .x - const .DIMENSION_SCREW_HOLES_DISTANCE / 2 , baseCenterPoint .y - const .DIMENSION_SCREW_HOLES_DISTANCE / 2 , baseCenterPoint .z )
125+ baseHoleCenterPoint = adsk .core .Point3D .create (
126+ const .DIMENSION_SCREW_HOLES_OFFSET - input .xyTolerance ,
127+ const .DIMENSION_SCREW_HOLES_OFFSET - input .xyTolerance ,
128+ baseBottomPlane .boundingBox .minPoint .z
129+ )
127130 if input .hasScrewHoles :
128131 screwHoleBody = shapeUtils .simpleCylinder (
129132 baseBottomPlane ,
@@ -183,14 +186,16 @@ def createGridfinityBase(
183186 if cutoutBodies .count > 1 :
184187 joinFeature = combineUtils .joinBodies (cutoutBodies .item (0 ), commonUtils .objectCollectionFromList (list (cutoutBodies )[1 :]), targetComponent )
185188 cutoutBodies = commonUtils .objectCollectionFromList (joinFeature .bodies )
189+ patternSpacingX = input .baseWidth - const .DIMENSION_SCREW_HOLES_OFFSET * 2
190+ patternSpacingY = input .baseLength - const .DIMENSION_SCREW_HOLES_OFFSET * 2
186191 patternInput = rectangularPatternFeatures .createInput (cutoutBodies ,
187192 targetComponent .xConstructionAxis ,
188193 adsk .core .ValueInput .createByReal (2 ),
189- adsk .core .ValueInput .createByReal (const . DIMENSION_SCREW_HOLES_DISTANCE ),
194+ adsk .core .ValueInput .createByReal (patternSpacingX ),
190195 adsk .fusion .PatternDistanceType .SpacingPatternDistanceType )
191196 patternInput .directionTwoEntity = targetComponent .yConstructionAxis
192197 patternInput .quantityTwo = adsk .core .ValueInput .createByReal (2 )
193- patternInput .distanceTwo = adsk .core .ValueInput .createByReal (const . DIMENSION_SCREW_HOLES_DISTANCE )
198+ patternInput .distanceTwo = adsk .core .ValueInput .createByReal (patternSpacingY )
194199 patternFeature = rectangularPatternFeatures .add (patternInput )
195200 combineUtils .cutBody (baseBody , commonUtils .objectCollectionFromList (list (cutoutBodies ) + list (patternFeature .bodies )), targetComponent )
196201
0 commit comments