Your Products have been synced, click here to refresh
Ok, I'll repeat it here - have a nice read :-)
Assuming ZPLUS is 'up', XPLUS is 'right', YPLUS is 'forward', measuring on the ZPLUS, YMINUS and XMINUS surfaces (because that's how my example was written). If your reality is different, you have to change things (left as exercise to the reader).
Primary is easy- measure a primary plane PLN_Z
- construct a "Tangent plane", PLN_TZ, math type CONSTRAINED_L2, BFRE (CONSTRAINED_MINMAX if you are in ISO)
- align level PLN_TZ, Z-origin PLN_TZ
Secondary is a bit more work- measure a secondary plane PLN_Y
- construct a "Tangent plane", PLN_TY, math type CONSTRAINED_L2, BFRE
- align rotate YMINUS around ZPLUS to PLN_TY
- locate the 'highest' measuring point on the YMINUS surface:
- ASSIGN/TPY = PLN_TY.HIT[1..PLN_TY.NUMHITS].Y
- ASSIGN/YZ = MININDEX(TPY)
- align Y-origin to PLN_TY
- in the Edit Window, change PLN_TY in the alignment command to PLN_TY.HIT[YZ..YZ]
NOTE: This will not rest the secondary on two or more points, just the highest one, so not exactly according to the standards. See note (1) for a refinement.
Tertiary is quite similar to secondary...As the alignment is now locked in all directions, all we have to do is locate the 'highest' point in the XMINUS direction:
- measure a tertiary plane PLN_X
- locate the 'highest' measuring point on the XMINUS surface:
- ASSIGN/TPX = PLN_X.HIT[1..PLN_X.NUMHITS].X
- ASSIGN/XZ = MININDEX(TPX)
- align X-origin to PLN_X
- in the Edit Window, change PLN_X in the alignment command to PLN_X.HIT[XZ..XZ]
Full code
[LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]PLN_TZ =FEAT/PLANE,CARTESIAN,OUTLINE,NO[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] THEO/<122.733,48.648,0>,<0,0,1>[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ACTL/<122.733,48.648,0>,<0,0,1>[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] CONSTR/PLANE,TANGENT,PLN_Z,,[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] MATH_TYPE/CONSTRAINED_MINMAX,BFRE[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A2 =ALIGNMENT/START,RECALL:A1,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/LEVEL,ZPLUS,PLN_TZ[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/TRANS,ZAXIS,PLN_TZ[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]PLN_TY =FEAT/PLANE,CARTESIAN,OUTLINE,NO[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] THEO/<35.126,0,-21.7>,<0,-1,0>[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ACTL/<35.126,0,-21.7>,<0,-1,0>[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] CONSTR/PLANE,TANGENT,PLN_Y,,[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] MATH_TYPE/CONSTRAINED_MINMAX,BFRE[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A3 =ALIGNMENT/START,RECALL:A2,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/ROTATE,YMINUS,TO,PLN_TY,ABOUT,ZPLUS[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/TPY=PLN_TY.HIT[1..PLN_TY.NUMHITS].Y[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/YZ=MININDEX(TPY)[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A4 =ALIGNMENT/START,RECALL:A3,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/TRANS,YAXIS,PLN_TY.HIT[YZ..YZ][/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/TPX=PLN_X.HIT[1..PLN_X.NUMHITS].Y[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/XZ=MININDEX(TPX)[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A5 =ALIGNMENT/START,RECALL:A4,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/TRANS,XAXIS,PLN_X.HIT[XZ..XZ][/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT]
------------------------------------------------------------------------------------------
Note (1) - a 'slightly better' rotation of the secondary
Now it's getting hairier...
First do the secondary tangent plane exactly as above. Then comes the 'trick' part - move the origin temporarily to the found highest point, calculate the angle from this to all the other points and find the angle with the smallest absolute value. The signed value is how much we can rotate the coordinate system, touch [at least] two points of the secondary surface and still have all points on the same side of the calculated 'plane' (we are still 'tangent').
[LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]PLN_TY =FEAT/PLANE,CARTESIAN,TRIANGLE,NO[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] THEO/<108.5,0,-14.8333>,<0,-1,0>[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ACTL/<108.8335,0.1469,-14.8317>,<0.0017223,-0.9999006,0.0139948>[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] CONSTR/PLANE,TANGENT,PLN_Y,,[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] MATH_TYPE/CONSTRAINED_L2,BFRE[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A2 =ALIGNMENT/START,RECALL:A1,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/ROTATE,YMINUS,TO,PLN_TY,ABOUT,ZPLUS[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/VI2=MININDICES(PLN_TY.HIT[1..PLN_TY.NUMHITS].Y)[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/VI1=VI2[1][/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A3 =ALIGNMENT/START,RECALL:A2,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/TRANS,YAXIS,PLN_TY.HIT[VI1..VI1][/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] WORKPLANE/ZPLUS[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/ANG=RAD2DEG(ATAN(PLN_TY.HIT[1..PLN_TY.NUMHITS].Y/(PLN_TY.HIT[1..PLN_TY.NUMHITS].X - PLN_TY.HIT[VI1].X)))[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/AANG=ABS(ANG)[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/IANG=MININDEX(AANG)[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ASSIGN/ANGT=ANG[IANG][/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px]A4 =ALIGNMENT/START,RECALL:A3,LIST=YES[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/TRANS,XAXIS,PLN_TY.HIT[VI1..VI1][/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/ROTATE_OFFSET,ANGT,ABOUT,ZPLUS[/SIZE][/FONT][/COLOR][/LEFT] [LEFT][COLOR=#000000][FONT=Arial][SIZE=12px] ALIGNMENT/END[/SIZE][/FONT][/COLOR][/LEFT]This alignment should be compatible with the older ASME standard of 'candidate datum set', but is not the same as the CONSTRAINED_L2 of current ASME, or the CONSTRAINED_MINMAX of current ISO. Probably close, but not the same.
I like the idea of trying to mimic what the ASME standard explains using tangent planes and extracting the furthest points using variables and constructions. How often is this actually used in practice though?
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |