diff --git a/src/outlines.js b/src/outlines.js index 08e2f37..6ec7164 100644 --- a/src/outlines.js +++ b/src/outlines.js @@ -135,8 +135,13 @@ const layout = exports._layout = (config = {}, points = {}, units = {}) => { if (side == 'left') return left if (side == 'right') return right + // allow opting out of gluing, when + // A) there are no glue definitions, or + // B) glue is explicitly set to false + const glue_opt_out = (!Object.keys(parsed_glue).length || params.glue === false) + let glue = {models: {}} - if (bound && ['middle', 'both', 'glue'].includes(side)) { + if (bound && ['middle', 'both', 'glue'].includes(side) && !glue_opt_out) { const default_glue_name = Object.keys(parsed_glue)[0] const computed_glue_name = a.sane(params.glue || default_glue_name, `${export_name}.glue`, 'string')() diff --git a/test/outlines/gluing.yaml b/test/outlines/gluing.yaml index cd1a898..60335d4 100644 --- a/test/outlines/gluing.yaml +++ b/test/outlines/gluing.yaml @@ -41,4 +41,10 @@ outlines: side: both bound: false size: 14 - operation: subtract \ No newline at end of file + operation: subtract + optout: + main: + type: keys + side: both + size: 20 + glue: false \ No newline at end of file diff --git a/test/outlines/gluing___outlines_optout_dxf.dxf b/test/outlines/gluing___outlines_optout_dxf.dxf new file mode 100644 index 0000000..95ab1d7 --- /dev/null +++ b/test/outlines/gluing___outlines_optout_dxf.dxf @@ -0,0 +1,146 @@ +0 +SECTION +2 +HEADER +9 +$INSUNITS +70 +4 +0 +ENDSEC +0 +SECTION +2 +TABLES +0 +TABLE +2 +LTYPE +0 +LTYPE +72 +65 +70 +64 +2 +CONTINUOUS +3 +______ +73 +0 +40 +0 +0 +ENDTAB +0 +TABLE +2 +LAYER +0 +ENDTAB +0 +ENDSEC +0 +SECTION +2 +ENTITIES +0 +LINE +8 +0 +10 +-12.8171276 +20 +-5.9767248 +11 +23.8308846 +21 +-19.3155103 +0 +LINE +8 +0 +10 +-12.8171276 +20 +-5.9767248 +11 +0.5216579 +21 +30.6712874 +0 +LINE +8 +0 +10 +0.5216579 +20 +30.6712874 +11 +37.1696701 +21 +17.3325019 +0 +LINE +8 +0 +10 +23.8308846 +20 +-19.3155103 +11 +37.1696701 +21 +17.3325019 +0 +LINE +8 +0 +10 +54.8742004 +20 +-19.3155103 +11 +91.5222126 +21 +-5.9767248 +0 +LINE +8 +0 +10 +78.1834271 +20 +30.6712874 +11 +91.5222126 +21 +-5.9767248 +0 +LINE +8 +0 +10 +41.5354149 +20 +17.3325019 +11 +78.1834271 +21 +30.6712874 +0 +LINE +8 +0 +10 +41.5354149 +20 +17.3325019 +11 +54.8742004 +21 +-19.3155103 +0 +ENDSEC +0 +EOF \ No newline at end of file