diff --git a/roadmap.md b/roadmap.md index 89ad8e4..743288a 100644 --- a/roadmap.md +++ b/roadmap.md @@ -10,11 +10,12 @@ - Merge, generalize, and uniform-ize footprints - Template for creating them, built-in variables they can use, documentation, external links, etc. - Also considering how (or, on which layer) they define their silks, universal mirroring behaviour, etc. + - https://en.wikipedia.org/wiki/Reference_designator#Designators ### Minor -- Key-level orient - 3D orient for cases +- Post-process anchor for global (post-mirror!) orient/shift/rotate for everything - Allow shift/rotate for outlines (via `anchor_def`, probably) - More generic anchors or distances? - Intersect support for anchor affects clauses, which (combined with the math formulas and possible trigonometric functions) should allow for every use case we've discussed so far diff --git a/src/points.js b/src/points.js index 396413c..c4c157f 100644 --- a/src/points.js +++ b/src/points.js @@ -91,6 +91,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key, spread: first_col ? 0 : units.$default_spread, splay: units.$default_splay, origin: [0, 0], + orient: 0, shift: [0, 0], rotate: 0, width: units.$default_width, @@ -118,6 +119,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key, key.spread = a.sane(key.spread, `${key.name}.spread`, 'number')(units) key.splay = a.sane(key.splay, `${key.name}.splay`, 'number')(units) key.origin = a.xy(key.origin, `${key.name}.origin`)(units) + key.orient = a.sane(key.orient, `${key.name}.orient`, 'number')(units) key.shift = a.xy(key.shift, `${key.name}.shift`)(units) key.rotate = a.sane(key.rotate, `${key.name}.rotate`, 'number')(units) key.width = a.sane(key.width, `${key.name}.width`, 'number')(units) @@ -151,6 +153,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key, for (const r of rotations) { point.rotate(r.angle, r.origin) } + point.r += key.orient point.shift(key.shift) point.r += key.rotate point.meta = key diff --git a/test/cli/big/reference/points/points.yaml b/test/cli/big/reference/points/points.yaml index 433c3c6..2e296a1 100644 --- a/test/cli/big/reference/points/points.yaml +++ b/test/cli/big/reference/points/points.yaml @@ -9,6 +9,7 @@ matrix_col_row: origin: - 0 - 0 + orient: 0 shift: - 0 - 0 diff --git a/test/cli/minimal/reference/points/points.yaml b/test/cli/minimal/reference/points/points.yaml index 433c3c6..2e296a1 100644 --- a/test/cli/minimal/reference/points/points.yaml +++ b/test/cli/minimal/reference/points/points.yaml @@ -9,6 +9,7 @@ matrix_col_row: origin: - 0 - 0 + orient: 0 shift: - 0 - 0 diff --git a/test/points/adjustments.yaml b/test/points/adjustments.yaml index 9aae94e..77850a8 100644 --- a/test/points/adjustments.yaml +++ b/test/points/adjustments.yaml @@ -3,11 +3,17 @@ points: matrix: columns: left: - right.key: - stagger: 5 - spread: 25 - splay: 5 - origin: [-9, -9] + right: + key: + stagger: 5 + spread: 25 + splay: 5 + origin: [-9, -9] + rows: + top: + orient: -90 + shift: [0, 10] + rotate: 90 rows: bottom: top: \ No newline at end of file diff --git a/test/points/adjustments___demo_dxf.dxf b/test/points/adjustments___demo_dxf.dxf index 7fafd46..d953dbe 100644 --- a/test/points/adjustments___demo_dxf.dxf +++ b/test/points/adjustments___demo_dxf.dxf @@ -193,49 +193,49 @@ LINE 8 0 10 -12.7752375 +22.7371845 20 -32.8592038 +33.7307612 11 -30.7067421 +40.6686891 21 -34.4280072 +35.2995646 0 LINE 8 0 10 -30.7067421 +40.6686891 20 -34.4280072 +35.2995646 11 -32.2755455 +42.2374925 21 -16.4965026 +17.36806 0 LINE 8 0 10 -32.2755455 +42.2374925 20 -16.4965026 +17.36806 11 -14.3440409 +24.3059879 21 -14.9276992 +15.7992566 0 LINE 8 0 10 -14.3440409 +24.3059879 20 -14.9276992 +15.7992566 11 -12.7752375 +22.7371845 21 -32.8592038 +33.7307612 0 ENDSEC 0 diff --git a/test/points/adjustments___points.json b/test/points/adjustments___points.json index 0dc8ef5..02b7e60 100644 --- a/test/points/adjustments___points.json +++ b/test/points/adjustments___points.json @@ -11,6 +11,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -43,6 +44,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -75,6 +77,7 @@ -9, -9 ], + "orient": 0, "shift": [ 0, 0 @@ -96,7 +99,16 @@ -9 ] }, - "rows": {}, + "rows": { + "top": { + "orient": -90, + "shift": [ + 0, + 10 + ], + "rotate": 90 + } + }, "name": "right" }, "row": "bottom", @@ -104,8 +116,8 @@ } }, "matrix_right_top": { - "x": 22.525391499999998, - "y": 24.6778532, + "x": 32.4873385, + "y": 25.5494106, "r": 5, "meta": { "stagger": 5, @@ -115,11 +127,12 @@ -9, -9 ], + "orient": -90, "shift": [ 0, - 0 + 10 ], - "rotate": 0, + "rotate": 90, "width": 18, "height": 18, "padding": 19, @@ -136,7 +149,16 @@ -9 ] }, - "rows": {}, + "rows": { + "top": { + "orient": -90, + "shift": [ + 0, + 10 + ], + "rotate": 90 + } + }, "name": "right" }, "row": "top", diff --git a/test/points/basic_2x2___points.json b/test/points/basic_2x2___points.json index 2fd2c4e..9f717de 100644 --- a/test/points/basic_2x2___points.json +++ b/test/points/basic_2x2___points.json @@ -11,6 +11,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -43,6 +44,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -75,6 +77,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -107,6 +110,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 diff --git a/test/points/default___points.json b/test/points/default___points.json index 33e284f..a24eb94 100644 --- a/test/points/default___points.json +++ b/test/points/default___points.json @@ -11,6 +11,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 diff --git a/test/points/overrides___points.json b/test/points/overrides___points.json index 9cc2884..e1e8152 100644 --- a/test/points/overrides___points.json +++ b/test/points/overrides___points.json @@ -11,6 +11,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -43,6 +44,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -75,6 +77,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -109,6 +112,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -143,6 +147,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -177,6 +182,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0 @@ -215,6 +221,7 @@ 0, 0 ], + "orient": 0, "shift": [ 0, 0