mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2025-12-13 16:40:05 +01:00
Support full anchors in outline shapes
This commit is contained in:
parent
677fae0072
commit
26128f8db7
5 changed files with 68 additions and 50 deletions
|
|
@ -1,7 +1,7 @@
|
|||
const m = require('makerjs')
|
||||
const a = require('./assert')
|
||||
const prep = require('./prepare')
|
||||
const make_anchor = require('./anchor')
|
||||
const anchor_lib = require('./anchor')
|
||||
|
||||
const kicad_prefix = `
|
||||
(kicad_pcb (version 20171130) (host pcbnew 5.1.6)
|
||||
|
|
@ -156,7 +156,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer
|
|||
// config sanitization
|
||||
a.unexpected(config, name, ['type', 'anchor', 'nets', 'anchors', 'params'])
|
||||
const type = a.in(config.type, `${name}.type`, Object.keys(footprint_types))
|
||||
let anchor = make_anchor(config.anchor || {}, `${name}.anchor`, points, true, point)(units)
|
||||
let anchor = anchor_lib.parse(config.anchor || {}, `${name}.anchor`, points, true, point)(units)
|
||||
const nets = a.sane(config.nets || {}, `${name}.nets`, 'object')()
|
||||
const anchors = a.sane(config.anchors || {}, `${name}.anchors`, 'object')()
|
||||
const params = a.sane(config.params || {}, `${name}.params`, 'object')()
|
||||
|
|
@ -187,7 +187,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer
|
|||
parsed_params.at = `(at ${anchor.x} ${-anchor.y} ${anchor.r})`
|
||||
parsed_params.rot = anchor.r
|
||||
parsed_params.xy = (x, y) => {
|
||||
const new_anchor = make_anchor({
|
||||
const new_anchor = anchor_lib.parse({
|
||||
shift: [x, -y]
|
||||
}, '_internal_footprint_xy', points, true, anchor)(units)
|
||||
return `${new_anchor.x} ${-new_anchor.y}`
|
||||
|
|
@ -224,7 +224,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer
|
|||
// parsing anchor-type parameters
|
||||
parsed_params.anchors = {}
|
||||
for (const [anchor_name, anchor_config] of Object.entries(prep.extend(fp.anchors || {}, anchors))) {
|
||||
let parsed_anchor = make_anchor(anchor_config || {}, `${name}.anchors.${anchor_name}`, points, true, anchor)(units)
|
||||
let parsed_anchor = anchor_lib.parse(anchor_config || {}, `${name}.anchors.${anchor_name}`, points, true, anchor)(units)
|
||||
parsed_anchor.y = -parsed_anchor.y
|
||||
parsed_params.anchors[anchor_name] = parsed_anchor
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue