; ; AFFINITY TRANSFORMATION 3 - Ver.01 - The 'Axonometry' and the 'User Coordinate System' TOOL ; ; Author: Milan Anthony Vlasak, Eng. ;<@> May 2006, Brisbane, Queensland, Australia ;<#> This Macro is Version 01 and it is free for use with a copy of General Cadd Pro ; You assume total responsibility for using this macro ; EN,Pre-AFFINITY,; /VLC; MO; BR,--; RB,++; OR,--; OS,O,--; ; YE,1000; YE,1001; RD; ; /MSP,++,/XMD,++; /SEL,Select the SUBJECTS for Transformation in [AFFINITY] - the [Axonometry] Tool........> Destination layer is your current layer - exciting ! <,#; /IF,$VAL[EQ]0,/GTO,GRANDEXIT; CO,L,!,!,!,1; CG,P,!,Y,1001,!; SOURCE in Layer 1001 ; YC,!; /VIN,2,$VAL; ; /VIN,0,1;............................i-index .TRANSITLINES; /IF,$I(0)[GE]4,/GTO,SOLVEPARAMETERS; /MSP,--,/MSP,++; /PMT,1,'>> Draw Transit Line [number]: ',$I(0),' from Subject to Model >>',#; /PMT,2,' Tip: SNAP a point at Subject area and then SNAP a point at Model area',#; /PMT,3,' Consequently THREE Transit Lines are needed ',#; ',#; /XMD,--; BW,@,@,$PNTX,$PNTY,$PNTX,$PNTY; /XMD,++; CG,T,!,Y,1000,!; /VIN,0,$I(0)+1; /GTO,TRANSITLINES; ; .SOLVEPARAMETERS; /CEL,Y,1000,!; /VIN,0,$VAL; /VIN,1,1; .LOOP0; /IF,$I(1)[GT]$I(0),/GTO,END0; /EEX,$I(1),P,1,A,/VPT,$I(1)+3,$PNTX,$PNTY; /EEX,$I(1),P,2,A,/VPT,$I(1),$PNTX,$PNTY; /VIN,1,$I(1)+1; /GTO,LOOP0; .END0; /DEL; ; /VRL,0,$X(4)*($Y(5)-$Y(6))+$X(5)*($Y(6)-$Y(4))+$X(6)*($Y(4)-$Y(5)); ....K factor /IF,$R(0)[EQ]0,/BEEP,/GTO,GRANDEXIT; /VRL,1,(0-($Y(4)*($X(2)-$X(3))+$Y(5)*($X(3)-$X(1))+$Y(6)*($X(1)-$X(2))))/$R(0); ....a1 /VRL,2,(0-($X(4)*($X(2)-$X(3))+$X(5)*($X(3)-$X(1))+$X(6)*($X(1)-$X(2))))/$R(0); ....b1 /VRL,3,(0+($X(4)*($Y(2)-$Y(3))+$X(5)*($Y(3)-$Y(1))+$X(6)*($Y(1)-$Y(2))))/$R(0); ....a2 /VRL,4,(0-($Y(4)*($Y(2)-$Y(3))+$Y(5)*($Y(3)-$Y(1))+$Y(6)*($Y(1)-$Y(2))))/$R(0); ....b2 /VRL,5,$X(1)-$R(1)*$X(4)+$R(2)*$Y(4); ....c1 /VRL,6,$Y(1)-$R(4)*$X(4)-$R(3)*$Y(4); ....c2 ; ;....Sigma-x /IF,$R(4)[GT]0,/IF,$R(1)[GT]0,/VRL,7,$ATN($R(4)/$R(1)); /IF,$R(4)[GT]0,/IF,$R(1)[LT]0,/VRL,7,180+$ATN($R(4)/$R(1)); /IF,$R(4)[LT]0,/IF,$R(1)[LT]0,/VRL,7,180+$ATN($R(4)/$R(1)); /IF,$R(4)[LT]0,/IF,$R(1)[GT]0,/VRL,7,360+$ATN($R(4)/$R(1)); ;arbitrary replacement angle /IF,$ABS($R(4))[LT]0.000000001,/IF,$R(1)[GT]0,/VRL,7,0; /IF,$ABS($R(1))[LT]0.000000001,/IF,$R(4)[GT]0,/VRL,7,90; /IF,$ABS($R(4))[LT]0.000000001,/IF,$R(1)[LT]0,/VRL,7,180; /IF,$ABS($R(1))[LT]0.000000001,/IF,$R(4)[LT]0,/VRL,7,270; ; ;....Sigma-y /IF,$R(2)[GT]0,/IF,$R(3)[GT]0,/VRL,8,90+$ATN($R(2)/$R(3)); /IF,$R(2)[GT]0,/IF,$R(3)[LT]0,/VRL,8,270+$ATN($R(2)/$R(3)); /IF,$R(2)[LT]0,/IF,$R(3)[LT]0,/VRL,8,270+$ATN($R(2)/$R(3)); /IF,$R(2)[LT]0,/IF,$R(3)[GT]0,/VRL,8,90+$ATN($R(2)/$R(3)); ;arbitrary replacement angle /IF,$ABS($R(2))[LT]0.000000001,/IF,$R(3)[GT]0,/VRL,8,90; /IF,$ABS($R(3))[LT]0.000000001,/IF,$R(2)[GT]0,/VRL,8,180; /IF,$ABS($R(2))[LT]0.000000001,/IF,$R(3)[LT]0,/VRL,8,270; /IF,$ABS($R(3))[LT]0.000000001,/IF,$R(2)[LT]0,/VRL,8,0; ; ; Scales Qx and Qy /VRL,9,$SQT($SQR($R(1))+$SQR($R(4))); /VRL,10,$SQT($SQR($R(3))+$SQR($R(2))); ; ;;;;;PO,$R(5),$R(6); Origin Point of new Affine Coordinate System - undo five semicolons to show ; EX,Y,1001,!; EX,Y,1001,!; EX,Y,1001,!; ; SZ,Y,1001,!,0,0,$R(9),$R(10);..........Scales in x' & y' /VRL,13,($R(8)-$R(7))/2; RO,Y,1001,!,0,0,0-45;..................Pre-rotate for Shear /VRL,14,($COS($R(13))/($COS(45)); /VRL,15,($SIN($R(13))/($COS(45)); SZ,Y,1001,!,0,0,$R(14),$R(15);.........Shear MV,Y,1001,!,0,0,$R(5),$R(6);...........Shift X and Shift Y RO,Y,1001,!,$R(5),$R(6),$R(7)+$R(13);..Final rotation ; .GRANDEXIT; CG,Y,1001,!,Y,$I(2),!; YE,1000; RD; RN,Pre-AFFINITY; /MSP,--,/XMD,--,PU; end of macro **