omdl  v1.0
OpenSCAD Mechanical Design Library
config.scad
Go to the documentation of this file.
1 //! Drafting: defaults and configurations.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2019-2024,2026
6 
7  \copyright
8 
9  This file is part of [omdl] (https://github.com/royasutton/omdl),
10  an OpenSCAD mechanical design library.
11 
12  The \em omdl is free software; you can redistribute it and/or modify
13  it under the terms of the [GNU Lesser General Public License]
14  (http://www.gnu.org/licenses/lgpl.html) as published by the Free
15  Software Foundation; either version 2.1 of the License, or (at
16  your option) any later version.
17 
18  The \em omdl is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with the \em omdl; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26  02110-1301, USA; or see <http://www.gnu.org/licenses/>.
27 
28  \details
29 
30  \amu_include (include/amu/doxyg_init_pd_gds_ip.amu)
31 *******************************************************************************/
32 
33 // sub-group begin
34 /***************************************************************************//**
35  \amu_include (include/amu/doxyg_add_to_parent_open.amu)
36 *******************************************************************************/
37 
38 // sub-group reference definitions
39 /***************************************************************************//**
40  \amu_define group_references
41  (
42  )
43 *******************************************************************************/
44 
45 // sub-group documentation and conventions
46 /***************************************************************************//**
47  /+
48  \addtogroup \amu_eval(${parent})
49  \details
50  +/
51 *******************************************************************************/
52 
53 //----------------------------------------------------------------------------//
54 // members
55 //----------------------------------------------------------------------------//
56 
57 //----------------------------------------------------------------------------//
58 // configuration: variables
59 //----------------------------------------------------------------------------//
60 
61 //! \name Configuration Variables
62 //! @{
63 
64 //! <boolean> Extrude 2D drafted constructions to 3D.
65 $draft_make_3d = false;
66 
67 //! <integer> Arc fragment size for line construction.
68 $draft_line_fn = 4;
69 
70 //! <integer> Arc fragment size for arrowhead construction.
71 $draft_arrow_fn = 8;
72 
73 //! <integer> Line construction drafting scale multiplier.
74 /***************************************************************************//**
75  \details
76 
77  This is a special variable (prefixed with \c $) that propagates
78  automatically through the OpenSCAD child scope. It scales
79  line-level constructions such as line widths and arrowhead sizes.
80 
81  It is distinct from \ref draft_sheet_scale, which is a plain
82  variable that scales sheet-level geometry but does not propagate
83  through children. In typical use both are set to the same value:
84 
85  \code{.C}
86  draft_sheet_scale = 2; // scale sheet frame and zones
87 
88  draft_move ( [ ... ] )
89  {
90  $draft_scale = draft_sheet_scale; // propagate to children
91  // ...
92  }
93  \endcode
94 
95  \sa draft_sheet_scale
96 *******************************************************************************/
98 
99 //! <integer> Sheet construction drafting scale multiplier.
100 /***************************************************************************//**
101  \details
102 
103  This is a plain (non-special) variable set once at design time.
104  It scales all sheet-level constructions — frame dimensions, zone
105  widths, title-block sizes, and table cell sizes — by the given
106  factor. It does \b not propagate automatically through the
107  OpenSCAD child scope.
108 
109  Contrast with \c $draft_scale, which is a special variable that
110  \b does propagate through children. When constructing elements
111  that must track sheet scale dynamically (e.g., objects placed via
112  \ref draft_move), set \c $draft_scale explicitly inside the child
113  block:
114 
115  \code{.C}
116  draft_move ( [ ... ] )
117  {
118  $draft_scale = draft_sheet_scale;
119  // child objects here inherit $draft_scale
120  }
121  \endcode
122 
123  Both variables default to \c 1 (no scaling).
124 
125  \sa $draft_scale
126 *******************************************************************************/
128 
129 //! <string> Drafting sheet size identifier.
130 /***************************************************************************//**
131  \details
132 
133  <b>Sheet sizes</b>
134 
135  \amu_define output_scad (false)
136  \amu_define output_console (false)
137 
138  \amu_define title (Available sizes in inches)
139  \amu_define scope_id (sheet_sizes_in)
140  \amu_include (include/amu/scope_table.amu)
141 
142  \amu_define title (Available sizes in mm)
143  \amu_define scope_id (sheet_sizes_mm)
144  \amu_include (include/amu/scope_table.amu)
145 *******************************************************************************/
146 draft_sheet_size = "A";
147 
148 //! <string> Drafting sheet configuration identifier.
149 /***************************************************************************//**
150  \details
151 
152  Available configurations:
153 
154  \amu_define title (Sheet configurations)
155  \amu_define scope_id (sheet_config)
156  \amu_define output_scad (false)
157  \amu_define output_console (false)
158 
159  \amu_include (include/amu/scope_table.amu)
160 
161  \amu_define title (Configuration keys)
162  \amu_define scope_id (sheet_config_keys)
163  \amu_define output_scad (false)
164  \amu_define output_console (false)
165 
166  \amu_include (include/amu/scope_table.amu)
167 *******************************************************************************/
168 draft_sheet_config = "L84TS";
169 
170 //! <string-list> List of active drafting layer names.
171 /***************************************************************************//**
172  \details
173 
174  Controls which layers are rendered. Only modules whose \c layers
175  parameter contains at least one name that also appears in this list
176  will produce geometry.
177 
178  The string \b "all" is a wildcard that matches every layer list,
179  so setting this variable to \c ["all"] renders everything regardless
180  of individual layer assignments.
181 
182  Layer names are arbitrary strings. The library assigns the
183  following default names by module category:
184 
185  layer name | category
186  :---------------|:---------------------------
187  \c "default" | general-purpose geometry (\ref draft_in_layers)
188  \c "sheet" | sheet frame, zones, rulers, axes
189  \c "table" | tables (\ref draft_table, \ref draft_ztable)
190  \c "note" | text notes (\ref draft_note)
191  \c "titleblock"| title block (\ref draft_title_block)
192  \c "dim" | all dimension modules
193 
194  Custom layer names can be used freely — pass any string as the
195  \c layers argument to any module, then include that same string
196  here to enable it.
197 
198  \b Example — render geometry and dimensions only:
199 
200  \code{.C}
201  draft_layers_show = ["default", "dim"];
202  \endcode
203 
204  \b Example — render everything:
205 
206  \code{.C}
207  draft_layers_show = ["all"];
208  \endcode
209 
210  \b Example — render a custom layer alongside the sheet:
211 
212  \code{.C}
213  draft_layers_show = ["sheet", "mypart"];
214 
215  draft_in_layers(["mypart"])
216  import("mypart.dxf");
217  \endcode
218 
219  \sa _draft_layers_any_active()
220 *******************************************************************************/
221 draft_layers_show = ["all"];
222 
223 //! @}
224 
225 //----------------------------------------------------------------------------//
226 // configuration: getters
227 //----------------------------------------------------------------------------//
228 
229 //! \name Configuration: Getters
230 //! @{
231 
232 //----------------------------------------------------------------------------//
233 // drafting style defaults:
234 //
235 // (1) configuration getter function
236 // (2) configuration map "style1"
237 // (3) user assignable style map variable
238 //----------------------------------------------------------------------------//
239 
240 //! Get drafting configuration default helper function.
241 /***************************************************************************//**
242  \param k <string> A map key.
243 
244  \returns <value> The value associated with key \p k in the
245  configuration map assigned to \ref draft_config_map.
246 
247  \details
248 
249  \b Example:
250 
251  \verbatim
252  layers = _draft_get_config("layers-dim");
253  dimll1 = _draft_get_config("dim-leader-length");
254  \endverbatim
255 
256  \sa draft_config_map.
257  \private
258 *******************************************************************************/
259 function _draft_get_config
260 (
261  k
263 
264 //! @}
265 
266 //----------------------------------------------------------------------------//
267 // configuration: style maps
268 //----------------------------------------------------------------------------//
269 
270 //! \name Style Maps
271 //! @{
272 
273 //! <map> A drafting configuration map; style1.
274 /***************************************************************************//**
275  \details
276 
277  Configuration values for drafting primitives and tools. Specific
278  values can be overridden as shown in \ref draft_config_map or
279  completely new maps may assembled to implement new styles as
280  desired.
281 
282  \amu_define title (style1)
283  \amu_define scope_id (draft_style1)
284  \amu_define output_scad (false)
285  \amu_define output_console (false)
286  \amu_define notes_table (All dimensions are in millimeters.)
287 
288  \amu_include (include/amu/scope_table.amu)
289 
290  \hideinitializer
291 *******************************************************************************/
293 [
294  //
295  // fonts
296  //
297 
298  ["font-sheet-zone-reference", "Liberation Sans"],
299 
300  ["font-title-block-heading", "Liberation Sans"],
301  ["font-title-block-entry", "Liberation Sans"],
302 
303  ["font-table-title", "Liberation Sans"],
304  ["font-table-heading", "Liberation Sans"],
305  ["font-table-entry", "Liberation Sans"],
306 
307  //
308  // make 3d
309  //
310 
311  ["make-3d-height", length(1, "mm")],
312 
313  //
314  // lines
315  //
316 
317  ["line-width-min", length(0.2, "mm")],
318  ["line-segment-min", length(1.25, "mm")],
319  ["line-use-hull", true],
320 
321  //
322  // arrows
323  //
324 
325  ["arrow-line-length-min", length(4.0, "mm")],
326  ["arrow-angle-min", angle(15, "d")],
327 
328  //
329  // table
330  //
331 
332  ["table-cmh", length(1/4,"in")], // horizontal width minimum
333  ["table-cmv", length(1/4,"in")], // vertical height minimum
334  ["table-coh", +1], // horizontal line ordering
335  ["table-cov", -1], // vertical line ordering
336  ["table-hlines", consts(5,[0,0])], // horizontal lines
337  ["table-vlines", consts(3,[0,0])], // vertical line
338  ["table-text-format", [empty_str, [-1,-1],
339  [2/5,-9/10], [0,-1-1/5],
340  0, 1, ["left", "center"]]],
341 
342  //
343  // note
344  //
345 
346  ["note-cmh", length(1/4,"in")],
347  ["note-cmv", length(1/4,"in")],
348 
349  //
350  // dim
351  //
352 
353  // common
354  ["dim-cmh", length(1/8,"in")],
355  ["dim-cmv", length(1/8,"in")],
356  ["dim-text-place", [0,1]],
357  ["dim-text-size", undef],
358  ["dim-round-mode", [1,2]], // [mode, digits]
359  ["dim-offset", length(1/32,"in")],
360 
361  // leader
362  ["dim-leader-length", length(1/2,"in")],
363  ["dim-leader-weight", 1],
364  ["dim-leader-style", 1],
365  ["dim-leader-arrow", [2,1]],
366  ["dim-leader-box-weight", 1],
367  ["dim-leader-box-style", 1],
368 
369  // line
370  ["dim-line-weight", 1],
371  ["dim-line-style", 1],
372  ["dim-line-arrow", 2],
373  ["dim-line-extension-style", 1],
374  ["dim-line-extension-length", length(2/8,"in")],
375  ["dim-line-distance", length(3/8,"in")],
376 
377  // radius
378  ["dim-radius-weight", 1],
379  ["dim-radius-style", 1],
380  ["dim-radius-arrow", 2],
381 
382  // angle
383  ["dim-angle-weight", 1],
384  ["dim-angle-style", 1],
385  ["dim-angle-arrow", 2],
386  ["dim-angle-extension-style", 3],
387  ["dim-angle-extension-ratio", 1],
388 
389  // center
390  ["dim-center-length", length(1/16,"in")],
391  ["dim-center-weight", 1/2],
392  ["dim-center-style", 1],
393  ["dim-center-extension-style", 3],
394 
395  //
396  // layers
397  //
398 
399  ["layers-default", ["all", "default"]],
400  ["layers-sheet", ["all", "sheet"]],
401  ["layers-table", ["all", "table"]],
402  ["layers-note", ["all", "note"]],
403  ["layers-titleblock", ["all", "titleblock"]],
404  ["layers-dim", ["all", "dim"]]
405 ];
406 
407 //! @}
408 
409 //----------------------------------------------------------------------------//
410 // configuration: variables
411 //----------------------------------------------------------------------------//
412 
413 //! \name Configuration Variables
414 //! @{
415 
416 //! <map> Drafting configuration defaults map.
417 /***************************************************************************//**
418  \details
419 
420  The following examples demonstrates how to override select values
421  of an existing configuration map.
422 
423  \b Example:
424 
425  \code{.C}
426  draft_config_map =
427  map_merge
428  (
429  [ // define value overrides first
430  ["line-use-hull", false],
431  ["dim-offset", length(2/64)],
432  ["dim-leader-length", length(3/8)],
433  ["dim-line-distance", length(3/8)],
434  ["dim-line-extension-length", length(2/8)]
435  ],
436  // start with existing style map
437  draft_config_map_style1
438  );
439  \endcode
440 *******************************************************************************/
442 
443 //! @}
444 
445 //----------------------------------------------------------------------------//
446 // configuration: getters
447 //----------------------------------------------------------------------------//
448 
449 //! \name Configuration: Getters
450 //! @{
451 
452 //----------------------------------------------------------------------------//
453 // sheet size:
454 //
455 // (1) configuration getter function
456 // (2) internal table definitions
457 //----------------------------------------------------------------------------//
458 
459 //! Get sheet size value helper function.
460 /***************************************************************************//**
461  \param ci <string> The column identifier.
462 
463  \returns <value> The value of the identified column for the
464  configured sheet size set by \ref draft_sheet_size.
465 
466  \details
467 
468  \b Example:
469 
470  \verbatim
471  std = _draft_get_sheet_size(ci="std");
472 
473  sdx = _draft_get_sheet_size(ci="sdx") * draft_sheet_scale;
474  sdy = _draft_get_sheet_size(ci="sdy") * draft_sheet_scale;
475  \endverbatim
476 
477  \sa draft_sheet_size.
478  \private
479 *******************************************************************************/
480 function _draft_get_sheet_size
481 (
482  ci
483 ) = table_get_value
484  (
485  r=draft_sheet_size_tr,
486  c=draft_sheet_size_tc,
487  ri=draft_sheet_size,
488  ci=ci
489  );
490 
491 //! <map> sheet sizes data table columns definition.
492 /***************************************************************************//**
493  \hideinitializer
494  \private
495 *******************************************************************************/
496 draft_sheet_size_tc =
497 [
498  ["id", "sheet size"],
499  ["std", "standard"],
500  ["sdx", "sheet x-dimension"],
501  ["sdy", "sheet y-dimension"]
502 ];
503 
504 //! <table> sheet sizes data table rows.
505 /***************************************************************************//**
506  \hideinitializer
507  \private
508 *******************************************************************************/
509 draft_sheet_size_tr =
510 [
511  // ANSI
512  [ "A", "ANSI", length( 8.5, "in"), length( 11, "in")],
513  [ "B", "ANSI", length( 11, "in"), length( 17, "in")],
514  [ "C", "ANSI", length( 17, "in"), length( 22, "in")],
515  [ "D", "ANSI", length( 22, "in"), length( 34, "in")],
516  [ "E", "ANSI", length( 34, "in"), length( 44, "in")],
517 
518  // ISO A
519  ["A5", "ISO A", length( 149, "mm"), length( 210, "mm")],
520  ["A4", "ISO A", length( 210, "mm"), length( 297, "mm")],
521  ["A3", "ISO A", length( 297, "mm"), length( 420, "mm")],
522  ["A2", "ISO A", length( 420, "mm"), length( 594, "mm")],
523  ["A1", "ISO A", length( 594, "mm"), length( 841, "mm")],
524  ["A0", "ISO A", length( 841, "mm"), length(1189, "mm")],
525 
526  // ISO B
527  ["B5", "ISO B", length( 177, "mm"), length( 250, "mm")],
528  ["B4", "ISO B", length( 250, "mm"), length( 354, "mm")],
529  ["B3", "ISO B", length( 354, "mm"), length( 500, "mm")],
530  ["B2", "ISO B", length( 500, "mm"), length( 707, "mm")],
531  ["B1", "ISO B", length( 707, "mm"), length(1000, "mm")],
532  ["B0", "ISO B", length(1000, "mm"), length(1414, "mm")],
533 
534  // Others
535  ["Letter", "Other", length( 215.9, "mm"), length( 279.4, "mm")],
536  ["Legal", "Other", length( 215.9, "mm"), length( 355.6, "mm")],
537  ["Executive", "Other", length( 190.5, "mm"), length( 254.0, "mm")],
538  ["C5E", "Other", length( 163.0, "mm"), length( 229.0, "mm")],
539  ["Comm10", "Other", length( 105.0, "mm"), length( 241.0, "mm")],
540  ["DLE", "Other", length( 110.0, "mm"), length( 220.0, "mm")],
541  ["Folio", "Other", length( 210.0, "mm"), length( 330.0, "mm")],
542  ["Ledger", "Other", length( 432.0, "mm"), length( 279.0, "mm")],
543  ["Tabloid", "Other", length( 279.0, "mm"), length( 432.0, "mm")]
544 ];
545 
546 //----------------------------------------------------------------------------//
547 // sheet layout configuration:
548 //
549 // (1) configuration getter function
550 // (2) internal table definitions
551 //----------------------------------------------------------------------------//
552 
553 //! Get sheet configuration value helper function.
554 /***************************************************************************//**
555  \param ci <string> The column identifier.
556 
557  \returns <value> The value of the identified column for the
558  current sheet configured by \ref draft_sheet_config.
559 
560  \details
561 
562  \b Example:
563 
564  \verbatim
565  zoy = _draft_get_sheet_config(ci="zoy")
566 
567  smx = _draft_get_sheet_config(ci="smx") * draft_sheet_scale;
568  smy = _draft_get_sheet_config(ci="smy") * draft_sheet_scale;
569  \endverbatim
570 
571  \sa draft_sheet_config.
572  \private
573 *******************************************************************************/
574 function _draft_get_sheet_config
575 (
576  ci
577 ) = table_get_value
578  (
579  r=draft_sheet_config_tr,
580  c=draft_sheet_config_tc,
582  ci=ci
583  );
584 
585 //! <map> Sheet configuration data table columns definition.
586 /***************************************************************************//**
587  \hideinitializer
588  \private
589 *******************************************************************************/
590 draft_sheet_config_tc =
591 [
592  ["id", "configuration name"],
593  ["info", "configuration description"],
594 
595  // sheet layout
596  ["sll", "sheet landscape layout"],
597  ["smx", "sheet margin x"],
598  ["smy", "sheet margin y"],
599  ["szm", "zone margin xy"],
600 
601  // zone reference
602  ["zox", "zone ordering x"],
603  ["zoy", "zone ordering y"],
604  ["zlx", "zone labels x"],
605  ["zly", "zone labels y"],
606  ["zrf", "zone reference font"],
607  ["zfs", "zone font scaling"],
608 
609  // lines [ weight, {style | [style]} ]
610  ["slc", "sheet line config"],
611  ["flc", "frame line config"],
612  ["zlc", "zone line config"],
613  ["glc", "grid line config"],
614  ["olc", "origin line and arrow config"]
615 ];
616 
617 //! <table> Sheet configuration data table rows.
618 /***************************************************************************//**
619  \hideinitializer
620  \private
621 *******************************************************************************/
622 draft_sheet_config_tr =
623 [
624  [
625  "L84TS",
626  "Small sheet landscape layout with 8x4 traditional zones",
627 
628  true,
629  length(3/4, "in"),
630  length(1/2, "in"),
631  length(3/16, "in"),
632 
633  -1,
634  +1,
635  ["A", "B", "C", "D", "E", "F", "G", "H"],
636  ["1", "2", "3", "4"],
637  _draft_get_config("font-sheet-zone-reference"),
638  5/8,
639 
640  [1,[4,3,2,5]],
641  8,
642  4,
643  [1/2,3],
644  [3,1,13/8, [1,1,0,1,3]]
645  ],
646 
647  [
648  "P48TS",
649  "Small sheet Portrait layout with 4x8 traditional zones",
650 
651  false,
652  length(1/2, "in"),
653  length(3/4, "in"),
654  length(3/16, "in"),
655 
656  -1,
657  +1,
658  ["A", "B", "C", "D"],
659  ["1", "2", "3", "4", "5", "6", "7", "8"],
660  _draft_get_config("font-sheet-zone-reference"),
661  5/8,
662 
663  [1,[4,3,2,5]],
664  8,
665  4,
666  [1/2,3],
667  [3,1,13/8, [1,1,0,1,3]]
668  ]
669 ];
670 
671 //! @}
672 
673 //----------------------------------------------------------------------------//
674 // configuration: style maps
675 //----------------------------------------------------------------------------//
676 
677 //! \name Style Maps
678 //! @{
679 
680 //! <map> A title block map; style 1.
681 /***************************************************************************//**
682  \details
683 
684  A title block is constructed using \ref draft_ztable "zoned tables".
685  A new layout can be designed by defining a new map or by merging
686  overrides to this style map. The map keys and structure depends on
687  the implementation of the \ref draft_title_block "title block"
688  rendering operation.
689 
690  \sa draft_title_block().
691  \sa draft_ztable().
692  \hideinitializer
693 *******************************************************************************/
695 [
696  // table cell horizontal width minimum
697  [ "cmh", length(3/8, "in") ],
698 
699  // table cell vertical height minimum
700  [ "cmv", length(3/8, "in") ],
701 
702  // table cell horizontal line ordering
703  [ "coh", -1 ],
704 
705  // table cell vertical line ordering
706  [ "cov", +1 ],
707 
708  // table horizontal lines
709  // height-factor, [vl-start, vl-end], line-weight, line-style
710  [ "hlines",
711  [
712  [0, [0, 11], 3, 1],
713  [3/2, [0, 11], 3, 1],
714  [1, [1, 8], 1, 1],
715  [1/2, [0, 1], 1, 1],
716  [1/2, [1, 11], 1, 1],
717  [1/2, [0, 1], 1, 1],
718  [1/2, [1, 6], 1, 1],
719  [1, [0, 11], 3, 1]
720  ]
721  ],
722 
723  // table vertical lines
724  // width-factor, [hl-start, hl-end], line-weight, line-style
725  [ "vlines",
726  [
727  [0, [0, 7], 3, 1],
728  [4, [1, 7], 1, 1],
729  [1, [0, 1], 1, 1],
730  [1, [0, 1], 1, 1],
731  [1, [1, 4], 1, 1],
732  [3, [1, 4], 1, 1],
733  [3/4, [4, 7], 1, 1],
734  [2, [1, 4], 1, 1],
735  [1, [1, 4], 1, 1],
736  [1, [1, 4], 1, 1],
737  [1/2, [0, 1], 1, 1],
738  [2, [0, 7], 3, 1]
739  ]
740  ],
741 
742  /*
743  text configuration format:
744 
745  [
746  0:"text", 1:<align-point>, 2:<align-offset>, 3:<mline-offset>,
747  4:rotate, 5:text-scale, 6:<text-align>, 7:"font",
748  8:spacing, 9:direction, 10:language, 11:script
749  ]
750 
751  <align-point> = [hl-align, vl-align]
752  <align-offset> = [h-offset, v-offset]
753  <mline-offset> = [h-offset, v-offset] // multi-line
754  <text-align> = [halign, valign]
755  */
756 
757  // zone heading text configuration defaults
758  [ "hdefs",
759  [
760  empty_str, [ 0, +1], [ 0, -1], [0, -1-4/10], 0, 1,
761  ["center", "center"], _draft_get_config("font-title-block-heading")
762  ]
763  ],
764 
765  // zone entry text configuration defaults
766  [ "edefs",
767  [
768  empty_str, [ 0, +1], [ 0, -2-1/2], [0, -1-4/10], 0, 3/2,
769  ["center", "center"], _draft_get_config("font-title-block-entry")
770  ]
771  ],
772 
773  /*
774  title block configuration format:
775 
776  [ <vl-limits>, <hl-limits>, hidden, <heading-text>, <entry-text> ]
777 
778  <vl-limits> = [vl-start, vl-end]
779  <hl-limits> = [hl-start, hl-end]
780  */
781  [ "zones",
782  [
783  [ [ 3, 10], [ 0, 1], 0, ["TITLE1"] ],
784  [ [ 5, 7], [ 1, 2], 0, ["DATE"] ],
785  [ [ 5, 7], [ 2, 4], 0, ["DRAWN BY"] ],
786  [ [ 0, 2], [ 0, 1], 0, ["DRAWING NUMBER"] ],
787  [ [ 0, 1], [ 1, 3], 0, ["SHEET"] ],
788  [ [ 9, 11], [ 1, 4], 0, ["PROJECTION"] ],
789  [ [ 0, 1], [ 5, 7], 0, ["MATERIAL"] ],
790  [ [ 0, 1], [ 3, 5], 0, ["TREATMENT"] ],
791  [ [ 4, 5], [ 2, 4], 0, ["CHECKED BY"] ],
792  [ [ 1, 4], [ 2, 4], 0, ["APPROVED BY"] ],
793  [ [ 1, 6], [ 6, 7], 0, ["NOTE1"] ],
794  [ [ 1, 6], [ 4, 6], 0, ["NOTE2"] ],
795  [ [ 6, 11], [ 4, 7], 0, ["NOTE3"] ],
796  [ [ 8, 9], [ 1, 4], 0, ["SCALE"], [str("1:", draft_sheet_scale), [0,0], [0,0]] ],
797  [ [ 7, 8], [ 2, 4], 0, ["UNITS"], [length_unit_base] ],
798  [ [ 7, 8], [ 1, 2], 0, ["SIZE"], [draft_sheet_size] ],
799  [ [10, 11], [ 0, 1], 0, ["LOGO"], ["omdl"] ]
800  ]
801  ]
802 ];
803 
804 //! <map> Table format map; common.
805 /***************************************************************************//**
806  \hideinitializer
807  \private
808 *******************************************************************************/
809 _draft_table_format_map_common =
810 [
811  [ "cmh", length(1/4, "in") ],
812  [ "cmv", length(1/4, "in") ],
813  [ "coh", +1 ],
814  [ "cov", -1 ],
815 
816  [ "hlines",
817  [
818  [2, 1], // top
819  [2, 1], // bottom
820  [2, 1], // title
821  [1, 1], // headings
822  [1/2, 1] // rows
823  ]
824  ],
825  [ "vlines",
826  [
827  [2, 1], // left
828  [2, 1], // right
829  [1/2, 1] // cols...
830  ]
831  ],
832 
833  [ "tdefs",
834  [
835  empty_str, [ 0, -1], [ 0, -1/2-4/10], [0, -1-2/10], 0, 1,
836  ["center", "center"], _draft_get_config("font-table-title")
837  ]
838  ]
839 ];
840 
841 //! <map> Table format map; centered, centered, centered --justified.
842 /***************************************************************************//**
843  \hideinitializer
844 *******************************************************************************/
846 concat
847 (
848  _draft_table_format_map_common,
849  [
850  [ "hdefs",
851  [
852  empty_str, [ 0, -1], [ 0, -1/2-3/10], [0, -1-2/10], 0, 1,
853  ["center", "center"], _draft_get_config("font-table-heading")
854  ]
855  ],
856  [ "edefs",
857  [
858  empty_str, [ 0, -1], [ 0, -1/2-4/10], [0, -1-2/10], 0, 1,
859  ["center", "center"], _draft_get_config("font-table-entry")
860  ]
861  ]
862  ]
863 );
864 
865 //! <map> Table format map; centered, left, left --justified.
866 /***************************************************************************//**
867  \hideinitializer
868 *******************************************************************************/
870 concat
871 (
872  _draft_table_format_map_common,
873  [
874  [ "hdefs",
875  [
876  empty_str, [-1, -1], [2/5, -4/5], [0, -1-1/5], 0, 1,
877  ["left", "center"], _draft_get_config("font-table-heading")
878  ]
879  ],
880  [ "edefs",
881  [
882  empty_str, [-1, -1], [2/5, -9/10], [0, -1-1/5], 0, 1,
883  ["left", "center"], _draft_get_config("font-table-entry")
884  ]
885  ]
886  ]
887 );
888 
889 //! <map> Table format map; centered, right, right --justified.
890 /***************************************************************************//**
891  \hideinitializer
892 *******************************************************************************/
894 concat
895 (
896  _draft_table_format_map_common,
897  [
898  [ "hdefs",
899  [
900  empty_str, [+1, -1], [-2/5, -4/5], [0, -1-1/5], 0, 1,
901  ["right", "center"], _draft_get_config("font-table-heading")
902  ]
903  ],
904  [ "edefs",
905  [
906  empty_str, [+1, -1], [-2/5, -9/10], [0, -1-1/5], 0, 1,
907  ["right", "center"], _draft_get_config("font-table-entry")
908  ]
909  ]
910  ]
911 );
912 
913 //! @}
914 
915 //! @}
916 
917 //----------------------------------------------------------------------------//
918 // openscad-amu auxiliary scripts
919 //----------------------------------------------------------------------------//
920 
921 /*
922 BEGIN_SCOPE draft_style1;
923  BEGIN_OPENSCAD;
924  include <omdl-base.scad>;
925  include <tools/2d/drafting/draft-base.scad>;
926  length_unit_base = "mm";
927 
928  map_write( draft_config_map_style1 );
929  END_OPENSCAD;
930 
931  BEGIN_MFSCRIPT;
932  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
933  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
934  END_MFSCRIPT;
935 END_SCOPE;
936 */
937 
938 /*
939 BEGIN_SCOPE sheet_sizes;
940  BEGIN_OPENSCAD;
941  include <omdl-base.scad>;
942  include <tools/2d/drafting/draft-base.scad>;
943  length_unit_base = "in";
944 
945  table_write( draft_sheet_size_tr, draft_sheet_size_tc, heading_text=true );
946  END_OPENSCAD;
947 
948  BEGIN_MFSCRIPT;
949  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
950 
951  defines name "units" define "length_unit_base" strings "in mm";
952  variables add_opts_combine "units";
953 
954  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
955  END_MFSCRIPT;
956 END_SCOPE;
957 */
958 
959 /*
960 BEGIN_SCOPE sheet_config;
961  BEGIN_OPENSCAD;
962  include <omdl-base.scad>;
963  include <tools/2d/drafting/draft-base.scad>;
964  length_unit_base = "mm";
965 
966  table_write ( r=draft_sheet_config_tr, c=draft_sheet_config_tc,
967  cs=["id", "info"], heading_text=true );
968  END_OPENSCAD;
969 
970  BEGIN_MFSCRIPT;
971  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
972  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
973  END_MFSCRIPT;
974 END_SCOPE;
975 */
976 
977 /*
978 BEGIN_SCOPE sheet_config_keys;
979  BEGIN_OPENSCAD;
980  include <omdl-base.scad>;
981  include <tools/2d/drafting/draft-base.scad>;
982  length_unit_base = "mm";
983 
984  map_write( draft_sheet_config_tc );
985  END_OPENSCAD;
986 
987  BEGIN_MFSCRIPT;
988  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
989  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
990  END_MFSCRIPT;
991 END_SCOPE;
992 */
993 
994 //----------------------------------------------------------------------------//
995 // end of file
996 //----------------------------------------------------------------------------//
empty_str
<string> A string with no characters (the empty string).
Definition: constants.scad:301
function consts(l, v, u=false)
Create a list of constant or incrementing elements.
function map_get_value(m, k)
Get the map value associated with a key.
function table_get_value(r, c, ri, ci)
Get the table cell value for a specified row and column identifier.
draft_table_format_map_cll
<map> Table format map; centered, left, left –justified.
Definition: config.scad:1396
draft_table_format_map_crr
<map> Table format map; centered, right, right –justified.
Definition: config.scad:1420
draft_layers_show
<string-list> List of active drafting layer names.
Definition: config.scad:649
$draft_make_3d
<boolean> Extrude 2D drafted constructions to 3D.
Definition: config.scad:97
$draft_scale
<integer> Line construction drafting scale multiplier.
Definition: config.scad:129
draft_table_format_map_ccc
<map> Table format map; centered, centered, centered –justified.
Definition: config.scad:1372
$draft_line_fn
<integer> Arc fragment size for line construction.
Definition: config.scad:100
draft_config_map
<map> Drafting configuration defaults map.
Definition: config.scad:968
draft_title_block_map_style1
<map> A title block map; style 1.
Definition: config.scad:1221
$draft_arrow_fn
<integer> Arc fragment size for arrowhead construction.
Definition: config.scad:103
draft_sheet_config
<string> Drafting sheet configuration identifier.
Definition: config.scad:596
draft_sheet_size
<string> Drafting sheet size identifier.
Definition: config.scad:376
draft_sheet_scale
<integer> Sheet construction drafting scale multiplier.
Definition: config.scad:159
draft_config_map_style1
<map> A drafting configuration map; style1.
Definition: config.scad:819
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.
length_unit_base
Definition: length.scad:982