!This file is part of VEL_demo, copyright David Keyes, 2007. ! !This source file is free software: you can redistribute it and/or modify !it under the terms of the GNU General Public License as published by !the Free Software Foundation, either version 3 of the License, or !(at your option) any later version. ! !This code is distributed in the hope that it will be useful, !but WITHOUT ANY WARRANTY; without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !GNU General Public License for more details. ! !For terms of the GNU General Public license see . GLOBAL DRAWING MODULE dim_aline( VECTOR p1 > "start pos"; VECTOR p2 > "end pos"; FLOAT offset:=10.0 > "offset"; INT arr_slash:=1 > "0=slash, 1=arrow"; VAR FLOAT d_inch; VAR FLOAT ang); FLOAT pos, t_off, t_sizeA, t_sizeB, t_width, slash_len, dim_ext, dim_off; VECTOR rot_ang; INT scale, pen_col, i; BEGINMODULE part(#2,dim_vars(scale, pen_col, t_off, t_sizeA, t_sizeB, t_width, slash_len, dim_ext, dim_off)); set(PEN=pen_col); part(#3, negpos(offset, i)); lin_free(#12,p1, p2:BLANK=1); lin_offs(#13,#12, offset); lin_offs(#14,#12, dim_off * i:BLANK=1); lin_offs(#15,#13, dim_ext * i:BLANK=1); lin_free(#16,startp(#14), startp(#15)); lin_free(#17,endp(#14), endp(#15)); rot_ang:=vec(p2.x - p1.x, p2.y - p1.y); ang:=angle(rot_ang.x, rot_ang.y); csys_1p(#18,"a", startp(#13), 0.0, 0.0, ang:BLANK=1); csys_1p(#19,"b", endp(#13), 0.0, 0.0, ang - 180:BLANK=1); IF arr_slash = 0 THEN part(#20,slash(slash_len),#18); part(#21,slash(slash_len),#19); ELSE part(#22,arrow(slash_len*0.5),#18); part(#23,arrow(slash_len*0.5),#19); ENDIF; part(#25, get_len2D(p1, p2, d_inch)); ENDMODULE