omdl  v1.0
OpenSCAD Mechanical Design Library
Drafting

Drafting and drawing tools for graphical design documentation. More...

+ Collaboration diagram for Drafting:

Files

file  config.scad
 Drafting: defaults and configurations.
 
file  primitive.scad
 Drafting: base functions and primitives.
 
file  operation.scad
 Drafting: tools and general operations.
 
file  dimension.scad
 Drafting: dimensioning operations.
 
file  draft-base.scad
 Drafting: include wrapper.
 

Configuration Variables

 $draft_make_3d = false
 <boolean> Extrude 2D drafted constructions to 3D.
 
 $draft_line_fn = 4
 <integer> Arc fragment size for line construction.
 
 $draft_arrow_fn = 8
 <integer> Arc fragment size for arrowhead construction.
 
 $draft_scale = 1
 <integer> Line construction drafting scale multiplier. More...
 
 draft_sheet_scale = 1
 <integer> Sheet construction drafting scale multiplier. More...
 
 draft_sheet_size = "A"
 <string> Drafting sheet size identifier. More...
 
 draft_sheet_config = "L84TS"
 <string> Drafting sheet configuration identifier. More...
 
 draft_layers_show = ["all"]
 <string-list> List of active drafting layer names. More...
 
 draft_config_map = draft_config_map_style1
 <map> Drafting configuration defaults map. More...
 

Style Maps

 draft_config_map_style1
 <map> A drafting configuration map; style1. More...
 
 draft_title_block_map_style1
 <map> A title block map; style 1. More...
 
 draft_table_format_map_ccc
 <map> Table format map; centered, centered, centered –justified.
 
 draft_table_format_map_cll
 <map> Table format map; centered, left, left –justified.
 
 draft_table_format_map_crr
 <map> Table format map; centered, right, right –justified.
 

Shape Primitives

module draft_line_pp (i, t, w=1)
 Draft a simple line from an initial to a terminal point. More...
 
module draft_arrow (l=x_axis2d_ul, w=1, s=1)
 Draft an arrowhead at the terminal point of a line. More...
 
module draft_line (l=x_axis2d_ul, w=1, s=1, a1=0, a2=0)
 Draft a line with configurable style and optional arrowheads. More...
 
module draft_arc (r=1, o=origin2d, v1=x_axis2d_uv, v2=x_axis2d_uv, fn, cw=true, w=1, s=1, a1=0, a2=0)
 Draft an arc with configurable style and optional arrowheads. More...
 
module draft_rectangle (d=1, o=origin2d, w=1, s=1)
 Draft a rectangle with configurable style. More...
 
module draft_polygon (c, p, e, i=true, w=1, s=1)
 Draft a polygon with configurable style. More...
 

Layer Assignment

module draft_in_layers (layers=_draft_get_config("layers-default"))
 Assign one or more layers to child objects. More...
 

Object Placement

module draft_move (list)
 Move one or more child objects to a sheet reference zone. More...
 

Sheet Construction

module draft_sheet (sheet, frame, zone, grid, origin, check=false, layers=_draft_get_config("layers-sheet"))
 Construct a drafting sheet with frame, zone, grid, and origin. More...
 
module draft_axes (size, w=1, s=2, a=0, ts=0, layers=_draft_get_config("layers-sheet"))
 Construct drafting sheet axes. More...
 
module draft_ruler (units=length_unit_base, marks=10, groups=5, mark_size=1, group_height=5, label_scale=2/3, label_hide=false, order=1, w=1, layers=_draft_get_config("layers-sheet"))
 Construct a drafting sheet ruler. More...
 

Table Construction

module draft_table (map, fmap, zp=0, window=false, layers=_draft_get_config("layers-table"))
 Construct a text table that is populated by rows and columns. More...
 
module draft_ztable (text, map, zp=0, number=false, window=false, layers=_draft_get_config("layers-table"))
 Construct a text table that is populated by predefined zones. More...
 
module draft_note (head, note, size, line, halign="left", cmh=_draft_get_config("note-cmh"), cmv=_draft_get_config("note-cmv"), zp=0, window=false, layers=_draft_get_config("layers-note"))
 Construct a text note with optional heading and border. More...
 
module draft_title_block (text, map=draft_title_block_map_style1, zp=0, number=false, window=false, layers=_draft_get_config("layers-titleblock"))
 Construct a sheet title block. More...
 

Dimensioning

module draft_dim_leader (p=origin2d, v1=30, l1=_draft_get_config("dim-leader-length"), v2, l2, h, t, ts, tp, tr, ta="center", line, w=_draft_get_config("dim-leader-weight"), s=_draft_get_config("dim-leader-style"), a=_draft_get_config("dim-leader-arrow"), off=_draft_get_config("dim-offset"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), window=false, layers=_draft_get_config("layers-dim"))
 Construct a dimension leader line at a point. More...
 
module draft_dim_line (p1=origin2d, p2=origin2d, v1, v2, t, u, d=_draft_get_config("dim-line-distance"), e=_draft_get_config("dim-line-extension-length"), es=_draft_get_config("dim-line-extension-style"), w=_draft_get_config("dim-line-weight"), s=_draft_get_config("dim-line-style"), a=_draft_get_config("dim-line-arrow"), a1, a2, off=_draft_get_config("dim-offset"), ts=_draft_get_config("dim-text-size"), tp=_draft_get_config("dim-text-place"), rm=_draft_get_config("dim-round-mode"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), layers=_draft_get_config("layers-dim"))
 Construct a dimension line between two points. More...
 
module draft_dim_radius (o=origin2d, p, r=1, v, t, u, d=false, w=_draft_get_config("dim-radius-weight"), s=_draft_get_config("dim-radius-style"), a=_draft_get_config("dim-radius-arrow"), a1, a2, off=_draft_get_config("dim-offset"), ts=_draft_get_config("dim-text-size"), tp=_draft_get_config("dim-text-place"), rm=_draft_get_config("dim-round-mode"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), layers=_draft_get_config("layers-dim"))
 Construct a radial dimension line. More...
 
module draft_dim_angle (o=origin2d, r=1, v1, v2, fn, cw=false, t, u, e=_draft_get_config("dim-angle-extension-ratio"), es=_draft_get_config("dim-angle-extension-style"), w=_draft_get_config("dim-angle-weight"), s=_draft_get_config("dim-angle-style"), a=_draft_get_config("dim-angle-arrow"), a1, a2, off=_draft_get_config("dim-offset"), ts=_draft_get_config("dim-text-size"), tp=_draft_get_config("dim-text-place"), rm=_draft_get_config("dim-round-mode"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), layers=_draft_get_config("layers-dim"))
 Construct a angular dimension arc. More...
 
module draft_dim_center (o=origin2d, r, v=0, l=_draft_get_config("dim-center-length"), e, es=_draft_get_config("dim-center-extension-style"), w=_draft_get_config("dim-center-weight"), s=_draft_get_config("dim-center-style"), layers=_draft_get_config("layers-dim"))
 Construct a center mark dimension cross. More...
 

Usage Details

Drafting and drawing tools for graphical design documentation.

Requires:
include <omdl-base.scad>;
include <transforms/base_cs.scad>;
include <tools/common/polytope.scad>;
include <tools/2d/drafting/draft-base.scad>;

Conventions

Naming

All public modules and functions are prefixed with draft_*. Internal (private) identifiers carry an additional leading underscore: _draft_*. Configuration getter functions follow the form _draft_get_* and are private; callers should use the public variable draft_config_map together with the map_merge() or map_update() override pattern shown in that variable's documentation.

Common Parameters

The following short-name parameters carry consistent meaning across all modules in this library:

parameter data type meaning
w decimal line weight (width multiplier)
s integer | integer-list line style; see draft_line()
a integer | integer-list-5 arrowhead style; see draft_arrow()
a1, a2 integer | integer-list-5 per-endpoint arrowhead overrides
o point-2d origin or center coordinate
off decimal | decimal-list-2 dimension line offset distance
t string | string-list text string or measured-value override
u string unit identifier for measured values
ts decimal-list-3 text size [width, line-height, heading-height]
tp decimal-list-2..4 text placement [-1, +1 per axis] (1)
rm integer | integer-list-2 measurement rounding mode (2)
cmh decimal minimum horizontal cell size
cmv decimal minimum vertical cell size
layers string-list drafting layer names to render this object on
window boolean return bounding rectangle instead of geometry
zp decimal-list-2 | decimal zone/window alignment scaler [-1, +1]
line value-list-2 border line config [width, [style]]

(1) text placement [-1, +1] per axis with optional tp[2] pivot offset (angle dims) and optional tp[3] rotation offset.

(2) measurement rounding mode: 0=none, 1=round_d, 2=round_s.

Scale Variables

Two scale variables govern geometry size and must be kept in sync:

draft_move ( [ ... ] )
{
// child objects here inherit $draft_scale automatically
}
module draft_move(list)
Move one or more child objects to a sheet reference zone.
Definition: operation.scad:282
$draft_scale
<integer> Line construction drafting scale multiplier.
Definition: config.scad:129
draft_sheet_scale
<integer> Sheet construction drafting scale multiplier.
Definition: config.scad:159

Layers

Every module accepts a layers parameter. The global variable draft_layers_show lists the layers that will actually be rendered; all others are suppressed. Setting it to ["all"] renders everything; "all" is a wildcard that matches any layer list.

Default layer assignments by module category:

category default layer name
general geometry "default"
sheet / frame "sheet"
tables "table"
notes "note"
title block "titleblock"
dimensions "dim"

To isolate a drawing phase, restrict draft_layers_show:

draft_layers_show = ["default", "dim"]; // geometry + dimensions only
draft_layers_show
<string-list> List of active drafting layer names.
Definition: config.scad:649

Configuration and Style Maps

All style defaults live in draft_config_map, initialised to draft_config_map_style1. Apply selective overrides with map_merge(), placing overrides first so they take precedence:

(
[ ["dim-offset", length(3)], ["line-use-hull", false] ],
);
function map_merge(m1, m2)
Merge the unique key-value pairs of a second map with those of a first.
draft_config_map
<map> Drafting configuration defaults map.
Definition: config.scad:968
draft_config_map_style1
<map> A drafting configuration map; style1.
Definition: config.scad:819
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.

All dimension values in configuration maps should be expressed via length() or angle() with an explicit unit string so that designs remain unit-independent.

Typical Workflow

A minimal complete script follows the pattern shown in the auxiliary example block at the bottom of this file:

  1. Add required include files (see Required above).
  2. Set length_unit_base and draft_layers_show.
  3. Optionally override draft_config_map with map_merge() or map_update().
  4. Call draft_sheet() to establish the frame and zones.
  5. Use draft_move() to place the title block, tables, and notes into named or indexed sheet zones.
  6. Draw geometry inside draft_in_layers() to assign it to a layer, then annotate with draft_dim_line(), draft_dim_radius(), etc.
Example

An example script and its output are shown below. There are numerous ways to generate a printable form of the 2D result. For example: (1) render the 2D design; (2) export it as a DXF file; (3) open the exported DXF file in LibreCAD; (4) select print preview and adjust the print scale as needed for the target sheet size and output format; (5) then print or save the result as a PDF.

Drafting example diagram
top
expand top

Drafting example script

