Hi All, I'm still learning with creating custom component using python script. Right now, I have very hard time understanding how setLinearDimension ('A', (B), (C)) work. 'A' is the object parameter, and then what is exactly (B) and (C)? Can someone please help to kindly explain it?
below is my example of stanchion pipe support script,.
When I'm using properties panel to fill distance 'X' value, it correctly matches to location that I want, but if I am using snap from 'little arrow' to position, it ended up on wrong support length.
What do wrong with my setup?
manually typing 1000mm to propertiessnapping support drag point to location resulting in wrong length (less about half of pipe OD OD)
from aqa.math import *
from varmain.primitiv import *
from varmain.var_basic import *
from varmain.custom import *
import math
# Metadata
@activate(Group="Support", TooltipShort="Pipe Stanchion", TooltipLong="Pipe Stanchion Support", LengthUnit="mm", Ports=1)
@group("MainDimensions")
@param(MPIP=LENGTH, TooltipShort="Matching Pipe OD", TooltipLong="Pipe OD")
@param(X=LENGTH, TooltipShort="Member Length Vertical", TooltipLong="Member Length Vertical")
@param(P1D=LENGTH, TooltipShort="Stanchion Pipe", TooltipLong="Stanchion Pipe")
@param(SCH=LENGTH, TooltipShort="Pad Thickness", TooltipLong="Pad Thickness")
@param(LS=LENGTH, TooltipShort="Pad Length", TooltipLong="Pad Length")
@param(BL=LENGTH, TooltipShort="Base Plate Length", TooltipLong="Base Plate Length")
@param(BT=LENGTH, TooltipShort="Base Plate Thickness", TooltipLong="Base Plate Thickness")
def STC01(s, MPIP=114.3, X=300.0, P1D=60.325, SCH=6.02, LS=150.0, BL=120, BT=10.0, ID="STC01", **kw):
o1=CYLINDER(s, R=P1D/2.0, H=(X+MPIP/3.0), O=0.0).translate((0.0, 0.0, -(X+MPIP/2.0)))
o1subt=CYLINDER(s, R=MPIP/2.0, H=(P1D*2.0), O=0.0).rotateY(90).translate((-P1D, 0.0, 0.0))
o1.subtractFrom(o1subt)
o1subt.erase()
o2=CYLINDER(s, R=(MPIP/2.0)+SCH, H=LS, O=MPIP/2.0).rotateY(90).translate((-LS/2.0, 0.0, 0.0))
#o2intc=BOX(s, L=MPIP*2.0, W=MPIP*2, H=MPIP*2.0).rotateX(45).translate((0.0, 0.0, -MPIP*2))
#o2.intersectWith(o2intc)
#o2intc.erase()
o1.uniteWith(o2)
o2.erase()
o3=BOX(s, L=BL, W=BT, H=BL).translate((0.0, 0.0, -(MPIP/2.0 + X - BT/2.0)))
o1.uniteWith(o3)
o3.erase()
s.setPoint((0.0, 0.0, 0.0), (-1.0, 0.0, 0.0), 0)
s.setLinearDimension('X', (0, 0, -MPIP/2.0), (0, 0, -X))
return