!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_inline( VECTOR p1 > "start pos"; VECTOR p2 > "end pos"; REF line > "align with"; 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, ang_a, ang_b; 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)); ang_a:=startp(global_ref(line, 9)); ang_b:=endp(global_ref(line, 9)); ang:=angle(ang_b.x-ang_a.x, ang_b.y-ang_a.y); lin_ang(#12,p1, ang, 1:BLANK=1); lin_offs(#13,#12, offset:BLANK=0); lin_ang(#14,p2, ang + 270, 1:BLANK=0); trim(#13, 1, #14, -1); unblank(#13); trim(#14, 1, #13, -1); unblank(#14); lin_free(#15,startp(#12), startp(#13)); lin_offs(#16,#12, dim_off * i:BLANK=1); trim(#15, 0, #16, -1); lin_perp(#17,startp(#14), #14, 1 * i:BLANK=1); lin_offs(#18,#17, -dim_off * i:BLANK=1); trim(#14, 0, #18, -1); lin_offs(#19,#13, dim_ext * i:BLANK=1); trim(#15, 1, #19, -1); trim(#14, 1, #19, -1); csys_1p(#20,"a", startp(#13), 0.0, 0.0, ang:BLANK=1); csys_1p(#21,"b", endp(#13), 0.0, 0.0, ang - 180:BLANK=1); IF arr_slash = 0 THEN part(#22,slash(slash_len),#20); part(#23,slash(slash_len),#21); ELSE part(#24,arrow(slash_len*0.5),#20); part(#25,arrow(slash_len*0.5),#21); ENDIF; part(#26, get_len2D(startp(#13), endp(#13), d_inch)); ENDMODULE