;*** CMP-LINE.GXM ;*** Written by Bjorn R Holmgren 2003 for General Cadd Pro ;*** edited from \SAMPLES\Waterline.gxm to apply to components instead of text character /MSP,++,/XMD,++,MO; /VLC; clean out old values .INIIALISE; ;;;;;/VST,3,w; the character to be inserted ;;;;;/VRL,3,1.85; spacing between I.D. character and end of broken lines ;;;;;TZ,!,/VRL,0,$VAL; text size ;;;;;TS,J,C,; set text justification to center CZ,!,!,/VPT,0,$PNTX,$PNTY; component scale ;***************************************************************************************** ;********** For User Edits - name, rotation control, spacing, cmp scale, cmp width .COMPONENT; insertion point must be at centre of component width ! /VST,3,CMP1; name of component to be inserted ; LO,C,$S(3); bug in 1.02.6 - does not read variable for load LO,C,CMP1; from your default gxc folder - if not : include path ! .ROTATION CONTROL;select on of the following with the preceding semicolon ;/VIN,3,0; controls component rotation = line rotation /VIN,3,1; controls component rotation for reading right side up .SPACING CMP LINE; = 2 if No space <2 if space desired /VRL,3,2; spacing between component and end of broken lines .CMP INSERTION WIDTH; /VRL,0,1000; component width dimension .CMP SCALE; CZ,1,1; set component scale ;***************************************************************************************** .LINE; /PMT,1,'Draw Next Leg of Line ...',#; /PMT,2,' :_',#; /VPT,1,@; start point /IF,$DERR[EQ]-2,/GTO,EXIT; if ESC - exit .NEXTLEG; outer loop address L1,$X(1),$Y(1),@; /VPT,2,TK,L,PU; catch the last point entered /IF,$X(1)[EQ]$X(2),/IF,$Y(1)[EQ]$Y(2),/GTO,EXIT; same point-exit OO; undo the line MD,$X(1),$Y(1),$X(2),$Y(2),PU,/VRL,1,$VAL; overall length ME,2,$X(1),$Y(1),$X(2),$Y(2),PU,/VRL,2,$VAL; angle of line ;;;;;TR,$R(2); set text rotation to line angle CR,$R(2); set component rotation to line angle /VIN,0,1; point y-rotation control switch .CHARACTERINSERT; correct character rotation and placement to be "right" side up ;;;;;/IF,$R(2)[GT]90,/IF,$R(2)[LT]270,/VIN,0,-1,TR,$R(2)+180; correct character insert /IF,$I(3)[EQ]1,/IF,$R(2)[GT]90,/IF,$R(2)[LT]270,/VIN,0,-1,CR,$R(2)+180; correct character insert .CHECKLENGTH; /VIN,1,0; counter for broken lines /VRL,4,$R(1)/3; default is character at 3rd points of the line /IF,$R(1)[LT]($R(0)/$R(3))*5,/GTO,NEXT; line too short for any characters /IF,$R(1)[LT]($R(0)/$R(3))*30,/VRL,4,$R(1)/2,/VIN,1,1; line too short for 2 characters .LINES; inner loop address L1,$X(1),$Y(1),MR,$R(4)-$R(0)/$R(3),<$R(2),MO; next part line /VPT,3,$X(1)+($R(4))*$COS($R(2)),$Y(1)+($R(4))*$SIN($R(2)); x-rotation ; note how $I(0) controls the y-rotation ;;;;;/VPT,3,$X(3)+$I(0)*($R(0)/3)*$SIN($R(2)),$Y(3)-$I(0)*($R(0)/3)*$COS($R(2)); y-rotation ; calculate start point for next part line - see rotation formula on Tools 15.1 /VPT,1,$X(1)+($R(4)+$R(0)/$R(3))*$COS($R(2)),$Y(1)+($R(4)+$R(0)/$R(3))*$SIN($R(2)); ;;;;;TL,$X(3),$Y(3),$S(3),#; point where we insert the character CP,$S(3),$X(3),$Y(3); point where we insert the component /IF,$I(1)[EQ]1,/GTO,NEXT; - exit loop /VIN,1,$I(1)+1,/GTO,LINES; increment counter and go back to inner loop address .NEXT; break-out address from inner loop L1,$X(1),$Y(1),$X(2),$Y(2); draw last line to end point /VPT,1,$X(2),$Y(2); set start point for next line to end point of last line /GTO,NEXTLEG; back to outer loop address for next line .EXIT; TS,J,L,; set text justification to left TR,0; set text rotation 0 CZ,$X(0),$Y(0); /XMD,--,/MSP,--,PU;