!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_hline( VECTOR p1 > "start pos"; VECTOR p2 > "end pos"; FLOAT offset:=10.0 > "offset"; INT arr_slash:=0 > "0=slash, 1=arrow"; VAR FLOAT d_inch); FLOAT pos; FLOAT t_off, t_sizeA, t_sizeB, t_width, slash_len, dim_ext, dim_off; INT scale, pen_col; BEGINMODULE part(#1, dim_vars(scale, pen_col, t_off, t_sizeA, t_sizeB, t_width, slash_len, dim_ext, dim_off)); set(PEN=pen_col); pos:=p1.y - offset; lin_free(#10,p1, p2:BLANK=1); IF p1.y > pos THEN dim_off:=-dim_off; dim_ext:=-dim_ext; ENDIF; lin_free(#11,vec(p1.x, p1.y + dim_off), vec(p1.x, pos + dim_ext)); dim_ext:=abs(dim_ext); dim_off:=abs(dim_off); IF p2.y > pos THEN dim_off:=-dim_off; dim_ext:=-dim_ext; ENDIF; lin_free(#12,vec(p2.x, p2.y + dim_off), vec(p2.x, pos + dim_ext)); lin_free(#13,vec(p1.x, pos), vec(p2.x, pos)); csys_1p(#15,"a", intersect(#13, #11, -1), 0.0, 0.0, 0.0:BLANK=1); csys_1p(#16,"b", intersect(#13, #12, -1), 0.0, 0.0, 180.0:BLANK=1); IF arr_slash = 0 THEN part(#17, slash(slash_len),#15); part(#18, slash(slash_len),#16); ELSE part(#19, arrow(slash_len*0.5),#15); part(#20, arrow(slash_len*0.5),#16); ENDIF; d_inch:=p2.x - p1.x; ENDMODULE