Add key-level orient

This commit is contained in:
Bán Dénes 2021-12-25 21:22:37 +01:00
parent f2bd0d23a1
commit e48631fac8
10 changed files with 74 additions and 28 deletions

View file

@ -10,11 +10,12 @@
- Merge, generalize, and uniform-ize footprints - Merge, generalize, and uniform-ize footprints
- Template for creating them, built-in variables they can use, documentation, external links, etc. - 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. - Also considering how (or, on which layer) they define their silks, universal mirroring behaviour, etc.
- https://en.wikipedia.org/wiki/Reference_designator#Designators
### Minor ### Minor
- Key-level orient
- 3D orient for cases - 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) - Allow shift/rotate for outlines (via `anchor_def`, probably)
- More generic anchors or distances? - 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 - 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

View file

@ -91,6 +91,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
spread: first_col ? 0 : units.$default_spread, spread: first_col ? 0 : units.$default_spread,
splay: units.$default_splay, splay: units.$default_splay,
origin: [0, 0], origin: [0, 0],
orient: 0,
shift: [0, 0], shift: [0, 0],
rotate: 0, rotate: 0,
width: units.$default_width, 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.spread = a.sane(key.spread, `${key.name}.spread`, 'number')(units)
key.splay = a.sane(key.splay, `${key.name}.splay`, 'number')(units) key.splay = a.sane(key.splay, `${key.name}.splay`, 'number')(units)
key.origin = a.xy(key.origin, `${key.name}.origin`)(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.shift = a.xy(key.shift, `${key.name}.shift`)(units)
key.rotate = a.sane(key.rotate, `${key.name}.rotate`, 'number')(units) key.rotate = a.sane(key.rotate, `${key.name}.rotate`, 'number')(units)
key.width = a.sane(key.width, `${key.name}.width`, '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) { for (const r of rotations) {
point.rotate(r.angle, r.origin) point.rotate(r.angle, r.origin)
} }
point.r += key.orient
point.shift(key.shift) point.shift(key.shift)
point.r += key.rotate point.r += key.rotate
point.meta = key point.meta = key

View file

@ -9,6 +9,7 @@ matrix_col_row:
origin: origin:
- 0 - 0
- 0 - 0
orient: 0
shift: shift:
- 0 - 0
- 0 - 0

View file

@ -9,6 +9,7 @@ matrix_col_row:
origin: origin:
- 0 - 0
- 0 - 0
orient: 0
shift: shift:
- 0 - 0
- 0 - 0

View file

@ -3,11 +3,17 @@ points:
matrix: matrix:
columns: columns:
left: left:
right.key: right:
stagger: 5 key:
spread: 25 stagger: 5
splay: 5 spread: 25
origin: [-9, -9] splay: 5
origin: [-9, -9]
rows:
top:
orient: -90
shift: [0, 10]
rotate: 90
rows: rows:
bottom: bottom:
top: top:

View file

@ -193,49 +193,49 @@ LINE
8 8
0 0
10 10
12.7752375 22.7371845
20 20
32.8592038 33.7307612
11 11
30.7067421 40.6686891
21 21
34.4280072 35.2995646
0 0
LINE LINE
8 8
0 0
10 10
30.7067421 40.6686891
20 20
34.4280072 35.2995646
11 11
32.2755455 42.2374925
21 21
16.4965026 17.36806
0 0
LINE LINE
8 8
0 0
10 10
32.2755455 42.2374925
20 20
16.4965026 17.36806
11 11
14.3440409 24.3059879
21 21
14.9276992 15.7992566
0 0
LINE LINE
8 8
0 0
10 10
14.3440409 24.3059879
20 20
14.9276992 15.7992566
11 11
12.7752375 22.7371845
21 21
32.8592038 33.7307612
0 0
ENDSEC ENDSEC
0 0

View file

@ -11,6 +11,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -43,6 +44,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -75,6 +77,7 @@
-9, -9,
-9 -9
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -96,7 +99,16 @@
-9 -9
] ]
}, },
"rows": {}, "rows": {
"top": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right" "name": "right"
}, },
"row": "bottom", "row": "bottom",
@ -104,8 +116,8 @@
} }
}, },
"matrix_right_top": { "matrix_right_top": {
"x": 22.525391499999998, "x": 32.4873385,
"y": 24.6778532, "y": 25.5494106,
"r": 5, "r": 5,
"meta": { "meta": {
"stagger": 5, "stagger": 5,
@ -115,11 +127,12 @@
-9, -9,
-9 -9
], ],
"orient": -90,
"shift": [ "shift": [
0, 0,
0 10
], ],
"rotate": 0, "rotate": 90,
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -136,7 +149,16 @@
-9 -9
] ]
}, },
"rows": {}, "rows": {
"top": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right" "name": "right"
}, },
"row": "top", "row": "top",

View file

@ -11,6 +11,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -43,6 +44,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -75,6 +77,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -107,6 +110,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0

View file

@ -11,6 +11,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0

View file

@ -11,6 +11,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -43,6 +44,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -75,6 +77,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -109,6 +112,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -143,6 +147,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -177,6 +182,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0
@ -215,6 +221,7 @@
0, 0,
0 0
], ],
"orient": 0,
"shift": [ "shift": [
0, 0,
0 0