Outline scaling
This commit is contained in:
parent
5bfa3b5932
commit
a586d9058c
5 changed files with 269 additions and 4 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
### Major
|
### Major
|
||||||
|
|
||||||
- Gut standalone 3d output, only different scripts for different integrations
|
|
||||||
- Key-level access to full anchors
|
- Key-level access to full anchors
|
||||||
- this could provide extra variables `padding`, `spread`, `splay` for custom layout purposes
|
- 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
|
- make row anchors cumulative, too (like columns), so fingers arcs and other edits can happen
|
||||||
|
@ -27,7 +26,6 @@
|
||||||
- Include raw kicad footprint integrations
|
- Include raw kicad footprint integrations
|
||||||
- pull torik's script to be able to convert raw kicad footprints into positionable ergogen ones
|
- 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
|
- have a `dummy` footprint which can just be updated from schematic
|
||||||
- Shift/rotate/scale for outline elements before layout
|
|
||||||
- Allow footprints to publish outlines
|
- Allow footprints to publish outlines
|
||||||
- Make these usable in the `outlines` section through a new `what`
|
- Make these usable in the `outlines` section through a new `what`
|
||||||
- 3D orient for cases
|
- 3D orient for cases
|
||||||
|
|
|
@ -128,18 +128,23 @@ const polygon = (config, name, points, outlines, units) => {
|
||||||
const outline = (config, name, points, outlines, units) => {
|
const outline = (config, name, points, outlines, units) => {
|
||||||
|
|
||||||
// prepare params
|
// 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!`)
|
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 fillet = a.sane(config.fillet || 0, `${name}.fillet`, 'number')(units)
|
||||||
const expand = a.sane(config.expand || 0, `${name}.expand`, '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 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 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 shape function and its units
|
||||||
return [(point, bound) => {
|
return [(point, bound) => {
|
||||||
let o = u.deepcopy(outlines[config.name])
|
let o = u.deepcopy(outlines[config.name])
|
||||||
o = origin.unposition(o)
|
o = origin.unposition(o)
|
||||||
|
|
||||||
|
if (scale !== 1) {
|
||||||
|
o = m.model.scale(o, scale)
|
||||||
|
}
|
||||||
|
|
||||||
if (fillet) {
|
if (fillet) {
|
||||||
for (const [index, chain] of m.model.findChains(o).entries()) {
|
for (const [index, chain] of m.model.findChains(o).entries()) {
|
||||||
o.models[`fillet_${index}`] = m.chain.fillet(chain, fillet)
|
o.models[`fillet_${index}`] = m.chain.fillet(chain, fillet)
|
||||||
|
|
|
@ -19,4 +19,8 @@ outlines:
|
||||||
fillet:
|
fillet:
|
||||||
- what: outline
|
- what: outline
|
||||||
name: base
|
name: base
|
||||||
fillet: 2
|
fillet: 2
|
||||||
|
scale:
|
||||||
|
- what: outline
|
||||||
|
name: fillet
|
||||||
|
scale: 0.5
|
258
test/outlines/outlines___outlines_scale_dxf.dxf
Normal file
258
test/outlines/outlines___outlines_scale_dxf.dxf
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue