1
0

Outline scaling

This commit is contained in:
Bán Dénes 2022-04-16 16:14:29 +02:00
parent 5bfa3b5932
commit a586d9058c
5 changed files with 269 additions and 4 deletions

View File

@ -6,7 +6,6 @@
### Major
- Gut standalone 3d output, only different scripts for different integrations
- Key-level access to full anchors
- this could provide extra variables `padding`, `spread`, `splay` for custom layout purposes
- make row anchors cumulative, too (like columns), so fingers arcs and other edits can happen
@ -27,7 +26,6 @@
- Include raw kicad footprint integrations
- pull torik's script to be able to convert raw kicad footprints into positionable ergogen ones
- have a `dummy` footprint which can just be updated from schematic
- Shift/rotate/scale for outline elements before layout
- Allow footprints to publish outlines
- Make these usable in the `outlines` section through a new `what`
- 3D orient for cases

View File

@ -128,18 +128,23 @@ const polygon = (config, name, points, outlines, units) => {
const outline = (config, name, points, outlines, units) => {
// prepare params
a.unexpected(config, `${name}`, ['name', 'fillet', 'expand', 'origin'])
a.unexpected(config, `${name}`, ['name', 'fillet', 'expand', 'origin', 'scale'])
a.assert(outlines[config.name], `Field "${name}.name" does not name an existing outline!`)
const fillet = a.sane(config.fillet || 0, `${name}.fillet`, 'number')(units)
const expand = a.sane(config.expand || 0, `${name}.expand`, 'number')(units)
const joints = a.in(a.sane(config.joints || 0, `${name}.joints`, 'number')(units), `${name}.joints`, [0, 1, 2])
const origin = anchor(config.origin || {}, `${name}.origin`, points)(units)
const scale = a.sane(config.scale || 1, `${name}.scale`, 'number')(units)
// return shape function and its units
return [(point, bound) => {
let o = u.deepcopy(outlines[config.name])
o = origin.unposition(o)
if (scale !== 1) {
o = m.model.scale(o, scale)
}
if (fillet) {
for (const [index, chain] of m.model.findChains(o).entries()) {
o.models[`fillet_${index}`] = m.chain.fillet(chain, fillet)

View File

@ -19,4 +19,8 @@ outlines:
fillet:
- what: outline
name: base
fillet: 2
fillet: 2
scale:
- what: outline
name: fillet
scale: 0.5

View File

@ -0,0 +1,258 @@
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
4.3
20
-3.3
11
4.3
21
11.8
0
LINE
8
0
10
-3.3
20
-4.3
11
3.3
21
-4.3
0
LINE
8
0
10
-4.3
20
-3.3
11
-4.3
21
11.8
0
LINE
8
0
10
-3.3
20
12.8
11
3.3
21
12.8
0
LINE
8
0
10
13.8
20
-3.3
11
13.8
21
11.8
0
LINE
8
0
10
6.2
20
-4.3
11
12.8
21
-4.3
0
LINE
8
0
10
5.2
20
-3.3
11
5.2
21
11.8
0
LINE
8
0
10
6.2
20
12.8
11
12.8
21
12.8
0
ARC
8
0
10
3.3
20
11.8
40
1
50
0
51
90
0
ARC
8
0
10
-3.3
20
11.8
40
1
50
90
51
180
0
ARC
8
0
10
-3.3
20
-3.3
40
1
50
180
51
270
0
ARC
8
0
10
3.3
20
-3.3
40
1
50
270
51
0
0
ARC
8
0
10
12.8
20
11.8
40
1
50
0
51
90
0
ARC
8
0
10
6.2
20
11.8
40
1
50
90
51
180
0
ARC
8
0
10
6.2
20
-3.3
40
1
50
180
51
270
0
ARC
8
0
10
12.8
20
-3.3
40
1
50
270
51
0
0
ENDSEC
0
EOF