include <omdl-base.scad>;
include <transforms/base_cs.scad>;
include <tools/2d/drafting/draft-base.scad>;
draft_layers_show = ["default", "sheet", "titleblock", "table", "note", "dim"];
//draft_layers_show = ["default", "dim"];
//draft_layers_show = ["default"];
(
[ // override defaults
["line-use-hull", false],
["dim-offset", length(3)],
["dim-leader-length", length(3)],
["dim-line-distance", length(3)],
["dim-line-extension-length", length(5)]
],
);
draft_sheet(grid=0);
(
[
[[-1, 1]], [[1, 1]], [[-1,-1]], [[1, -1]],
[[0, 1/2], ["H","4"]], [[1, 0], ["H","1"]]
]
)
{
draft_ruler(order=[1,-1], label_hide=true);
draft_ruler(order=-1, label_hide=true);
(
text=
[
["SPROCKET", "LOWER REAR SECTION, ASSEMBLY 2 OF 3"],
"02/22/2019", "RAS", "X1234567890", "1", "",
["ABS", "BLACK"], "STANDARD", "RAS", "SAR",
"3 COPIES REQUIRED", "APPROX. 30 MINUTE BUILD TIME",
["UNLESS STATED OTHERWISE ALL", "DIMS ARE +/- 0.25", "ANGLES +/- 1", "REMOVE ALL BURRS"]
],
zp=[1,-1], number=false
);
(
map=
[
[ "title", [ "REVISIONS", 3/2 ] ],
[ "heads", [ ["DATE", "REV", "REF", "AUTH"], 3/4 ] ],
[ "cols", [ 3, 2, 2, 2 ] ],
[ "rows", [ [ ["01-01-19", "R0", "X0", "RAS"], 1 ],
[ ["01-14-19", "R1", "X1", "RAS"], 1 ],
[ ["01-21-19", "R2", "X2", "RAS"], 1 ]
]
]
],
zp=[-1,-1]
);
(
head="NOTE:",
note=["INSTALL SPROCKET", "BEFORE HUB-S32", "SEE: X1234567891"],
size=[7, 2, 3/4],
zp=[-1/2,0]
);
}
t1 = 12;
r1 = length(50);
r2 = length(25);
o1 = length(2);
r3 = length(10);
a1 = 47.5;
t2 = 5;
o2 = length(32);
r4 = length(4);
function bev(p, a, o, r) = [p, p+r*[cos(a+o), sin(a+o)], p+r*[cos(a-o), sin(a-o)]];
draft_move ( [ [[1, -1/2], ["E","3"]] ] )
union()
{
difference()
{
circle(r=r1);
circle(r=r2);
for (i=[0:360/t1:360])
{
p1 = (r1-o1)*[cos(i), sin(i)];
p2 = (r1-o1-r3)*[cos(i), sin(i)];
translate(p1) circle(r=r3);
polygon(bev(p2, angle_ll(x_axis2d_uv, p2), a1, r3*2));
}
for (i=[0:360/t2:360])
translate(o2*[cos(i), sin(i)])
circle(r=r4);
}
color("black")
{
draft_in_layers(["dim"])
{
draft_arc(r=r1, s=2, v1=360/t1*2.25, v2=360/t1*0.25);
draft_arc(r=r1-o1, s=2, v1=360/t1*8, v2=360/t1*5);
draft_arc(r=o2, s=2, fn=72);
draft_arc(o=[o1-r1, 0], r=r3, s=2, fn=72);
}
draft_dim_center(o=[o1-r1, 0], r=r3, v=45);
draft_dim_radius(r=r1, v=360/t1*1);
draft_dim_radius(r=r1-o1, v=360/t1*7);
draft_dim_radius(r=o2, v=360/t2*4.5, u="in");
draft_dim_radius(o=[o1-r1, 0], r=r3, v=0, d=true, off=0);
draft_dim_angle(r=r1*(1+1/8), v1 = 360/t2*(t2-1));
bt = bev([0, r1-o1-r3], 90, a1, r3);
b1 = first(bt); b2 = second(bt); b3 = third(bt);
draft_dim_angle(o=b1, r=r3*2, v1=[b1, b3], v2=[b1, b2], e=1+1/10);
draft_dim_line(p1=[0,r1-o1-r3], d=r1*1.4, e=[r1*1.35, r1/4], u="mm");
draft_dim_leader(p=[o2,0], l1=10, v2=0, l2=15, ts=[2,1.5], t=[str("D ", r4), str("X ", t2)]);
}
}
// end_include
x_axis2d_uv
<vector-2d> The unit vector of the positive x-axis in 2d Euclidean space.
Definition: constants.scad:410
function angle_ll(l1, l2, s=true)
Compute the angle between two lines or vectors in a 3d or 2d-space.
function third(v)
Return the third element of an iterable value.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
module draft_in_layers(layers=_draft_get_config("layers-default"))
Assign one or more layers to child objects.
Definition: operation.scad:209
module draft_sheet(sheet, frame, zone, grid, origin, check=false, layers=_draft_get_config("layers-sheet"))
Construct a drafting sheet with frame, zone, grid, and origin.
Definition: operation.scad:383
module draft_dim_radius(o=origin2d, p, r=1, v, t, u, d=false, w=_draft_get_config("dim-radius-weight"), s=_draft_get_config("dim-radius-style"), a=_draft_get_config("dim-radius-arrow"), a1, a2, off=_draft_get_config("dim-offset"), ts=_draft_get_config("dim-text-size"), tp=_draft_get_config("dim-text-place"), rm=_draft_get_config("dim-round-mode"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), layers=_draft_get_config("layers-dim"))
Construct a radial dimension line.
Definition: dimension.scad:662
module draft_dim_line(p1=origin2d, p2=origin2d, v1, v2, t, u, d=_draft_get_config("dim-line-distance"), e=_draft_get_config("dim-line-extension-length"), es=_draft_get_config("dim-line-extension-style"), w=_draft_get_config("dim-line-weight"), s=_draft_get_config("dim-line-style"), a=_draft_get_config("dim-line-arrow"), a1, a2, off=_draft_get_config("dim-offset"), ts=_draft_get_config("dim-text-size"), tp=_draft_get_config("dim-text-place"), rm=_draft_get_config("dim-round-mode"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), layers=_draft_get_config("layers-dim"))
Construct a dimension line between two points.
Definition: dimension.scad:428
module draft_table(map, fmap, zp=0, window=false, layers=_draft_get_config("layers-table"))
Construct a text table that is populated by rows and columns.
Definition: operation.scad:866
draft_table_format_map_ccc
<map> Table format map; centered, centered, centered –justified.
Definition: config.scad:1372
module draft_dim_angle(o=origin2d, r=1, v1, v2, fn, cw=false, t, u, e=_draft_get_config("dim-angle-extension-ratio"), es=_draft_get_config("dim-angle-extension-style"), w=_draft_get_config("dim-angle-weight"), s=_draft_get_config("dim-angle-style"), a=_draft_get_config("dim-angle-arrow"), a1, a2, off=_draft_get_config("dim-offset"), ts=_draft_get_config("dim-text-size"), tp=_draft_get_config("dim-text-place"), rm=_draft_get_config("dim-round-mode"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), layers=_draft_get_config("layers-dim"))
Construct a angular dimension arc.
Definition: dimension.scad:888
module draft_ruler(units=length_unit_base, marks=10, groups=5, mark_size=1, group_height=5, label_scale=2/3, label_hide=false, order=1, w=1, layers=_draft_get_config("layers-sheet"))
Construct a drafting sheet ruler.
Definition: operation.scad:746
module draft_dim_center(o=origin2d, r, v=0, l=_draft_get_config("dim-center-length"), e, es=_draft_get_config("dim-center-extension-style"), w=_draft_get_config("dim-center-weight"), s=_draft_get_config("dim-center-style"), layers=_draft_get_config("layers-dim"))
Construct a center mark dimension cross.
module draft_title_block(text, map=draft_title_block_map_style1, zp=0, number=false, window=false, layers=_draft_get_config("layers-titleblock"))
Construct a sheet title block.
module draft_arc(r=1, o=origin2d, v1=x_axis2d_uv, v2=x_axis2d_uv, fn, cw=true, w=1, s=1, a1=0, a2=0)
Draft an arc with configurable style and optional arrowheads.
module draft_note(head, note, size, line, halign="left", cmh=_draft_get_config("note-cmh"), cmv=_draft_get_config("note-cmv"), zp=0, window=false, layers=_draft_get_config("layers-note"))
Construct a text note with optional heading and border.
module draft_dim_leader(p=origin2d, v1=30, l1=_draft_get_config("dim-leader-length"), v2, l2, h, t, ts, tp, tr, ta="center", line, w=_draft_get_config("dim-leader-weight"), s=_draft_get_config("dim-leader-style"), a=_draft_get_config("dim-leader-arrow"), off=_draft_get_config("dim-offset"), cmh=_draft_get_config("dim-cmh"), cmv=_draft_get_config("dim-cmv"), window=false, layers=_draft_get_config("layers-dim"))
Construct a dimension leader line at a point.
Definition: dimension.scad:251
draft_sheet_size
<string> Drafting sheet size identifier.
Definition: config.scad:376
length_unit_default
Definition: length.scad:988
length_unit_base
Definition: length.scad:982

Function and/or Module Documentation

◆ draft_line_pp()

module draft_line_pp ( ,
,
= 1 
)

Draft a simple line from an initial to a terminal point.

Parameters
i<point-2d> The initial point coordinate [x, y].
t<point-2d> The terminal point coordinate [x, y].
w<decimal> The line weight.

$draft_line_fn sets arc fragment number for line construction.

see: draft_config_map
line-width-min
line-use-hull

Definition at line 950 of file primitive.scad.

+ Here is the caller graph for this function:

◆ draft_arrow()

module draft_arrow ( = x_axis2d_ul,
= 1,
= 1 
)

Draft an arrowhead at the terminal point of a line.

Parameters
l<line> A line or vector.
w<decimal> The line segment weight.
s<integer | integer-list-5> The arrowhead style.

The style can be customize via the following optional parameter list fields.

field data type default description
0 integer 0 style
1 integer | boolean 0,1 or true,false fill
2 integer 0 side: 0=both, 1=left, 2=right
3 decimal 1 length multiplier
4 decimal 1 angle multiplier

When parameter s is assigned a single integer it sets the style and the other fields are assigned their default values.

style description
0 no arrowhead
1 closed 3-point arrowhead
2 closed 4-point arrowhead
3 open 3-point arrowhead
4 slash / cross arrowhead
5 circle arrowhead

Object example

draft_arrow

$draft_arrow_fn sets arc fragment number for arrowhead construction. The line segments are constructed by draft_line_pp().

see: draft_config_map
arrow-line-length-min
arrow-angle-min

Definition at line 1021 of file primitive.scad.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draft_line()

module draft_line ( = x_axis2d_ul,
= 1,
= 1,
a1  = 0,
a2  = 0 
)

Draft a line with configurable style and optional arrowheads.

Parameters
l<line> A line or vector.
w<decimal> The line weight.
s<integer | integer-list> The line style.
a1<integer | integer-list-5> The arrowhead style at initial point.
a2<integer | integer-list-5> The arrowhead style at terminal point.

When parameter s is assigned a single integer it sets the style with its default optional values. The line style s can be one of the following:

style description
0 no line
1 solid line
2 single dash pattern centered
3 dual overlapped dash patterns
4 both ends and center
5 line section break

Each style can be customize via optional parameter list fields. The options differ by style:

style 2

field data type default description
1 decimal 1 length multiplier
2 decimal 2 stride

style 3

field data type default description
1 decimal 1 length multiplier 1
2 decimal 2 stride 1
3 decimal 2 length multiplier 2
4 decimal 3 stride 2

style 4

field data type default description
1 decimal 1 number of centered segments
2 decimal 1 centered-length multiplier
3 decimal 1 end-length multiplier

style 5

field data type default description
1 decimal 1 number of breaks
2 decimal 2 break length multiplier
3 decimal 2 break width multiplier
4 decimal 67.5 break angle

Object example

draft_line

The line segments are constructed by draft_line_pp().

see: draft_config_map
line-segment-min

Definition at line 1195 of file primitive.scad.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draft_arc()

module draft_arc ( = 1,
= origin2d,
v1  = x_axis2d_uv,
v2  = x_axis2d_uv,
fn  ,
cw  = true,
= 1,
= 1,
a1  = 0,
a2  = 0 
)

Draft an arc with configurable style and optional arrowheads.

Parameters
r<decimal> The arc radius.
o<point-2d> The arc center coordinate [x, y].
v1<line-2d | decimal> The arc start angle. A 2d line, vector, or decimal angle 1.
v2<line-2d | decimal> The arc end angle. A 2d line, vector, or decimal angle 2.
fn<integer> The number of facets (optional).
cw<boolean> Sweep direction. When true the arc sweeps clockwise from the head of v1 to the head of v2; when false it sweeps counter-clockwise. The returned list always contains fn + 1 points (both endpoints included).
Returns
<points-2d> A list of coordinates points [[x, y], ...].

The arc coordinates will have radius r centered about o contained within the heads of vectors v1 and v2. The arc will start at the point coincident to v1 and will end at the point coincident to v2. When vectors v1 and v2 are parallel, or when the positive sweep angle is within the almost_eq_nv() tolerance of zero (nearly parallel), the sweep angle is forced to 360° and a full circle is returned. When fn is undefined, its value is determined by get_fn().

Note
To round a polygon corner with a tangent arc whose center is derived automatically from the corner geometry, use polygon_arc_fillet_p(). These coordinates will be used to draft an arc according to the following additional parameters.
Parameters
w<decimal> The line weight.
s<integer | integer-list> The line style.
a1<integer | integer-list-5> The arrowhead style at initial point.
a2<integer | integer-list-5> The arrowhead style at terminal point.

When parameter s is assigned a single integer it sets the style with its default optional values. The line style s can be one of the following:

style description
0 no line
1 solid line
2 single dash pattern

Style 2 can be customize via optional parameter as shown below:

style 2

field data type default description
1 decimal 2 stride

Object example

draft_arc

The line segments are constructed by draft_line_pp().

Definition at line 1337 of file primitive.scad.

+ Here is the call graph for this function:

◆ draft_rectangle()

module draft_rectangle ( = 1,
= origin2d,
= 1,
= 1 
)

Draft a rectangle with configurable style.

Parameters
d<decimal-list-2 | decimal> A list [x, y] of decimals or a single decimal for (x=y).
o<point-2d> The center coordinate [x, y].
w<decimal> The line weight.
s<integer | integer-list> The line style.

Object example

draft_rectangle

The line segments are constructed by draft_line().

Definition at line 1399 of file primitive.scad.

+ Here is the call graph for this function:

◆ draft_polygon()

module draft_polygon ( ,
,
,
= true,
= 1,
= 1 
)

Draft a polygon with configurable style.

Parameters
c<points-2d> A list of 2d coordinate points.
p<integer-list-list> A list of paths that enclose the shape where each face is a list of coordinate indexes.
e<integer-list-2-list> A list of edges where each edge is a list of two coordinate indexes.
i<index> An index sequence specification.
w<decimal> The line weight.
s<integer | integer-list> The line style.

Parameter p is optional and when it is not given, the listed order of the coordinates establishes the polygon path. When parameter e is not specified, it is computed from p using polytope_faces2edges(). Parameter i allows coordinate indexes to be selected using several selection schemes.

Object example

draft_polygon

The line segments are constructed by draft_line().

Definition at line 1457 of file primitive.scad.

+ Here is the call graph for this function:

◆ draft_in_layers()

module draft_in_layers ( layers  = _draft_get_config("layers-default"))

Assign one or more layers to child objects.

Parameters
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "default"; the general-purpose layer. See draft_layers_show and the layer conventions.

All children will be assigned the specified layer or layers and will be subsequently shown only when one of these layers are active as indicated by draft_layers_show.

Definition at line 208 of file operation.scad.

◆ draft_move()

module draft_move ( list  )

Move one or more child objects to a sheet reference zone.

Parameters
list<datastruct-list> A list of alignment references, zones, and child object indexes.

Each list element specifies the placement of one child object and has the form:

  <datastruct> = [ 0:<alignment-point>, 1:<zone-reference>, 2:<child-index> ]
field data type default description
0 decimal-list-2 [0, 0] alignment point [px, py]
1 string-list-2 | decimal-list-2 sheet center zone: [rx,ry]=string or [ix,iy]=int
2 integer loop index child object index

The alignment point [px, py] linearly scales the position within the target zone: -1 = left/bottom edge, 0 = center/middle, +1 = right/top edge.

The zone reference field accepts either string labels (e.g. ["H","4"]) that match the zone label identifiers configured in draft_sheet_config, or integer indexes (e.g. [7,3]) that address zones by their numeric position. When field 1 is omitted, the object is placed at the sheet center.

When field 2 is omitted, child i is mapped to list entry i in document order. When the list is longer than the number of children, the last child is reused for surplus entries.

Example:

(
[
[[-1, 1]], // child 0 to sheet top-left
[[ 1, -1]], // child 1 to sheet bottom-right
[[ 0, 0], ["H","4"]], // child 2 to center of zone H4
[[ 0, 0], [3, 1], 0] // child 0 again to center of zone [3,1]
]
)
{ ... }

Object example

draft_move

Definition at line 281 of file operation.scad.

+ Here is the call graph for this function:

◆ draft_sheet()

module draft_sheet ( sheet  ,
frame  ,
zone  ,
grid  ,
origin  ,
check  = false,
layers  = _draft_get_config("layers-sheet") 
)

Construct a drafting sheet with frame, zone, grid, and origin.

Parameters
sheet<value-list-2> A sheet line configuration that overrides sheet line <width, style>.
frame<value-list-2> A frame line configuration that overrides frame line <width, style>.
zone<value-list-2> A zone line configuration that overrides zone line <width, style>.
grid<value-list-2> A grid line configuration that overrides grid line <width, style>.
origin<value-list-4> An origin line configuration that overrides origin line <width, style, length, arrow>.
check<boolean> When true, validates the current sheet configuration and size tables and prints a diagnostic report to the console via table_check(). No geometry is affected. Useful during design setup to confirm that draft_sheet_config and draft_sheet_size are pointing to recognized entries.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "sheet"; rendered with sheet frame and rulers. See draft_layers_show and the layer conventions.

When a parameter is not specified, the default value is used for the current sheet configuration. The sheet configuration defaults are set by draft_sheet_config.

The parameters sheet, frame, zone, and grid each accept a list of two values. The first value sets the construction line width and the second sets the construction line style; <width, style>. The style value may also be a list to configure the details of the style as documented in draft_line(). The parameter origin accepts a list of four values: <width, style, length, arrow>. The style may be any of those available in draft_line() and the arrow may be any available in draft_arrow().

Object example

draft_sheet

Definition at line 382 of file operation.scad.

◆ draft_axes()

module draft_axes ( size  ,
= 1,
= 2,
= 0,
ts  = 0,
layers  = _draft_get_config("layers-sheet") 
)

Construct drafting sheet axes.

Parameters
size<decimal-list-2-list-2 | decimal-list-2 | decimal> An optional list [[-x, +x], [-y, +y]] or [-x/y, +x/y] of decimals or a single decimal for (-+x=-+y). The x and y negative and positive axes lengths.
w<decimal-list-2 | decimal> A list [-w, +w] or a single decimal for (-w=+w). The negative and positive axes segment weights.
s<integer-list-2-list | integer-list-2 | integer> A list [-[s], +[s]] or [-s, +s] of integers or a single integer for (-s=+s). The negative and positive axes styles.
a<integer-list-2-list | integer-list-2 | integer> A list [-[a], +[a]] or [-a, +a] of integers or a single integer for (-a=+a). The negative and positive axes arrows.
ts<decimal> The axes label text size.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "sheet"; rendered with sheet frame and rulers. See draft_layers_show and the layer conventions.

Object example

draft_axes

When size is not specified, the axes will span the entire sheet frame.

Definition at line 615 of file operation.scad.

◆ draft_ruler()

module draft_ruler ( units  = length_unit_base,
marks  = 10,
groups  = 5,
mark_size  = 1,
group_height  = 5,
label_scale  = 2/3,
label_hide  = false,
order  = 1,
= 1,
layers  = _draft_get_config("layers-sheet") 
)

Construct a drafting sheet ruler.

Parameters
units<string> The ruler units.
marks<integer> The number of unit marks per group.
groups<integer> The number of groups.
mark_size<decimal> The distance between unit marks (in units).
group_height<decimal> The group-line mark height.
label_scale<decimal> The text label size scaler.
label_hide<boolean> Hide ruler text label.
order<integer-list-2 | integer> The ruler marks horizontal and vertical direction. A list [x, y] of decimals or a single decimal for (x=y).
w<decimal> The line segment weight.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "sheet"; rendered with sheet frame and rulers. See draft_layers_show and the layer conventions.

Object example

draft_ruler

Definition at line 745 of file operation.scad.

◆ draft_table()

module draft_table ( map  ,
fmap  ,
zp  = 0,
window  = false,
layers  = _draft_get_config("layers-table") 
)

Construct a text table that is populated by rows and columns.

Parameters
map<map> A table definition map.
fmap<map> A table format map.
zp<integer-list-2 | integer> The center coordinate scaler. A list [zpx, zpy] of decimals or a single decimal for (zpx=zpy).
window<boolean> Return table window rectangle.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "table"; rendered with tables. See draft_layers_show and the layer conventions.

Object example

draft_table
see: draft_config_map
table-text-format

Definition at line 865 of file operation.scad.

◆ draft_ztable()

module draft_ztable ( text  ,
map  ,
zp  = 0,
number  = false,
window  = false,
layers  = _draft_get_config("layers-table") 
)

Construct a text table that is populated by predefined zones.

Parameters
text<value-list> The list of zone values, where each value is <string | string-list>, a single or multi-line string for the corresponding zone.
map<map> A zone table definition map.
zp<integer-list-2 | integer> The center coordinate scaler. A list [zpx, zpy] of decimals or a single decimal for (zpx=zpy).
number<boolean> Number the defined table zones.
window<boolean> Return table window rectangle.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "table"; rendered with tables. See draft_layers_show and the layer conventions.

Object example

draft_ztable

Definition at line 1026 of file operation.scad.

◆ draft_note()

module draft_note ( head  ,
note  ,
size  ,
line  ,
halign  = "left",
cmh  = _draft_get_config("note-cmh"),
cmv  = _draft_get_config("note-cmv"),
zp  = 0,
window  = false,
layers  = _draft_get_config("layers-note") 
)

Construct a text note with optional heading and border.

Parameters
head<string> The optional note heading.
note<string | string-list> A single or multi-line note text string.
size<decimal-list-3> A list of decimals that define the <width, line-height, heading-height> of the note.
line<value-list-2> The border line configuration override that sets the line construction width and style; <width, style>.
halign<string> The text horizontal alignment. One of the predefined strings: < "left" | "center" | "right" >.
cmh<decimal> The horizontal width minimum unit cell size.
cmv<decimal> The vertical height minimum unit cell size.
zp<integer-list-2 | integer> The center coordinate scaler. A list [zpx, zpy] of decimals or a single decimal for (zpx=zpy).
window<boolean> Return table window rectangle.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "note"; rendered with text notes. See draft_layers_show and the layer conventions.

The border line style value may be configured as documented in draft_line().

Object example

draft_note

