131 l1 = _draft_get_config(
"dim-leader-length"),
144 w = _draft_get_config(
"dim-leader-weight"),
145 s = _draft_get_config(
"dim-leader-style"),
146 a = _draft_get_config(
"dim-leader-arrow"),
148 off = _draft_get_config(
"dim-offset"),
150 cmh = _draft_get_config(
"dim-cmh"),
151 cmv = _draft_get_config(
"dim-cmv"),
154 layers = _draft_get_config(
"layers-dim")
157 if (_draft_layers_any_active(layers))
158 _draft_make_3d_if_configured()
161 bw = _draft_get_config(
"dim-leader-box-weight");
162 bs = _draft_get_config(
"dim-leader-box-style");
163 lnd = is_undef(line) ? [bw, bs] : line;
165 plo = is_undef(off) ? p
191 dtp = is_undef(tr) ? [-1, 0]
194 (al2> 45 && al2< 135) ? [ 0, 1]
195 : (al2>=135 && al2<=225) ? [ 1, 0]
196 : (al2> 225 && al2< 315) ? [ 0,-1]
200 rotate( [0, 0, tra] )
302 d = _draft_get_config(
"dim-line-distance"),
303 e = _draft_get_config(
"dim-line-extension-length"),
304 es = _draft_get_config(
"dim-line-extension-style"),
306 w = _draft_get_config(
"dim-line-weight"),
307 s = _draft_get_config(
"dim-line-style"),
308 a = _draft_get_config(
"dim-line-arrow"),
313 off = _draft_get_config(
"dim-offset"),
315 ts = _draft_get_config(
"dim-text-size"),
316 tp = _draft_get_config(
"dim-text-place"),
317 rm = _draft_get_config(
"dim-round-mode"),
319 cmh = _draft_get_config(
"dim-cmh"),
320 cmv = _draft_get_config(
"dim-cmv"),
322 layers = _draft_get_config(
"layers-dim")
328 str(
"draft_dim_line: p1 and p2 must be distinct points; got p1=", p1,
" p2=", p2)
331 if (_draft_layers_any_active(layers))
332 _draft_make_3d_if_configured()
337 mr1 = is_undef(v1) ? p1
340 mr2 = is_undef(v2) ? p2
387 du = is_undef(u) ? md
398 is_undef(u) ? str(rd) : str(rd,
" ", u);
409 draft_line(l=[pd1, pd2], w=w, s=s, a1=da1, a2=da2);
411 translate( (pd1+pd2)/2 )
412 rotate( [0, 0, ape-90] )
429 draft_line(l=[pd1, pd2], w=w, s=s, a1=da1, a2=da2);
433 translate( (pd1+pd2)/2 )
434 rotate( [0, 0, ape-90] )
526 w = _draft_get_config("dim-radius-weight"),
527 s = _draft_get_config("dim-radius-style"),
528 a = _draft_get_config("dim-radius-arrow"),
533 off = _draft_get_config("dim-offset"),
535 ts = _draft_get_config("dim-text-size"),
536 tp = _draft_get_config("dim-text-place"),
537 rm = _draft_get_config("dim-round-mode"),
539 cmh = _draft_get_config("dim-cmh"),
540 cmv = _draft_get_config("dim-cmv"),
542 layers = _draft_get_config("layers-dim")
548 "draft_dim_radius: supply either p or v, not both; p takes precedence and v is ignored"
551 if (_draft_layers_any_active(layers))
552 _draft_make_3d_if_configured()
576 pd1 = (do1 == 0) ? mr1
578 pd2 = (do2 == 0) ? mr2
593 du = is_undef(u) ? md
606 is_undef(u) ? str(rt,
" ", rd) : str(rt,
" ", rd,
" ", u);
617 draft_line(l=[pd1, pd2], w=w, s=s, a1=da1, a2=da2);
619 translate( (pd1+pd2)/2 )
620 rotate( [0, 0, ape] )
637 draft_line(l=[pd1, pd2], w=w, s=s, a1=da1, a2=da2);
641 translate( (pd1+pd2)/2 )
642 rotate( [0, 0, ape] )
741 e = _draft_get_config("dim-
angle-extension-ratio"),
742 es = _draft_get_config("dim-
angle-extension-style"),
744 w = _draft_get_config("dim-
angle-weight"),
745 s = _draft_get_config("dim-
angle-style"),
746 a = _draft_get_config("dim-
angle-arrow"),
751 off = _draft_get_config("dim-offset"),
753 ts = _draft_get_config("dim-text-size"),
754 tp = _draft_get_config("dim-text-place"),
755 rm = _draft_get_config("dim-round-mode"),
757 cmh = _draft_get_config("dim-cmh"),
758 cmv = _draft_get_config("dim-cmv"),
760 layers = _draft_get_config("layers-dim")
763 if (_draft_layers_any_active(layers))
764 _draft_make_3d_if_configured()
802 :
angle_ll([o, mr1], [o, mr2],
false),
805 au = is_undef(u) ? ma
816 is_undef(u) ? str(rd) : str(rd,
" ", u);
827 draft_arc(r=r-off, o=o, v1=[o, pe1], v2=[o, pe2], fn=fn, cw=cw, w=w, s=s, a1=da1, a2=da2);
847 draft_arc(r=r-off, o=o, v1=[o, pe1], v2=[o, pe2], fn=fn, cw=cw, w=w, s=s, a1=da1, a2=da2);
907 l = _draft_get_config(
"dim-center-length"),
910 es = _draft_get_config(
"dim-center-extension-style"),
912 w = _draft_get_config(
"dim-center-weight"),
913 s = _draft_get_config(
"dim-center-style"),
915 layers = _draft_get_config(
"layers-dim")
918 if (_draft_layers_any_active(layers))
919 _draft_make_3d_if_configured()
932 p1 = o - l * [cos(la), sin(la)];
942 p1 = o + (r-l) * [cos(la), sin(la)];
943 p2 = o + (r-l/2)/2 * [cos(la), sin(la)];
957 p1 = o + rs * [cos(la), sin(la)];
origin2d
<point-2d> The origin point coordinate in 2d Euclidean space.
x_axis2d_uv
<vector-2d> The unit vector of the positive x-axis in 2d Euclidean space.
function line_tp(l)
Return the terminal point of a line or vector.
function angle_ll(l1, l2, s=true)
Compute the angle between two lines or vectors in a 3d or 2d-space.
function is_point(v)
Test if a value defines a point.
function line2d_new(m=1, a=0, p1=origin2d, p2, v)
Construct a 2 dimensional directed line.
function point_closest_pl(p, l)
Compute the coordinates of the closest point on a line to a given point.
function distance_pp(p1, p2)
Compute the distance between two points.
function defined_e_or(v, i, d)
Returns an element from an iterable if it exists, or a default value if not.
function third(v)
Return the third element of an iterable value.
function second(v)
Return the second element of an iterable value.
function is_empty(v)
Test if an iterable value is empty.
function round_d(v, d=6)
Round a list of numbers to a fixed number of decimal point digits.
function round_s(v, d=6)
Round a list of numbers to a fixed number of significant figures.
function defined_or(v, d)
Return given value, if defined, or a secondary value, if primary is not defined.
function is_defined(v)
Test if a value is defined.
function is_number(v)
Test if a value is a number.
function angle(a, from=angle_unit_default, to=angle_unit_base)
Convert an angle value from one unit to another.
function length(v, from=length_unit_default, to=length_unit_base, d=1)
Convert a length value from one unit to another, with optional dimensional scaling.