@@ -199,17 +199,27 @@ def createGridfinityBinBody(
199
199
)
200
200
201
201
compartmentTabInput = BinBodyTabGeneratorInput ()
202
- tabOriginPoint = adsk .core .Point3D .create (
203
- compartmentOriginPoint .x
204
- + max (0 , min (input .tabPosition , input .binWidth - input .tabLength ))
205
- * input .baseWidth ,
206
- compartmentOriginPoint .y + compartmentLength ,
207
- compartmentOriginPoint .z ,
208
- )
202
+ if input .tabLength >= 0 :
203
+ tabOriginPoint = adsk .core .Point3D .create (
204
+ compartmentOriginPoint .x
205
+ + max (0 , min (input .tabPosition , input .binWidth - input .tabLength ))
206
+ * input .baseWidth ,
207
+ compartmentOriginPoint .y + compartmentLength ,
208
+ compartmentOriginPoint .z ,
209
+ )
210
+ else :
211
+ tabOriginPoint = adsk .core .Point3D .create (
212
+ compartmentOriginPoint .x + compartmentWidth
213
+ - max (0 , min (input .tabPosition , input .binWidth - input .tabLength ))
214
+ * input .baseWidth ,
215
+ compartmentOriginPoint .y + compartmentLength ,
216
+ compartmentOriginPoint .z ,
217
+ )
218
+
209
219
compartmentTabInput .origin = tabOriginPoint
210
- compartmentTabInput .length = (
211
- max (0 , min (input .tabLength , input .binWidth )) * input .baseWidth
212
- )
220
+ compartmentTabInput .length = math . copysign ( (
221
+ max (0 , min (abs ( input .tabLength ) , input .binWidth )) * input .baseWidth
222
+ ), input . tabLength )
213
223
compartmentTabInput .width = input .tabWidth
214
224
compartmentTabInput .overhangAngle = input .tabOverhangAngle
215
225
compartmentTabInput .topClearance = const .BIN_TAB_TOP_CLEARANCE
0 commit comments