Definition at line 1191 of file operation.scad.

◆ draft_title_block()

module draft_title_block ( text  ,
map  = draft_title_block_map_style1,
zp  = 0,
number  = false,
window  = false,
layers  = _draft_get_config("layers-titleblock") 
)

Construct a sheet title block.

Parameters
text<value-list> The list of zone values, where each value is <string | string-list>, a single or multi-line string for the corresponding zone.
map<map> A zone table definition map.
zp<integer-list-2 | integer> The center coordinate scaler. A list [zpx, zpy] of decimals or a single decimal for (zpx=zpy).
number<boolean> Number the defined table zones.
window<boolean> Return table window rectangle.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "table"; rendered with tables. See draft_layers_show and the layer conventions.

Object example

draft_ztable

A title block is a ztable with a predetermined layout specified by a style map.

See also
draft_title_block_map_style1.

Definition at line 1255 of file operation.scad.

◆ draft_dim_leader()

module draft_dim_leader ( = origin2d,
v1  = 30,
l1  = _draft_get_config("dim-leader-length"),
v2  ,
l2  ,
,
,
ts  ,
tp  ,
tr  ,
ta  = "center",
line  ,
= _draft_get_config("dim-leader-weight"),
= _draft_get_config("dim-leader-style"),
= _draft_get_config("dim-leader-arrow"),
off  = _draft_get_config("dim-offset"),
cmh  = _draft_get_config("dim-cmh"),
cmv  = _draft_get_config("dim-cmv"),
window  = false,
layers  = _draft_get_config("layers-dim") 
)

Construct a dimension leader line at a point.

Parameters
p<point-2d> The leader line point.
v1<line-2d | decimal> The leader line 1 angle. A 2d line, vector, or decimal angle.
l1<decimal> The leader line 1 length.
v2<line-2d | decimal> The leader line 2 angle. A 2d line, vector, or decimal angle.
l2<decimal> The leader line 2 length.
h<string> An optional text heading.
t<string | string-list> A single or multi-line text string.
ts<decimal-list-3> The text size specification <width, line-height, heading-height>. Sets the note box cell size in units of cmh / cmv. Passed directly to draft_note() as its size parameter.
tp<integer-list-2> The text alignment point. A list [tpx, tpy] of decimals. Requires tr.
tr<decimal> The text rotation angle.
ta<string> The text horizontal alignment. One of: < "left" | "center" | "right" >.
line<value-list-2> The note box border line configuration; <width, style>. Consistent with the line parameter of draft_note(). When not specified, the defaults dim-leader-box-weight and dim-leader-box-style from draft_config_map are used.
w<decimal> The line weight.
s<integer | integer-list> The line style.
a<integer | integer-list-5> The arrowhead style. A single integer selects the style; a list of up to 5 fields customizes fill, side, length, and angle — see the field table in arrow.
off<decimal> The leader point offset.
cmh<decimal> The horizontal width minimum unit cell size.
cmv<decimal> The vertical height minimum unit cell size.
window<boolean> Return text window rectangle.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "dim"; rendered with dimension annotations. See draft_layers_show and the layer conventions.

Object example

draft_dim_leader

Definition at line 250 of file dimension.scad.

◆ draft_dim_line()

module draft_dim_line ( p1  = origin2d,
p2  = origin2d,
v1  ,
v2  ,
,
,
= _draft_get_config("dim-line-distance"),
= _draft_get_config("dim-line-extension-length"),
es  = _draft_get_config("dim-line-extension-style"),
= _draft_get_config("dim-line-weight"),
= _draft_get_config("dim-line-style"),
= _draft_get_config("dim-line-arrow"),
a1  ,
a2  ,
off  = _draft_get_config("dim-offset"),
ts  = _draft_get_config("dim-text-size"),
tp  = _draft_get_config("dim-text-place"),
rm  = _draft_get_config("dim-round-mode"),
cmh  = _draft_get_config("dim-cmh"),
cmv  = _draft_get_config("dim-cmv"),
layers  = _draft_get_config("layers-dim") 
)

Construct a dimension line between two points.

Parameters
p1<point-2d> The dimension point 1.
p2<point-2d> The dimension point 2.
v1<line-2d | decimal> The point 1 extension line vector. A 2d line, vector, or decimal angle.
v2<line-2d | decimal> The point 2 extension line vector. A 2d line, vector, or decimal angle.
t<string | string-list> A single or multi-line text string that overrides the measured distance.
u<string> The units for the measured distance. One of the predefined in Length Units.
d<decimal | decimal-list-2> The minimum distance between the reference point and the start of the extension line. A list [d1, d2] of decimals or a single decimal for (d1=d2). When d1 ≠ d2 the extension lines begin at independent distances from their respective reference points; both arrowheads are then projected onto the dimension line of the farther endpoint so that the dimension line remains straight.
e<decimal | decimal-list-2> The length of the extension line. A list [e1, e2] of decimals or a single decimal for (e1=e2).
es<integer | integer-list> The extension line style.
w<decimal> The line weight.
s<integer | integer-list> The line style.
a<integer | integer-list-5> The arrowhead style applied to both ends. A single integer selects the style; a list of up to 5 fields customises fill, side, length, and angle; see the field table in arrow.
a1<integer | integer-list-5> The arrowhead 1 override; when set, takes precedence over a for endpoint 1. See the field table in arrow.
a2<integer | integer-list-5> The arrowhead 2 override; when set, takes precedence over a for endpoint 2. See the field table in arrow.
off<decimal> The dimension line offset.
ts<decimal-list-3> The text size specification <width, line-height, heading-height>. Sets the note box cell size in units of cmh / cmv. Passed directly to draft_note() as its size parameter.
tp<decimal-list-2..4> The text placement point. A list [tpx, tpy] of decimals that scales the note box position along each axis (−1=left/bottom, +1=right/top). An optional 4th element tp[3] adds a rotation offset in degrees applied on top of the computed text angle.
rm<integer> The measurement rounding mode. One of: 0=none, 1=round_d, and 2=round_s.
cmh<decimal> The horizontal width minimum unit cell size.
cmv<decimal> The vertical height minimum unit cell size.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "dim"; rendered with dimension annotations. See draft_layers_show and the layer conventions.

Only one of v1 or v2 should normally be used at a time. When neither is specified, the extension line vector angle will be at a right angle to the line formed by the dimension points p1 and p2.

Object example

draft_dim_line

Definition at line 427 of file dimension.scad.

◆ draft_dim_radius()

module draft_dim_radius ( = origin2d,
,
= 1,
,
,
,
= false,
= _draft_get_config("dim-radius-weight"),
= _draft_get_config("dim-radius-style"),
= _draft_get_config("dim-radius-arrow"),
a1  ,
a2  ,
off  = _draft_get_config("dim-offset"),
ts  = _draft_get_config("dim-text-size"),
tp  = _draft_get_config("dim-text-place"),
rm  = _draft_get_config("dim-round-mode"),
cmh  = _draft_get_config("dim-cmh"),
cmv  = _draft_get_config("dim-cmv"),
layers  = _draft_get_config("layers-dim") 
)

