|
7 | 7 | from ...lib import configUtils |
8 | 8 | from ...lib import fusion360utils as futil |
9 | 9 | from ... import config |
| 10 | +from ...lib.gridfinityUtils import combineUtils |
10 | 11 | from ...lib.gridfinityUtils import geometryUtils |
11 | 12 | from ...lib.gridfinityUtils import faceUtils |
12 | 13 | from ...lib.gridfinityUtils import shellUtils |
| 14 | +from ...lib.gridfinityUtils import commonUtils |
13 | 15 | from ...lib.gridfinityUtils import const |
14 | 16 | from ...lib.gridfinityUtils.baseGenerator import createGridfinityBase |
15 | 17 | from ...lib.gridfinityUtils.baseGeneratorInput import BaseGeneratorInput |
16 | 18 | from ...lib.gridfinityUtils.binBodyGenerator import createGridfinityBinBody, uniformCompartments |
17 | 19 | from ...lib.gridfinityUtils.binBodyGeneratorInput import BinBodyGeneratorInput, BinBodyCompartmentDefinition |
| 20 | +from ...lib.gridfinityUtils.binBodyTabGeneratorInput import BinBodyTabGeneratorInput |
| 21 | +from ...lib.gridfinityUtils.binBodyTabGenerator import createGridfinityBinBodyTab |
18 | 22 | from .inputState import InputState, CompartmentTableRow |
19 | 23 | from .staticInputCache import StaticInputCache |
20 | 24 |
|
@@ -966,6 +970,30 @@ def generateBin(args: adsk.core.CommandEventArgs): |
966 | 970 | binBody = gridfinityBinComponent.bRepBodies.item(0) |
967 | 971 | else: |
968 | 972 | shellUtils.simpleShell([topFace], binBodyInput.wallThickness, gridfinityBinComponent) |
| 973 | + |
| 974 | + if hasTabInput.value: |
| 975 | + compartmentTabInput = BinBodyTabGeneratorInput() |
| 976 | + tabOriginPoint = adsk.core.Point3D.create( |
| 977 | + binBodyInput.wallThickness + max(0, min(binBodyInput.tabPosition, binBodyInput.binWidth - binBodyInput.tabLength)) * binBodyInput.baseWidth, |
| 978 | + const.BIN_LIP_WALL_THICKNESS if binBodyInput.hasLip and binBodyInput.hasScoop else binBodyInput.wallThickness + binBodyInput.binLength * binBodyInput.baseLength - binBodyInput.wallThickness - binBodyInput.xyTolerance * 2, |
| 979 | + (binBodyInput.binHeight - 1) * binBodyInput.heightUnit + max(0, binBodyInput.heightUnit - const.BIN_BASE_HEIGHT), |
| 980 | + ) |
| 981 | + compartmentTabInput.origin = tabOriginPoint |
| 982 | + compartmentTabInput.length = max(0, min(binBodyInput.tabLength, binBodyInput.binWidth)) * binBodyInput.baseWidth - binBodyInput.wallThickness * 2 - binBodyInput.xyTolerance * 2 |
| 983 | + compartmentTabInput.width = binBodyInput.tabWidth |
| 984 | + compartmentTabInput.overhangAngle = binBodyInput.tabOverhangAngle |
| 985 | + compartmentTabInput.topClearance = const.BIN_TAB_TOP_CLEARANCE |
| 986 | + tabBody = createGridfinityBinBodyTab(compartmentTabInput, gridfinityBinComponent) |
| 987 | + combineInput = combineFeatures.createInput(tabBody, commonUtils.objectCollectionFromList([binBody])) |
| 988 | + combineInput.operation = adsk.fusion.FeatureOperations.CutFeatureOperation |
| 989 | + combineInput.isKeepToolBodies = True |
| 990 | + combineFeature = combineFeatures.add(combineInput) |
| 991 | + tabBodies = [body for body in combineFeature.bodies if body.faces != binBody.faces] |
| 992 | + tabMainBody = max([body for body in tabBodies], key=lambda x: x.edges.count) |
| 993 | + bodiesToRemove = [body for body in tabBodies if body is not tabMainBody] |
| 994 | + for body in bodiesToRemove: |
| 995 | + gridfinityBinComponent.features.removeFeatures.add(body) |
| 996 | + combineUtils.joinBodies(binBody, commonUtils.objectCollectionFromList([tabMainBody]), gridfinityBinComponent) |
969 | 997 |
|
970 | 998 | # group features in timeline |
971 | 999 | binGroup = des.timeline.timelineGroups.add(newCmpOcc.timelineObject.index, newCmpOcc.timelineObject.index + gridfinityBinComponent.features.count + gridfinityBinComponent.constructionPlanes.count + gridfinityBinComponent.sketches.count) |
|
0 commit comments