Construct a radial dimension line.

Parameters
o<point-2d> The radius center point.
p<point-2d> A point on the radius. When p is specified, v is ignored — p takes precedence. Use either p or v, not both.
r<decimal> The radius length.
v<line-2d | decimal> The dimension line angle for radius r. A 2d line, vector, or decimal angle. Ignored when p is also specified.
t<string | string-list> A single or multi-line text string that overrides the measured length.
u<string> The units for the measured length. One of the predefined in Length Units.
d<boolean> Construct a diameter dimension line.
w<decimal> The line weight.
s<integer | integer-list> The line style.
a<integer | integer-list-5> The arrowhead style applied to both ends. A single integer selects the style; a list of up to 5 fields customizes fill, side, length, and angle; see the field table in arrow.
a1<integer | integer-list-5> The arrowhead 1 override; when set, takes precedence over a for endpoint 1. See the field table in arrow.
a2<integer | integer-list-5> The arrowhead 2 override; when set, takes precedence over a for endpoint 2. See the field table in arrow.
off<decimal | decimal-list-2> The dimension line offset. A list [o1, o2] of decimals or a single decimal for (o1=o2).
ts<decimal-list-3> The text size specification <width, line-height, heading-height>. Sets the note box cell size in units of cmh / cmv. Passed directly to draft_note() as its size parameter.
tp<decimal-list-2..4> The text placement point. A list [tpx, tpy] of decimals that scales the note box position along each axis (−1=left/bottom, +1=right/top). An optional 4th element tp[3] adds a rotation offset in degrees applied on top of the computed text angle.
rm<integer> The measurement rounding mode. One of: 0=none, 1=round_d, and 2=round_s.
cmh<decimal> The horizontal width minimum unit cell size.
cmv<decimal> The vertical height minimum unit cell size.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "dim"; rendered with dimension annotations. See draft_layers_show and the layer conventions.

Object example

draft_dim_radius

Definition at line 661 of file dimension.scad.

◆ draft_dim_angle()

module draft_dim_angle ( = origin2d,
= 1,
v1  ,
v2  ,
fn  ,
cw  = false,
,
,
= _draft_get_config("dim-angle-extension-ratio"),
es  = _draft_get_config("dim-angle-extension-style"),
= _draft_get_config("dim-angle-weight"),
= _draft_get_config("dim-angle-style"),
= _draft_get_config("dim-angle-arrow"),
a1  ,
a2  ,
off  = _draft_get_config("dim-offset"),
ts  = _draft_get_config("dim-text-size"),
tp  = _draft_get_config("dim-text-place"),
rm  = _draft_get_config("dim-round-mode"),
cmh  = _draft_get_config("dim-cmh"),
cmv  = _draft_get_config("dim-cmv"),
layers  = _draft_get_config("layers-dim") 
)

Construct a angular dimension arc.

Parameters
o<point-2d> The arc center point.
r<decimal> The arc radius length.
v1<line-2d | decimal> The arc initial angle. A 2d line, vector, or decimal angle.
v2<line-2d | decimal> The arc terminal angle. A 2d line, vector, or decimal angle.
fn<integer> The number of facets.
cw<boolean> Sweep clockwise along arc from the head of vector v1 to the head of vector v2 when cw = true, and counter clockwise when cw = false.
t<string | string-list> A single or multi-line text string that overrides the measured angle.
u<string> The units for the measured angle. One of the predefined in Angle Units.
e<decimal | decimal-list-2> The extension line to radius ratio. A list [e1, e2] of decimals or a single decimal for (e1=e2).
es<integer | integer-list> The extension line style.
w<decimal> The arc weight.
s<integer | integer-list> The arc style.
a<integer | integer-list-5> The arrowhead style applied to both ends. A single integer selects the style; a list of up to 5 fields customises fill, side, length, and angle; see the field table in arrow.
a1<integer | integer-list-5> The arrowhead 1 override; when set, takes precedence over a for endpoint 1. See the field table in arrow.
a2<integer | integer-list-5> The arrowhead 2 override; when set, takes precedence over a for endpoint 2. See the field table in arrow.
off<decimal> The dimension arc offset.
ts<decimal-list-3> The text size specification <width, line-height, heading-height>. Sets the note box cell size in units of cmh / cmv. Passed directly to draft_note() as its size parameter.
tp<decimal-list-2..4> The text placement point. A list [tpx, tpy] of decimals that scales the note box position along each axis (−1=left/bottom, +1=right/top). An optional 3rd element tp[2] offsets the text pivot angle (degrees) along the arc, and an optional 4th element tp[3] adds a rotation offset in degrees applied on top of the computed text angle.
rm<integer> The measurement rounding mode. One of: 0=none, 1=round_d, and 2=round_s.
cmh<decimal> The horizontal width minimum unit cell size.
cmv<decimal> The vertical height minimum unit cell size.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "dim"; rendered with dimension annotations. See draft_layers_show and the layer conventions.

Object example

draft_dim_angle

Definition at line 887 of file dimension.scad.

◆ draft_dim_center()

module draft_dim_center ( = origin2d,
,
= 0,
= _draft_get_config("dim-center-length"),
,
es  = _draft_get_config("dim-center-extension-style"),
= _draft_get_config("dim-center-weight"),
= _draft_get_config("dim-center-style"),
layers  = _draft_get_config("layers-dim") 
)

Construct a center mark dimension cross.

Parameters
o<point-2d> The center point.
r<decimal> A circular arc radius.
v<line-2d | decimal> The cross rotation angle. A 2d line, vector, or decimal angle.
l<decimal> The cross line length.
e<decimal | decimal-list-4> The length of the extension lines. A list [e1, e2, e3, e4] of decimals or a single decimal for (e1=e2=e3=e4).
es<integer | integer-list> The extension line style. Defaults to dim-center-extension-style from draft_config_map.
w<decimal> The line weight.
s<integer | integer-list> The line style.
layers<string-list> The list of drafting layer names to render this object on. Defaults to the "dim"; rendered with dimension annotations. See draft_layers_show and the layer conventions.

Object example

draft_dim_center

Definition at line 1072 of file dimension.scad.

Variable Documentation

◆ $draft_scale

$draft_scale = 1

<integer> Line construction drafting scale multiplier.

This is a special variable (prefixed with $) that propagates automatically through the OpenSCAD child scope. It scales line-level constructions such as line widths and arrowhead sizes.

It is distinct from draft_sheet_scale, which is a plain variable that scales sheet-level geometry but does not propagate through children. In typical use both are set to the same value:

draft_sheet_scale = 2; // scale sheet frame and zones
draft_move ( [ ... ] )
{
$draft_scale = draft_sheet_scale; // propagate to children
// ...
}
See also
draft_sheet_scale

Definition at line 129 of file config.scad.

◆ draft_sheet_scale

draft_sheet_scale = 1

<integer> Sheet construction drafting scale multiplier.

This is a plain (non-special) variable set once at design time. It scales all sheet-level constructions — frame dimensions, zone widths, title-block sizes, and table cell sizes — by the given factor. It does not propagate automatically through the OpenSCAD child scope.

Contrast with $draft_scale, which is a special variable that does propagate through children. When constructing elements that must track sheet scale dynamically (e.g., objects placed via draft_move), set $draft_scale explicitly inside the child block:

draft_move ( [ ... ] )
{
// child objects here inherit $draft_scale
}

Both variables default to 1 (no scaling).

See also
$draft_scale

Definition at line 159 of file config.scad.

◆ draft_sheet_size

draft_sheet_size = "A"

<string> Drafting sheet size identifier.

Sheet sizes

Available sizes in inches table

sheet size (id)standard (std)sheet x-dimension (sdx)sheet y-dimension (sdy)
AANSI8.511
BANSI1117
CANSI1722
DANSI2234
EANSI3444
A5ISO A5.866148.26772
A4ISO A8.2677211.6929
A3ISO A11.692916.5354
A2ISO A16.535423.3858
A1ISO A23.385833.1102
A0ISO A33.110246.811
B5ISO B6.96859.84252
B4ISO B9.8425213.937
B3ISO B13.93719.685
B2ISO B19.68527.8346
B1ISO B27.834639.3701
B0ISO B39.370155.6693
LetterOther8.511
LegalOther8.514
ExecutiveOther7.510
C5EOther6.417329.01575
Comm10Other4.133869.48819
DLEOther4.330718.66142
FolioOther8.2677212.9921
LedgerOther17.007910.9843
TabloidOther10.984317.0079

Available sizes in mm table

sheet size (id)standard (std)sheet x-dimension (sdx)sheet y-dimension (sdy)
AANSI215.9279.4
BANSI279.4431.8
CANSI431.8558.8
DANSI558.8863.6
EANSI863.61117.6
A5ISO A149210
A4ISO A210297
A3ISO A297420
A2ISO A420594
A1ISO A594841
A0ISO A8411189
B5ISO B177250
B4ISO B250354
B3ISO B354500
B2ISO B500707
B1ISO B7071000
B0ISO B10001414
LetterOther215.9279.4
LegalOther215.9355.6
ExecutiveOther190.5254
C5EOther163229
Comm10Other105241
DLEOther110220
FolioOther210330
LedgerOther432279
TabloidOther279432

Definition at line 376 of file config.scad.

◆ draft_sheet_config

draft_sheet_config = "L84TS"

<string> Drafting sheet configuration identifier.

Available configurations:

Sheet configurations table

configuration name (id)configuration description (info)
L84TSSmall sheet landscape layout with 8x4 traditional zones
P48TSSmall sheet Portrait layout with 4x8 traditional zones

Configuration keys table

keyvalue
idconfiguration name
infoconfiguration description
sllsheet landscape layout
smxsheet margin x
smysheet margin y
szmzone margin xy
zoxzone ordering x
zoyzone ordering y
zlxzone labels x
zlyzone labels y
zrfzone reference font
zfszone font scaling
slcsheet line config
flcframe line config
zlczone line config
glcgrid line config
olcorigin line and arrow config

Definition at line 596 of file config.scad.

◆ draft_layers_show

draft_layers_show = ["all"]

<string-list> List of active drafting layer names.

Controls which layers are rendered. Only modules whose layers parameter contains at least one name that also appears in this list will produce geometry.

The string "all" is a wildcard that matches every layer list, so setting this variable to ["all"] renders everything regardless of individual layer assignments.

Layer names are arbitrary strings. The library assigns the following default names by module category:

layer name category
"default" general-purpose geometry (draft_in_layers)
"sheet" sheet frame, zones, rulers, axes
"table" tables (draft_table, draft_ztable)
"note" text notes (draft_note)
"titleblock" title block (draft_title_block)
"dim" all dimension modules

Custom layer names can be used freely — pass any string as the layers argument to any module, then include that same string here to enable it.

Example — render geometry and dimensions only:

draft_layers_show = ["default", "dim"];

Example — render everything:

Example — render a custom layer alongside the sheet:

draft_layers_show = ["sheet", "mypart"];
draft_in_layers(["mypart"])
import("mypart.dxf");
See also
_draft_layers_any_active()

Definition at line 649 of file config.scad.

◆ draft_config_map_style1

draft_config_map_style1

<map> A drafting configuration map; style1.

Configuration values for drafting primitives and tools. Specific values can be overridden as shown in draft_config_map or completely new maps may assembled to implement new styles as desired.

style1 table

keyvalue
font-sheet-zone-referenceLiberation Sans
font-title-block-headingLiberation Sans
font-title-block-entryLiberation Sans
font-table-titleLiberation Sans
font-table-headingLiberation Sans
font-table-entryLiberation Sans
make-3d-height1
line-width-min0.2
line-segment-min1.25
line-use-hulltrue
arrow-line-length-min4
arrow-angle-min15
table-cmh6.35
table-cmv6.35
table-coh1
table-cov-1
table-hlines[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
table-vlines[[0, 0], [0, 0], [0, 0]]
table-text-format["", [-1, -1], [0.4, -0.9], [0, -1.2], 0, 1, ["left", "center"]]
note-cmh6.35
note-cmv6.35
dim-cmh3.175
dim-cmv3.175
dim-text-place[0, 1]
dim-text-sizeundef
dim-round-mode[1, 2]
dim-offset0.79375
dim-leader-length12.7
dim-leader-weight1
dim-leader-style1
dim-leader-arrow[2, 1]
dim-leader-box-weight1
dim-leader-box-style1
dim-line-weight1
dim-line-style1
dim-line-arrow2
dim-line-extension-style1
dim-line-extension-length6.35
dim-line-distance9.525
dim-radius-weight1
dim-radius-style1
dim-radius-arrow2
dim-angle-weight1
dim-angle-style1
dim-angle-arrow2
dim-angle-extension-style3
dim-angle-extension-ratio1
dim-center-length1.5875
dim-center-weight0.5
dim-center-style1
dim-center-extension-style3
layers-default["all", "default"]
layers-sheet["all", "sheet"]
layers-table["all", "table"]
layers-note["all", "note"]
layers-titleblock["all", "titleblock"]
layers-dim["all", "dim"]

All dimensions are in millimeters.

Definition at line 819 of file config.scad.

◆ draft_config_map

draft_config_map = draft_config_map_style1

<map> Drafting configuration defaults map.

The following examples demonstrates how to override select values of an existing configuration map.

Example:

(
[ // define value overrides first
["line-use-hull", false],
["dim-offset", length(2/64)],
["dim-leader-length", length(3/8)],
["dim-line-distance", length(3/8)],
["dim-line-extension-length", length(2/8)]
],
// start with existing style map
);

Definition at line 968 of file config.scad.

◆ draft_title_block_map_style1

draft_title_block_map_style1

<map> A title block map; style 1.

A title block is constructed using zoned tables. A new layout can be designed by defining a new map or by merging overrides to this style map. The map keys and structure depends on the implementation of the title block rendering operation.

See also
draft_title_block().
draft_ztable().

Definition at line 1221 of file config.scad.