├── .gitignore ├── .hookman ├── config.toml └── hooks │ ├── pre-push.toml │ └── pre-commit.toml ├── fixtures ├── upstream │ ├── test │ │ ├── cli │ │ │ ├── bad_input │ │ │ │ ├── bad.yaml │ │ │ │ ├── error │ │ │ │ └── command │ │ │ ├── missing_input │ │ │ │ ├── command │ │ │ │ └── error │ │ │ ├── zip │ │ │ │ ├── reference │ │ │ │ ├── command │ │ │ │ └── log │ │ │ ├── bad_bundle │ │ │ │ ├── command │ │ │ │ └── error │ │ │ ├── medium │ │ │ │ ├── command │ │ │ │ ├── log │ │ │ │ └── reference │ │ │ │ │ └── outlines │ │ │ │ │ └── export.dxf │ │ │ ├── minimal │ │ │ │ ├── command │ │ │ │ ├── reference │ │ │ │ │ ├── source │ │ │ │ │ │ ├── raw.txt │ │ │ │ │ │ └── canonical.yaml │ │ │ │ │ └── points │ │ │ │ │ │ ├── units.yaml │ │ │ │ │ │ ├── demo.svg │ │ │ │ │ │ ├── demo.dxf │ │ │ │ │ │ ├── points.yaml │ │ │ │ │ │ └── demo.yaml │ │ │ │ └── log │ │ │ ├── minimal_yml │ │ │ │ ├── command │ │ │ │ ├── reference │ │ │ │ │ ├── source │ │ │ │ │ │ ├── raw.txt │ │ │ │ │ │ └── canonical.yaml │ │ │ │ │ └── points │ │ │ │ │ │ ├── units.yaml │ │ │ │ │ │ ├── demo.svg │ │ │ │ │ │ ├── demo.dxf │ │ │ │ │ │ ├── points.yaml │ │ │ │ │ │ └── demo.yaml │ │ │ │ └── log │ │ │ ├── atreus_kle │ │ │ │ ├── command │ │ │ │ ├── reference │ │ │ │ │ └── points │ │ │ │ │ │ └── units.yaml │ │ │ │ └── log │ │ │ ├── bundle │ │ │ │ ├── command │ │ │ │ ├── reference │ │ │ │ │ ├── pcbs │ │ │ │ │ │ └── custom_template.kicad_pcb │ │ │ │ │ └── outlines │ │ │ │ │ │ └── box.dxf │ │ │ │ └── log │ │ │ ├── minimal_kle │ │ │ │ ├── command │ │ │ │ ├── reference │ │ │ │ │ ├── source │ │ │ │ │ │ └── raw.txt │ │ │ │ │ └── points │ │ │ │ │ │ ├── units.yaml │ │ │ │ │ │ └── demo.svg │ │ │ │ └── log │ │ │ ├── no_clean │ │ │ │ ├── reference │ │ │ │ │ ├── sentinel.txt │ │ │ │ │ └── outlines │ │ │ │ │ │ └── export.dxf │ │ │ │ ├── command │ │ │ │ └── log │ │ │ ├── nonexistent_input │ │ │ │ ├── command │ │ │ │ └── error │ │ │ ├── bad_template │ │ │ │ ├── command │ │ │ │ ├── input │ │ │ │ │ ├── templates │ │ │ │ │ │ └── bad_template.js │ │ │ │ │ └── config.yaml │ │ │ │ └── error │ │ │ ├── big │ │ │ │ ├── command │ │ │ │ ├── reference │ │ │ │ │ ├── points │ │ │ │ │ │ ├── units.yaml │ │ │ │ │ │ ├── demo.svg │ │ │ │ │ │ ├── demo.dxf │ │ │ │ │ │ ├── points.yaml │ │ │ │ │ │ └── demo.yaml │ │ │ │ │ ├── outlines │ │ │ │ │ │ ├── _export.svg │ │ │ │ │ │ ├── export.svg │ │ │ │ │ │ ├── export.dxf │ │ │ │ │ │ ├── _export.dxf │ │ │ │ │ │ ├── _export.yaml │ │ │ │ │ │ └── export.yaml │ │ │ │ │ ├── source │ │ │ │ │ │ ├── raw.txt │ │ │ │ │ │ └── canonical.yaml │ │ │ │ │ └── cases │ │ │ │ │ │ ├── export.jscad │ │ │ │ │ │ └── _export.jscad │ │ │ │ └── log │ │ │ └── clean │ │ │ │ ├── command │ │ │ │ ├── log │ │ │ │ └── reference │ │ │ │ └── outlines │ │ │ │ └── export.dxf │ │ ├── points │ │ │ ├── samename___EXCEPTION.txt │ │ │ ├── default.yaml │ │ │ ├── samename.yaml │ │ │ ├── basic_2x2.yaml │ │ │ ├── output │ │ │ │ ├── source │ │ │ │ │ ├── raw.txt │ │ │ │ │ └── canonical.yaml │ │ │ │ └── points │ │ │ │ │ ├── units.yaml │ │ │ │ │ └── demo.svg │ │ │ ├── units.yaml │ │ │ ├── overrides.yaml │ │ │ ├── units___units.json │ │ │ ├── rotations.yaml │ │ │ ├── mirror_variable.yaml │ │ │ ├── autobind.yaml │ │ │ ├── adjustments.yaml │ │ │ ├── mirrors.yaml │ │ │ ├── default___demo_dxf.dxf │ │ │ ├── mirror_variable__demo_dxf.dxf │ │ │ ├── autobind___outlines_none_dxf.dxf │ │ │ └── autobind___outlines_some_dxf.dxf │ │ ├── pcbs │ │ │ ├── mock_template___pcbs_main.kicad_pcb │ │ │ ├── mock_template.yaml │ │ │ ├── references.yaml │ │ │ ├── kicad8_template.yaml │ │ │ ├── outlines.yaml │ │ │ └── mock_footprints.yaml │ │ ├── footprints │ │ │ ├── diode.yaml │ │ │ ├── promicro.yaml │ │ │ ├── button.yaml │ │ │ ├── trrs.yaml │ │ │ ├── chocmini.yaml │ │ │ ├── pad.yaml │ │ │ ├── mx.yaml │ │ │ ├── choc.yaml │ │ │ └── rest.yaml │ │ ├── cases │ │ │ ├── cube.yaml │ │ │ ├── operations.yaml │ │ │ └── cube___cases_cube_jscad.jscad │ │ └── outlines │ │ │ ├── binding.yaml │ │ │ ├── basic.yaml │ │ │ ├── circles.yaml │ │ │ ├── rectangles.yaml │ │ │ ├── polygons.yaml │ │ │ ├── path__outlines_arc_dxf.dxf │ │ │ ├── path__outlines_arc_path_dxf.dxf │ │ │ ├── path__outlines_line_dxf.dxf │ │ │ ├── outlines.yaml │ │ │ ├── outlines___outlines_adjust_dxf.dxf │ │ │ ├── path__outlines_s_curve_dxf.dxf │ │ │ ├── path__outlines_s_curve_path_dxf.dxf │ │ │ ├── expand.yaml │ │ │ ├── hull___outlines_extend_dxf.dxf │ │ │ ├── hull___outlines_defaults_dxf.dxf │ │ │ ├── affect_mirror.yaml │ │ │ ├── hull___outlines_rotation_dxf.dxf │ │ │ ├── hull___outlines_concavity-high_dxf.dxf │ │ │ └── circles___outlines_outline_dxf.dxf │ └── fixtures │ │ ├── minimal.yaml │ │ ├── minimal.yml │ │ ├── bundle.zip │ │ ├── minimal_kle.json │ │ ├── medium.yaml │ │ ├── bundle │ │ ├── templates │ │ │ └── custom_template.js │ │ ├── config.yaml │ │ └── footprints │ │ │ └── injected.js │ │ ├── big.yaml │ │ └── makerjs │ │ ├── bug_465_weird_bad.dxf │ │ └── bug_465_weird_good.dxf ├── m3 │ └── points │ │ ├── samename___EXCEPTION.txt │ │ ├── default.yaml │ │ ├── samename.yaml │ │ ├── basic_2x2.yaml │ │ ├── units.yaml │ │ ├── overrides.yaml │ │ ├── units___units.json │ │ ├── rotations.yaml │ │ ├── mirror_variable.yaml │ │ ├── autobind.yaml │ │ ├── adjustments.yaml │ │ ├── mirrors.yaml │ │ ├── default___demo_dxf.dxf │ │ ├── mirror_variable__demo_dxf.dxf │ │ ├── autobind___outlines_none_dxf.dxf │ │ └── autobind___outlines_some_dxf.dxf ├── m1 │ └── minimal.yaml ├── m2 │ └── upstream │ │ ├── points_default.yaml │ │ ├── points_default.canonical.json │ │ ├── points_units.canonical.json │ │ ├── points_units.yaml │ │ ├── points_overrides.canonical.json │ │ ├── points_rotations.canonical.json │ │ ├── points_overrides.yaml │ │ ├── points_rotations.yaml │ │ ├── points_mirrors.canonical.json │ │ └── points_mirrors.yaml ├── m6 │ ├── pcbs │ │ ├── injected.yaml │ │ ├── scrollwheel_slider_front.yaml │ │ ├── alps_jumper_omron_via.yaml │ │ ├── oled_rgb_mirror.yaml │ │ ├── mx_choc_asym.yaml │ │ ├── oled_rgb_scrollwheel_slider.yaml │ │ ├── pad_button_chocmini.yaml │ │ └── trrs_rotary_promicro.yaml │ └── reference_outputs │ │ └── big │ │ ├── outlines │ │ ├── export.svg │ │ └── export.dxf │ │ └── cases │ │ └── export.jscad ├── m7 │ ├── pcbs │ │ ├── spec_pad_parity.yaml │ │ ├── spec_diode.yaml │ │ ├── spec_button_parity.yaml │ │ ├── spec_mx_base_parity.yaml │ │ ├── spec_visual.yaml │ │ ├── spec_kicad8_rect.yaml │ │ └── spec_pad.yaml │ ├── js_footprints │ │ ├── global_net.yaml │ │ ├── simple.yaml │ │ ├── global_net.js │ │ ├── knuckles_promicro_pretty.yaml │ │ ├── knuckles_mounting_hole.yaml │ │ ├── knuckles_diode.yaml │ │ ├── router_like.yaml │ │ ├── knuckles_pg1316s_reversible_edgecuts.yaml │ │ ├── knuckles_mcu_nice_nano.yaml │ │ ├── knuckles_utility_text.yaml │ │ ├── simple.js │ │ └── knuckles_assets │ │ │ └── ceoloide │ │ │ └── mounting_hole_npth.js │ └── footprints │ │ ├── pad_minimal.yaml │ │ ├── pad_missing_placeholder.yaml │ │ ├── pad_templated.yaml │ │ ├── visual_arc_text.yaml │ │ ├── pad_primitives.yaml │ │ └── primitives_templated.yaml ├── m5 │ └── outlines │ │ ├── binding.yaml │ │ ├── basic.yaml │ │ ├── circles.yaml │ │ ├── rectangles.yaml │ │ ├── polygons.yaml │ │ ├── path__outlines_arc_dxf.dxf │ │ ├── path__outlines_arc_path_dxf.dxf │ │ ├── path__outlines_line_dxf.dxf │ │ ├── outlines.yaml │ │ ├── outlines___outlines_adjust_dxf.dxf │ │ ├── path__outlines_s_curve_dxf.dxf │ │ ├── path__outlines_s_curve_path_dxf.dxf │ │ ├── expand.yaml │ │ ├── hull___outlines_extend_dxf.dxf │ │ ├── hull___outlines_defaults_dxf.dxf │ │ ├── affect_mirror.yaml │ │ ├── hull___outlines_rotation_dxf.dxf │ │ ├── hull___outlines_concavity-high_dxf.dxf │ │ └── circles___outlines_outline_dxf.dxf └── m8 │ └── knuckles │ ├── knuckles_assets___outlines_pcb_dxf.dxf │ ├── knuckles_assets.yaml │ └── README.md ├── crates ├── ergogen-wasm │ ├── examples │ │ ├── footprints.js │ │ ├── README.md │ │ ├── index.html │ │ └── index.js │ ├── Cargo.toml │ └── README.md ├── ergogen-layout │ ├── src │ │ └── lib.rs │ ├── Cargo.toml │ └── examples │ │ └── points.rs ├── ergogen-core │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── ergogen-export │ ├── src │ │ └── lib.rs │ ├── Cargo.toml │ └── tests │ │ ├── jscad_v2.rs │ │ ├── m3_points_dxf.rs │ │ ├── dxf_compare_files.rs │ │ ├── m5_outlines_dxf.rs │ │ └── m5_outlines_golden_semantic.rs ├── ergogen-geometry │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── ergogen-pcb │ ├── templates │ │ └── footprints │ │ │ ├── test │ │ │ ├── anchor2.tpl │ │ │ ├── anchor.tpl │ │ │ ├── arrobj.tpl │ │ │ ├── arrobj_templated.tpl │ │ │ ├── zone.tpl │ │ │ ├── trace_f.tpl │ │ │ ├── trace_b.tpl │ │ │ └── dynamic_net.tpl │ │ │ ├── injected.tpl │ │ │ ├── rest │ │ │ ├── via.tpl │ │ │ ├── jumper.tpl │ │ │ ├── oled.tpl │ │ │ ├── alps.tpl │ │ │ ├── omron.tpl │ │ │ └── jstph.tpl │ │ │ ├── pad │ │ │ ├── up_back.tpl │ │ │ ├── base.tpl │ │ │ ├── down_mirrored.tpl │ │ │ ├── left_mirrored.tpl │ │ │ ├── right_mirrored.tpl │ │ │ └── right_text.tpl │ │ │ ├── choc │ │ │ └── base.tpl │ │ │ └── mx │ │ │ └── base.tpl │ ├── examples │ │ └── pcb_debug.rs │ ├── Cargo.toml │ └── tests │ │ └── virtual_fs.rs ├── ergogen-dxf2png │ └── Cargo.toml ├── ergogen-parser │ ├── src │ │ ├── config.rs │ │ ├── expr.rs │ │ └── error.rs │ ├── Cargo.toml │ ├── tests │ │ ├── fixtures.rs │ │ ├── upstream_units.rs │ │ └── m2_canonical.rs │ └── examples │ │ └── prepare.rs ├── ergogen-outline │ └── Cargo.toml └── ergogen-cli │ ├── Cargo.toml │ └── tests │ └── render_smoke.rs ├── Cargo.toml ├── scripts ├── check-format.sh ├── check-clippy.sh ├── README.md └── update-upstream-baselines.sh ├── footprints └── pad.yaml ├── .github └── workflows │ ├── knuckles-parity.yml │ └── ci.yml └── AGENTS.md /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /knuckles 3 | -------------------------------------------------------------------------------- /.hookman/config.toml: -------------------------------------------------------------------------------- 1 | version = "0.1.0" 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_input/bad.yaml: -------------------------------------------------------------------------------- 1 | 'bad input' -------------------------------------------------------------------------------- /fixtures/m3/points/samename___EXCEPTION.txt: -------------------------------------------------------------------------------- 1 | defined more than once -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/missing_input/command: -------------------------------------------------------------------------------- 1 | node src/cli.js 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/zip/reference: -------------------------------------------------------------------------------- 1 | ../bundle/reference 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_bundle/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/ 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_bundle/error: -------------------------------------------------------------------------------- 1 | Ambiguous config in bundle! -------------------------------------------------------------------------------- /fixtures/upstream/test/points/samename___EXCEPTION.txt: -------------------------------------------------------------------------------- 1 | defined more than once -------------------------------------------------------------------------------- /fixtures/m1/minimal.yaml: -------------------------------------------------------------------------------- 1 | units: 2 | u: 20 3 | variables: 4 | foo: u + 2 5 | 6 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_input/error: -------------------------------------------------------------------------------- 1 | Error: Input doesn't resolve into an object! -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/medium/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/medium.yaml 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/minimal.yaml -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/minimal.yml -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/missing_input/error: -------------------------------------------------------------------------------- 1 | Usage: ergogen [options] -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/atreus_kle/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/atreus_kle.json -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_input/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/cli/bad_input/bad.yaml 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bundle/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/bundle --clean 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_kle/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/minimal_kle.json -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/no_clean/reference/sentinel.txt: -------------------------------------------------------------------------------- 1 | Ergogen CLI --clean test sentinel -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/nonexistent_input/command: -------------------------------------------------------------------------------- 1 | node src/cli.js nonexistent.yaml 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/zip/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/bundle.zip --clean 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_template/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/cli/bad_template/input --clean -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/command: -------------------------------------------------------------------------------- 1 | node src/cli.js test/fixtures/big.yaml --debug --clean 2 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/minimal.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns.col: {} 3 | rows.row: {} -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/minimal.yml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns.col: {} 3 | rows.row: {} -------------------------------------------------------------------------------- /fixtures/upstream/test/pcbs/mock_template___pcbs_main.kicad_pcb: -------------------------------------------------------------------------------- 1 | Custom template override. The secret is 42. -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_template/input/templates/bad_template.js: -------------------------------------------------------------------------------- 1 | const bad = require('nonexistent_require') -------------------------------------------------------------------------------- /fixtures/m3/points/default.yaml: -------------------------------------------------------------------------------- 1 | points.zones: 2 | matrix: 3 | single_key_column: 4 | columns: 5 | named: -------------------------------------------------------------------------------- /fixtures/m3/points/samename.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix.key.name: samename 2 | points.zones.other.key.name: samename 3 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/nonexistent_input/error: -------------------------------------------------------------------------------- 1 | Could not read config file "nonexistent.yaml": File does not exist! -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/reference/source/raw.txt: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns.col: {} 3 | rows.row: {} -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_default.yaml: -------------------------------------------------------------------------------- 1 | points.zones: 2 | matrix: 3 | single_key_column: 4 | columns: 5 | named: -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/reference/source/raw.txt: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns.col: {} 3 | rows.row: {} -------------------------------------------------------------------------------- /fixtures/upstream/test/points/default.yaml: -------------------------------------------------------------------------------- 1 | points.zones: 2 | matrix: 3 | single_key_column: 4 | columns: 5 | named: -------------------------------------------------------------------------------- /fixtures/upstream/test/points/samename.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix.key.name: samename 2 | points.zones.other.key.name: samename 3 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/bundle.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcoury/ergogen-rs/master/fixtures/upstream/fixtures/bundle.zip -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_default.canonical.json: -------------------------------------------------------------------------------- 1 | {"points":{"zones":{"matrix":null,"single_key_column":{"columns":{"named":null}}}}} 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_template/error: -------------------------------------------------------------------------------- 1 | Unknown dependency "nonexistent_require" among the requirements of injection "bad_template"! -------------------------------------------------------------------------------- /.hookman/hooks/pre-push.toml: -------------------------------------------------------------------------------- 1 | hook_type = "pre-push" 2 | 3 | [[commands]] 4 | id = "check-clippy" 5 | command = "./scripts/check-clippy.sh" 6 | -------------------------------------------------------------------------------- /crates/ergogen-wasm/examples/footprints.js: -------------------------------------------------------------------------------- 1 | export { installErgogenJsFootprints, registerErgogenJsFootprintSource } from "../js/footprints.js"; 2 | -------------------------------------------------------------------------------- /crates/ergogen-layout/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod anchor; 2 | mod points; 3 | 4 | pub use points::{LayoutError, PlacedPoint, PointsOutput, parse_points}; 5 | -------------------------------------------------------------------------------- /.hookman/hooks/pre-commit.toml: -------------------------------------------------------------------------------- 1 | hook_type = "pre-commit" 2 | 3 | [[commands]] 4 | id = "check-cargo-format" 5 | command = "./scripts/check-format.sh" 6 | 7 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bundle/reference/pcbs/custom_template.kicad_pcb: -------------------------------------------------------------------------------- 1 | Custom template override. The secret is 42. MakerJS is loaded. Ergogen is loaded. -------------------------------------------------------------------------------- /fixtures/upstream/test/pcbs/mock_template.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs: 3 | main: 4 | template: template_test 5 | params: 6 | secret: 42 -------------------------------------------------------------------------------- /crates/ergogen-core/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Core types shared across the Ergogen Rust workspace. 2 | 3 | pub mod point; 4 | 5 | pub use point::{Point, PointMeta}; 6 | -------------------------------------------------------------------------------- /fixtures/upstream/test/footprints/diode.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs.pcb.footprints: 3 | - what: diode 4 | params: 5 | from: from 6 | to: to -------------------------------------------------------------------------------- /crates/ergogen-export/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Output writers (SVG/DXF/JSCAD) and supporting helpers. 2 | 3 | pub mod dxf; 4 | pub mod dxf_geom; 5 | pub mod jscad; 6 | pub mod svg; 7 | -------------------------------------------------------------------------------- /fixtures/m3/points/basic_2x2.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left: 6 | right: 7 | rows: 8 | bottom: 9 | top: -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_units.canonical.json: -------------------------------------------------------------------------------- 1 | {"units":{"a":"cy - 7"},"variables":{"b":"a * 1.5"},"points":{"zones":{"matrix":{"columns":{"col":null},"rows":{"row":null}}}}} 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/basic_2x2.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left: 6 | right: 7 | rows: 8 | bottom: 9 | top: -------------------------------------------------------------------------------- /fixtures/upstream/test/points/output/source/raw.txt: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left: 6 | right: 7 | rows: 8 | bottom: 9 | top: -------------------------------------------------------------------------------- /fixtures/m3/points/units.yaml: -------------------------------------------------------------------------------- 1 | units: 2 | a: cy - 7 3 | variables: 4 | b: a * 1.5 5 | points: 6 | zones: 7 | matrix: 8 | columns: 9 | col: 10 | rows: 11 | row: -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/minimal_kle.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | "0_0", 4 | "0_1" 5 | ], 6 | [ 7 | "1_0", 8 | "1_1" 9 | ], 10 | [ 11 | "", 12 | "" 13 | ] 14 | ] 15 | 16 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_units.yaml: -------------------------------------------------------------------------------- 1 | units: 2 | a: cy - 7 3 | variables: 4 | b: a * 1.5 5 | points: 6 | zones: 7 | matrix: 8 | columns: 9 | col: 10 | rows: 11 | row: -------------------------------------------------------------------------------- /fixtures/m6/pcbs/injected.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints: 5 | - what: injected 6 | - what: injected 7 | adjust.shift: [10, 0] 8 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/medium.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns.col: {} 3 | outlines: 4 | export: 5 | - what: rectangle 6 | where: true 7 | size: 18 8 | pcbs: 9 | export: {} 10 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/reference/source/canonical.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | col: {} 6 | rows: 7 | row: {} 8 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/units.yaml: -------------------------------------------------------------------------------- 1 | units: 2 | a: cy - 7 3 | variables: 4 | b: a * 1.5 5 | points: 6 | zones: 7 | matrix: 8 | columns: 9 | col: 10 | rows: 11 | row: -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/reference/source/canonical.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | col: {} 6 | rows: 7 | row: {} 8 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_kle/reference/source/raw.txt: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | "0_0", 4 | "0_1" 5 | ], 6 | [ 7 | "1_0", 8 | "1_1" 9 | ], 10 | [ 11 | "", 12 | "" 13 | ] 14 | ] 15 | 16 | -------------------------------------------------------------------------------- /crates/ergogen-geometry/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! 2D geometry primitives and operations. 2 | 3 | pub mod primitives; 4 | pub mod region; 5 | 6 | pub use cavalier_contours::polyline::{BooleanOp, BooleanResultInfo, PlineVertex, Polyline}; 7 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cases/cube.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: {} 2 | outlines: 3 | square: 4 | - what: rectangle 5 | where: true 6 | size: [5, 5] 7 | cases: 8 | cube: 9 | - name: square 10 | extrude: 5 -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/no_clean/command: -------------------------------------------------------------------------------- 1 | node -e "const fs = require('fs-extra'); fs.mkdirpSync('output'); fs.writeFileSync('output/sentinel.txt', 'Ergogen CLI --clean test sentinel');" && node src/cli.js test/fixtures/medium.yaml 2 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/clean/command: -------------------------------------------------------------------------------- 1 | node -e "const fs = require('fs-extra'); fs.mkdirpSync('output'); fs.writeFileSync('output/sentinel.txt', 'Ergogen CLI --clean test sentinel');" && node src/cli.js test/fixtures/medium.yaml --clean 2 | -------------------------------------------------------------------------------- /crates/ergogen-geometry/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-geometry" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | cavalier_contours = "0.6.0" 8 | 9 | [dev-dependencies] 10 | proptest = "1.5.0" 11 | -------------------------------------------------------------------------------- /crates/ergogen-core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-core" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | serde = { version = "1", features = ["derive"] } 8 | 9 | [dev-dependencies] 10 | approx = "0.5" 11 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_overrides.canonical.json: -------------------------------------------------------------------------------- 1 | {"points":{"zones":{"matrix":{"columns":{"left":null,"middle":{"rows":{"top":null}},"right":{"key":{"stagger":"u"},"rows":{"bottom":"$unset","home":null,"top":null}}},"rows":{"bottom":null,"home":null}}}}} 2 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/anchor2.tpl: -------------------------------------------------------------------------------- 1 | (module anchor_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (fp_line (start 0 0) (end 0 0) (layer Dwgs.User) (width 0.05)) 6 | 7 | ) -------------------------------------------------------------------------------- /fixtures/upstream/test/footprints/promicro.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs.pcb.footprints: 3 | 4 | # downward 5 | - what: promicro 6 | 7 | # upward 8 | - what: promicro 9 | params: 10 | orientation: up 11 | adjust.shift: [50, 0] 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bad_template/input/config.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | outlines: 3 | box: 4 | - what: rectangle 5 | where: true 6 | size: 18 7 | pcbs: 8 | bad_template: 9 | outlines.edge.outline: box 10 | template: bad_template -------------------------------------------------------------------------------- /fixtures/upstream/test/pcbs/references.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns.one: 3 | rows.only: 4 | pcbs: 5 | shown: 6 | references: true 7 | footprints: 8 | - what: references_test 9 | hidden: 10 | footprints: 11 | - what: references_test -------------------------------------------------------------------------------- /fixtures/upstream/test/points/output/points/units.yaml: -------------------------------------------------------------------------------- 1 | U: 19.05 2 | u: 19 3 | cx: 18 4 | cy: 17 5 | $default_stagger: 0 6 | $default_spread: 19 7 | $default_splay: 0 8 | $default_height: 18 9 | $default_width: 18 10 | $default_padding: 19 11 | $default_autobind: 10 12 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/anchor.tpl: -------------------------------------------------------------------------------- 1 | (module anchor_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (fp_line (start 0 0) (end {{end_x}} {{end_y}}) (layer Dwgs.User) (width 0.05)) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_pad_parity.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints_search_paths: 5 | - footprints 6 | pcbs.pcb.footprints: 7 | - what: spec 8 | params: 9 | spec: pad.yaml 10 | net: P1 11 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/reference/points/units.yaml: -------------------------------------------------------------------------------- 1 | U: 19.05 2 | u: 19 3 | cx: 18 4 | cy: 17 5 | $default_stagger: 0 6 | $default_spread: 19 7 | $default_splay: 0 8 | $default_height: 18 9 | $default_width: 18 10 | $default_padding: 19 11 | $default_autobind: 10 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/output/source/canonical.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left: null 6 | right: null 7 | rows: 8 | bottom: null 9 | top: null 10 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/atreus_kle/reference/points/units.yaml: -------------------------------------------------------------------------------- 1 | U: 19.05 2 | u: 19 3 | cx: 18 4 | cy: 17 5 | $default_stagger: 0 6 | $default_spread: 19 7 | $default_splay: 0 8 | $default_height: 18 9 | $default_width: 18 10 | $default_padding: 19 11 | $default_autobind: 10 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_kle/reference/points/units.yaml: -------------------------------------------------------------------------------- 1 | U: 19.05 2 | u: 19 3 | cx: 18 4 | cy: 17 5 | $default_stagger: 0 6 | $default_spread: 19 7 | $default_splay: 0 8 | $default_height: 18 9 | $default_width: 18 10 | $default_padding: 19 11 | $default_autobind: 10 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/reference/points/units.yaml: -------------------------------------------------------------------------------- 1 | U: 19.05 2 | u: 19 3 | cx: 18 4 | cy: 17 5 | $default_stagger: 0 6 | $default_spread: 19 7 | $default_splay: 0 8 | $default_height: 18 9 | $default_width: 18 10 | $default_padding: 19 11 | $default_autobind: 10 12 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/injected.tpl: -------------------------------------------------------------------------------- 1 | (module injected_test_footprint (layer F.Cu) (tedit 5E1ADAC2) 2 | (at {{at}}) 3 | 4 | 5 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 6 | ) 7 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/points/units.yaml: -------------------------------------------------------------------------------- 1 | U: 19.05 2 | u: 19 3 | cx: 18 4 | cy: 17 5 | $default_stagger: 0 6 | $default_spread: 19 7 | $default_splay: 0 8 | $default_height: 18 9 | $default_width: 18 10 | $default_padding: 19 11 | $default_autobind: 10 12 | a: 47 13 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_rotations.canonical.json: -------------------------------------------------------------------------------- 1 | {"points":{"rotate":22.5,"zones":{"matrix":{"rotate":22.5,"key":{"origin":["-u/2","-u/2"]},"columns":{"left":null,"right":{"key":{"rotate":-45.0,"padding":"(1+sqrt(2))/2 * u","spread":"(1+sqrt(2))/2 * u"}}},"rows":{"bottom":null,"top":null}}}}} 2 | -------------------------------------------------------------------------------- /fixtures/m3/points/overrides.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns: 3 | left: 4 | middle: 5 | rows: 6 | top: 7 | right: 8 | key.stagger: u 9 | rows: 10 | bottom: $unset 11 | home: 12 | top: 13 | rows: 14 | bottom: 15 | home: -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/medium/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: YAML 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Writing output to disk... 11 | Done. 12 | 13 | -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_diode.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints_search_paths: 5 | - footprints 6 | pcbs.pcb.footprints: 7 | - what: spec 8 | params: 9 | spec: diode.yaml 10 | from: D_FROM 11 | to: D_TO 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/no_clean/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: YAML 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Writing output to disk... 11 | Done. 12 | 13 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_overrides.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns: 3 | left: 4 | middle: 5 | rows: 6 | top: 7 | right: 8 | key.stagger: u 9 | rows: 10 | bottom: $unset 11 | home: 12 | top: 13 | rows: 14 | bottom: 15 | home: -------------------------------------------------------------------------------- /fixtures/upstream/test/points/overrides.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns: 3 | left: 4 | middle: 5 | rows: 6 | top: 7 | right: 8 | key.stagger: u 9 | rows: 10 | bottom: $unset 11 | home: 12 | top: 13 | rows: 14 | bottom: 15 | home: -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_button_parity.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints_search_paths: 5 | - footprints 6 | pcbs.pcb.footprints: 7 | - what: spec 8 | params: 9 | spec: button.yaml 10 | from: BTN_FROM 11 | to: BTN_TO 12 | -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_mx_base_parity.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints_search_paths: 5 | - footprints 6 | pcbs.pcb.footprints: 7 | - what: spec 8 | params: 9 | spec: mx_base.yaml 10 | from: MX_FROM 11 | to: MX_TO 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/atreus_kle/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: KLE (Auto-debug) 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Writing output to disk... 11 | Done. 12 | 13 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/global_net.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - fixtures/m7/js_footprints 7 | pcbs.pcb.footprints: 8 | - what: global_net 9 | params: 10 | net: GND 11 | 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_kle/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: KLE (Auto-debug) 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Writing output to disk... 11 | Done. 12 | 13 | -------------------------------------------------------------------------------- /fixtures/m7/footprints/pad_minimal.yaml: -------------------------------------------------------------------------------- 1 | name: pad_minimal 2 | params: 3 | net: 4 | type: net 5 | required: true 6 | mask: 7 | type: boolean 8 | default: false 9 | primitives: 10 | - type: pad 11 | at: [0, 0] 12 | size: [2.5, 2.5] 13 | layers: [F.Cu, F.Mask] 14 | net: "{{ net }}" 15 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/simple.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - fixtures/m7/js_footprints 7 | pcbs.pcb.footprints: 8 | - what: simple 9 | params: 10 | net: GND 11 | label: JS 12 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/clean/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: YAML 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Cleaning output folder... 11 | Writing output to disk... 12 | Done. 13 | 14 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/global_net.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | params: { 3 | // Ensure we create one known net via params first. 4 | net: { type: 'net', value: 'GND' }, 5 | }, 6 | body: (p) => ` 7 | (segment (start 0 0) (end 1 0) (width 0.25) (layer "F.Cu") (net ${p.global_net('VCC')})) 8 | `.trim(), 9 | }; 10 | 11 | -------------------------------------------------------------------------------- /fixtures/upstream/test/footprints/button.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs.pcb.footprints: 3 | 4 | # front 5 | - what: button 6 | params: 7 | from: from 8 | to: to 9 | 10 | # back 11 | - what: button 12 | params: 13 | from: from 14 | to: to 15 | side: B 16 | adjust.shift: [50, 0] -------------------------------------------------------------------------------- /crates/ergogen-dxf2png/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-dxf2png" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | ergogen-export = { path = "../ergogen-export" } 8 | image = { version = "0.25", default-features = false, features = ["png"] } 9 | thiserror = "2.0.9" 10 | tiny-skia = "0.11" 11 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI (Debug Mode) 2 | 3 | Interpreting format: YAML 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Cleaning output folder... 11 | Writing output to disk... 12 | Done. 13 | 14 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/knuckles_promicro_pretty.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - knuckles/ergogen/footprints 7 | pcbs.pcb.footprints: 8 | - what: promicro_pretty 9 | params: 10 | P0: RX 11 | P1: TX 12 | 13 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bundle/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Analyzing folder... 4 | Interpreting format: YAML 5 | Preprocessing input... 6 | Calculating variables... 7 | Parsing points... 8 | Generating outlines... 9 | Modeling cases... 10 | Scaffolding PCBs... 11 | Cleaning output folder... 12 | Writing output to disk... 13 | Done. 14 | 15 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: YAML 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Output would be empty, rerunning in debug mode... 11 | Writing output to disk... 12 | Done. 13 | 14 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/zip/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Analyzing bundle... 4 | Interpreting format: YAML 5 | Preprocessing input... 6 | Calculating variables... 7 | Parsing points... 8 | Generating outlines... 9 | Modeling cases... 10 | Scaffolding PCBs... 11 | Cleaning output folder... 12 | Writing output to disk... 13 | Done. 14 | 15 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/knuckles_mounting_hole.yaml: -------------------------------------------------------------------------------- 1 | meta: 2 | name: knuckles_js_footprints 3 | version: v9.9 4 | author: Ergogen Tests 5 | 6 | points.zones.matrix: 7 | 8 | pcbs.pcb.template: kicad8 9 | pcbs.pcb.footprints_search_paths: 10 | - knuckles/ergogen/footprints 11 | pcbs.pcb.footprints: 12 | - what: ceoloide/mounting_hole_npth 13 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/log: -------------------------------------------------------------------------------- 1 | Ergogen CLI 2 | 3 | Interpreting format: YAML 4 | Preprocessing input... 5 | Calculating variables... 6 | Parsing points... 7 | Generating outlines... 8 | Modeling cases... 9 | Scaffolding PCBs... 10 | Output would be empty, rerunning in debug mode... 11 | Writing output to disk... 12 | Done. 13 | 14 | -------------------------------------------------------------------------------- /fixtures/m7/footprints/pad_missing_placeholder.yaml: -------------------------------------------------------------------------------- 1 | name: pad_missing_placeholder 2 | params: 3 | net: 4 | type: net 5 | required: true 6 | primitives: 7 | - type: pad 8 | at: 9 | - 0 10 | - 0 11 | size: 12 | - 1 13 | - 1 14 | layers: 15 | - "{{ missing_layer }}" 16 | - "F.Mask" 17 | net: "{{ net }}" 18 | -------------------------------------------------------------------------------- /fixtures/m3/points/units___units.json: -------------------------------------------------------------------------------- 1 | { 2 | "U": 19.05, 3 | "u": 19, 4 | "cx": 18, 5 | "cy": 17, 6 | "$default_stagger": 0, 7 | "$default_spread": 19, 8 | "$default_splay": 0, 9 | "$default_height": 18, 10 | "$default_width": 18, 11 | "$default_padding": 19, 12 | "$default_autobind": 10, 13 | "a": 10, 14 | "b": 15 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_visual.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints_search_paths: 5 | - fixtures/m7/footprints 6 | pcbs.pcb.footprints: 7 | - what: spec 8 | params: 9 | spec: visual_arc_text.yaml 10 | label: ARC90 11 | angle: 90 12 | rotation: 30 13 | adjust.shift: [0, 0] 14 | -------------------------------------------------------------------------------- /fixtures/m3/points/rotations.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | rotate: 22.5 3 | zones: 4 | matrix: 5 | rotate: 22.5 6 | key: 7 | origin: [-u/2, -u/2] 8 | columns: 9 | left: 10 | right.key: 11 | rotate: -45 12 | padding: (1+sqrt(2))/2 * u 13 | spread: (1+sqrt(2))/2 * u 14 | rows: 15 | bottom: 16 | top: 17 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/units___units.json: -------------------------------------------------------------------------------- 1 | { 2 | "U": 19.05, 3 | "u": 19, 4 | "cx": 18, 5 | "cy": 17, 6 | "$default_stagger": 0, 7 | "$default_spread": 19, 8 | "$default_splay": 0, 9 | "$default_height": 18, 10 | "$default_width": 18, 11 | "$default_padding": 19, 12 | "$default_autobind": 10, 13 | "a": 10, 14 | "b": 15 15 | } 16 | -------------------------------------------------------------------------------- /crates/ergogen-parser/src/config.rs: -------------------------------------------------------------------------------- 1 | use indexmap::IndexMap; 2 | use serde::Deserialize; 3 | 4 | use crate::expr::ScalarExpr; 5 | 6 | #[derive(Debug, Clone, Default, Deserialize)] 7 | pub struct RawConfig { 8 | #[serde(default)] 9 | pub units: Option>, 10 | 11 | #[serde(default)] 12 | pub variables: Option>, 13 | } 14 | -------------------------------------------------------------------------------- /fixtures/m6/reference_outputs/big/outlines/export.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_rotations.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | rotate: 22.5 3 | zones: 4 | matrix: 5 | rotate: 22.5 6 | key: 7 | origin: [-u/2, -u/2] 8 | columns: 9 | left: 10 | right.key: 11 | rotate: -45 12 | padding: (1+sqrt(2))/2 * u 13 | spread: (1+sqrt(2))/2 * u 14 | rows: 15 | bottom: 16 | top: 17 | -------------------------------------------------------------------------------- /fixtures/m3/points/mirror_variable.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | key_width: 18 3 | key_height: 18 4 | 5 | points: 6 | zones: 7 | matrix: 8 | columns: 9 | col1: 10 | rows: 11 | row1: 12 | mirror: 13 | width: key_width 14 | height: key_height 15 | mirror: 16 | ref: matrix_col1_row1 17 | distance: 10 -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/knuckles_diode.yaml: -------------------------------------------------------------------------------- 1 | meta: 2 | name: knuckles_js_footprints 3 | version: v9.9 4 | author: Ergogen Tests 5 | 6 | points.zones.matrix: 7 | 8 | pcbs.pcb.template: kicad8 9 | pcbs.pcb.footprints_search_paths: 10 | - knuckles/ergogen/footprints 11 | pcbs.pcb.footprints: 12 | - what: ceoloide/diode_tht_sod123 13 | params: 14 | from: GND 15 | to: ROW1 16 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/points/demo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/reference/points/demo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/rotations.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | rotate: 22.5 3 | zones: 4 | matrix: 5 | rotate: 22.5 6 | key: 7 | origin: [-u/2, -u/2] 8 | columns: 9 | left: 10 | right.key: 11 | rotate: -45 12 | padding: (1+sqrt(2))/2 * u 13 | spread: (1+sqrt(2))/2 * u 14 | rows: 15 | bottom: 16 | top: 17 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/outlines/_export.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/outlines/export.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/reference/points/demo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/examples/pcb_debug.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::fs; 3 | 4 | fn main() { 5 | let path = env::args().nth(1).expect("yaml path"); 6 | let pcb = env::args().nth(2).expect("pcb name"); 7 | let yaml = fs::read_to_string(&path).expect("read yaml"); 8 | let out = ergogen_pcb::generate_kicad_pcb_from_yaml_str(&yaml, &pcb).expect("generate pcb"); 9 | print!("{out}"); 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/router_like.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - fixtures/m7/js_footprints 7 | pcbs.pcb.footprints: 8 | - what: router_like 9 | params: 10 | net: GND 11 | width: 0.2 12 | locked: true 13 | route: 'f(0,0)(1,0)f(0,0)(0,1)' 14 | 15 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/mirror_variable.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | key_width: 18 3 | key_height: 18 4 | 5 | points: 6 | zones: 7 | matrix: 8 | columns: 9 | col1: 10 | rows: 11 | row1: 12 | mirror: 13 | width: key_width 14 | height: key_height 15 | mirror: 16 | ref: matrix_col1_row1 17 | distance: 10 -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/arrobj.tpl: -------------------------------------------------------------------------------- 1 | (module arrobj_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (fp_line (start {{start_x}} {{start_y}}) (end {{end1_x}} {{end1_y}}) (layer Dwgs.User) (width 0.05)) 6 | (fp_line (start {{start_x}} {{start_y}}) (end {{end2_x}} {{end2_y}}) (layer Dwgs.User) (width 0.05)) 7 | 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/bundle/templates/custom_template.js: -------------------------------------------------------------------------------- 1 | const m = require('makerjs') 2 | const version = require('package.json').version 3 | 4 | module.exports = { 5 | convert_outline: () => {}, 6 | body: params => { 7 | return `Custom template override. The secret is ${params.custom.secret}. MakerJS is ${m.version.length ? 'loaded' : ''}. Ergogen is ${version.length ? 'loaded' : ''}.` 8 | } 9 | } -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/arrobj_templated.tpl: -------------------------------------------------------------------------------- 1 | (module arrobj_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (fp_line (start {{start_x}} {{start_y}}) (end {{end1_x}} {{end1_y}}) (layer Dwgs.User) (width 0.05)) 6 | (fp_line (start {{start_x}} {{start_y}}) (end {{end2_x}} {{end2_y}}) (layer Dwgs.User) (width 0.05)) 7 | 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_kicad8_rect.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - fixtures/m7/footprints 7 | pcbs.pcb.footprints: 8 | - what: spec 9 | params: 10 | spec: primitives_templated.yaml 11 | rect_w: 10 12 | rect_h: 4 13 | line_w: 0.2 14 | label: RECT 15 | adjust.shift: [0, 0] 16 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/bundle/config.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | outlines: 3 | box: 4 | - what: rectangle 5 | where: true 6 | size: 18 7 | pcbs: 8 | pcb: 9 | outlines.edge.outline: box 10 | footprints: 11 | injected: 12 | what: injected 13 | where: matrix 14 | custom_template: 15 | outlines.edge.outline: box 16 | template: custom_template 17 | params: 18 | secret: 42 -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/knuckles_pg1316s_reversible_edgecuts.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - knuckles/ergogen/footprints 7 | pcbs.pcb.footprints: 8 | - what: pg1316s_reversible_edgecuts 9 | params: 10 | side: B 11 | reversible: true 12 | from: ROW0 13 | to: COL0 14 | P3: GND 15 | 16 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = [ 4 | "crates/ergogen-cli", 5 | "crates/ergogen-core", 6 | "crates/ergogen-dxf2png", 7 | "crates/ergogen-export", 8 | "crates/ergogen-geometry", 9 | "crates/ergogen-layout", 10 | "crates/ergogen-outline", 11 | "crates/ergogen-parser", 12 | "crates/ergogen-pcb", 13 | "crates/ergogen-wasm", 14 | ] 15 | 16 | [workspace.package] 17 | version = "0.1.0" 18 | edition = "2024" 19 | -------------------------------------------------------------------------------- /crates/ergogen-parser/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-parser" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | indexmap = { version = "2", features = ["serde"] } 8 | meval = "0.2" 9 | regex = "1" 10 | ryu = "1" 11 | serde = { version = "1", features = ["derive"] } 12 | serde_json = { version = "1", features = ["preserve_order"] } 13 | serde_yaml = "0.9" 14 | thiserror = "2" 15 | 16 | [dev-dependencies] 17 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_mirrors.canonical.json: -------------------------------------------------------------------------------- 1 | {"points":{"mirror":{"ref":"matrix_right_top","distance":"U"},"zones":{"matrix":{"columns":{"left":{"rows":{"bottom":{"asym":"source"},"top":{"asym":"clone"}}},"right":null},"rows":{"bottom":null,"top":null}},"other":{"anchor":{"ref":"matrix_right_top","shift":[100.0,100.0]},"mirror":{},"columns":{"left":{"rows":{"bottom":{"asym":"source"},"top":{"asym":"clone"}}},"right":null},"rows":{"bottom":null,"top":null}}}}} 2 | -------------------------------------------------------------------------------- /fixtures/m3/points/autobind.yaml: -------------------------------------------------------------------------------- 1 | points.zones: 2 | none: 3 | key: 4 | autobind: 0 5 | columns: 6 | a: 7 | b: 8 | some: 9 | key: 10 | autobind: 1 11 | columns: 12 | a: 13 | b: 14 | outlines: 15 | none: 16 | - what: rectangle 17 | where: /none_.*/ 18 | size: 5 19 | bound: true 20 | some: 21 | - what: rectangle 22 | where: /some_.*/ 23 | size: 5 24 | bound: true -------------------------------------------------------------------------------- /crates/ergogen-wasm/examples/README.md: -------------------------------------------------------------------------------- 1 | # Browser Example 2 | 3 | This example shows how to run the wasm bundle in a browser with JS footprints enabled. 4 | 5 | ## Build 6 | 7 | ```bash 8 | wasm-pack build crates/ergogen-wasm --target web --out-dir crates/ergogen-wasm/examples/pkg 9 | ``` 10 | 11 | ## Run 12 | 13 | ```bash 14 | python3 -m http.server 8000 -d crates/ergogen-wasm/examples 15 | ``` 16 | 17 | Then open `http://localhost:8000` in a browser. 18 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/bundle/footprints/injected.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | params: { 3 | designator: 'I' 4 | }, 5 | body: p => ` 6 | (module injected_test_footprint (layer F.Cu) (tedit 5E1ADAC2) 7 | ${p.at /* parametric position */} 8 | 9 | ${'' /* footprint reference */} 10 | (fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15)))) 11 | ) 12 | ` 13 | } -------------------------------------------------------------------------------- /scripts/check-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get list of staged server files that need formatting check 4 | CHANGED_FILES=$(git diff --cached --name-only | grep -E "^api/.*\.rs$") 5 | 6 | if [ -n "$CHANGED_FILES" ]; then 7 | echo "Checking format for changed rust server files:" 8 | echo "$CHANGED_FILES" 9 | cd api && cargo fmt -- --check 10 | else 11 | echo "No server files changed, skipping format check" 12 | exit 0 13 | fi 14 | 15 | 16 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/binding.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | mirror: 5 | ref: matrix_only_first 6 | distance: 30 7 | columns: 8 | only.rows: 9 | first.bind: 0 10 | second.bind: [0,10,0,10] 11 | third.bind: [10,0,10,0] 12 | fourth.bind: [u, u/2, u/3, u/4] 13 | outlines: 14 | bound: 15 | - what: rectangle 16 | where: true 17 | size: 20 18 | bound: true 19 | -------------------------------------------------------------------------------- /crates/ergogen-layout/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-layout" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | ergogen-core = { path = "../ergogen-core" } 8 | ergogen-parser = { path = "../ergogen-parser" } 9 | indexmap = { version = "2", features = ["serde"] } 10 | regex = "1" 11 | serde = { version = "1", features = ["derive"] } 12 | thiserror = "2" 13 | 14 | [dev-dependencies] 15 | approx = "0.5" 16 | serde_json = "1" 17 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/autobind.yaml: -------------------------------------------------------------------------------- 1 | points.zones: 2 | none: 3 | key: 4 | autobind: 0 5 | columns: 6 | a: 7 | b: 8 | some: 9 | key: 10 | autobind: 1 11 | columns: 12 | a: 13 | b: 14 | outlines: 15 | none: 16 | - what: rectangle 17 | where: /none_.*/ 18 | size: 5 19 | bound: true 20 | some: 21 | - what: rectangle 22 | where: /some_.*/ 23 | size: 5 24 | bound: true -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/binding.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | mirror: 5 | ref: matrix_only_first 6 | distance: 30 7 | columns: 8 | only.rows: 9 | first.bind: 0 10 | second.bind: [0,10,0,10] 11 | third.bind: [10,0,10,0] 12 | fourth.bind: [u, u/2, u/3, u/4] 13 | outlines: 14 | bound: 15 | - what: rectangle 16 | where: true 17 | size: 20 18 | bound: true 19 | -------------------------------------------------------------------------------- /crates/ergogen-export/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-export" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | cavalier_contours = "0.6.0" 8 | ergogen-geometry = { path = "../ergogen-geometry" } 9 | ergogen-outline = { path = "../ergogen-outline" } 10 | ergogen-parser = { path = "../ergogen-parser" } 11 | indexmap = "2.7.0" 12 | ryu = "1.0.18" 13 | thiserror = "2.0.9" 14 | 15 | [dev-dependencies] 16 | ergogen-pcb = { path = "../ergogen-pcb" } 17 | -------------------------------------------------------------------------------- /crates/ergogen-parser/src/expr.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] 4 | #[serde(untagged)] 5 | pub enum ScalarExpr { 6 | Number(f64), 7 | String(String), 8 | } 9 | 10 | impl ScalarExpr { 11 | #[must_use] 12 | pub fn as_str(&self) -> Option<&str> { 13 | match self { 14 | ScalarExpr::String(s) => Some(s), 15 | ScalarExpr::Number(_) => None, 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /fixtures/upstream/fixtures/big.yaml: -------------------------------------------------------------------------------- 1 | meta: 2 | author: MrZealot 3 | version: v3.14 4 | units: 5 | a: 28 + u 6 | points.zones.matrix: 7 | outlines: 8 | export: 9 | - what: rectangle 10 | where: true 11 | size: 18 12 | _export: 13 | - what: rectangle 14 | where: true 15 | size: 18 16 | cases: 17 | export: 18 | - name: export 19 | extrude: 1 20 | _export: 21 | - name: export 22 | extrude: 1 23 | pcbs: 24 | export: {} 25 | _export: {} 26 | -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/knuckles_mcu_nice_nano.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - knuckles/ergogen/footprints 7 | pcbs.pcb.footprints: 8 | - what: ceoloide/mcu_nice_nano 9 | params: 10 | reversible: true 11 | only_required_jumpers: true 12 | use_rectangular_jumpers: true 13 | show_silk_labels_on_both_sides: true 14 | P0: RX 15 | P1: TX 16 | 17 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/rest/via.tpl: -------------------------------------------------------------------------------- 1 | (module VIA-0.6mm (layer F.Cu) (tedit 591DBFB0) 2 | (at {{at}}) 3 | 4 | (fp_text reference REF** (at 0 1.4) (layer F.SilkS) hide (effects (font (size 1 1) (thickness 0.15)))) 5 | (fp_text value VIA-0.6mm (at 0 -1.4) (layer F.Fab) hide (effects (font (size 1 1) (thickness 0.15)))) 6 | 7 | 8 | (pad 1 thru_hole circle (at 0 0) (size 0.6 0.6) (drill 0.3) (layers *.Cu) (zone_connect 2) (net {{net_net_id}} "{{net_net}}")) 9 | ) -------------------------------------------------------------------------------- /fixtures/m6/pcbs/scrollwheel_slider_front.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints: 5 | - what: scrollwheel 6 | params: 7 | from: sw_from 8 | to: sw_to 9 | A: sw_a 10 | B: sw_b 11 | C: sw_c 12 | D: sw_d 13 | - what: slider 14 | params: 15 | from: sl_from 16 | to: sl_to 17 | adjust.shift: [40, 0] 18 | - what: via 19 | params: 20 | net: gnd 21 | adjust.shift: [80, 0] 22 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/output/points/demo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/source/raw.txt: -------------------------------------------------------------------------------- 1 | meta: 2 | author: MrZealot 3 | version: v3.14 4 | units: 5 | a: 28 + u 6 | points.zones.matrix: 7 | outlines: 8 | export: 9 | - what: rectangle 10 | where: true 11 | size: 18 12 | _export: 13 | - what: rectangle 14 | where: true 15 | size: 18 16 | cases: 17 | export: 18 | - name: export 19 | extrude: 1 20 | _export: 21 | - name: export 22 | extrude: 1 23 | pcbs: 24 | export: {} 25 | _export: {} 26 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/zone.tpl: -------------------------------------------------------------------------------- 1 | (module zone_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (pad 1 smd rect (at 0 0 30) (size 1 1) (layers F.Cu F.Paste F.Mask) 6 | (net {{net_P1_id}} "{{net_P1}}") (solder_mask_margin 0.2)) 7 | 8 | (pad 2 smd rect (at 5 5 30) (size 1 1) (layers F.Cu F.Paste F.Mask) 9 | (net {{net_P1_id}} "{{net_P1}}") (solder_mask_margin 0.2)) 10 | 11 | ) -------------------------------------------------------------------------------- /scripts/check-clippy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get list of staged server files that need clippy check 4 | CHANGED_FILES=$(git diff --cached --name-only | grep -E "^api/.*\.rs$") 5 | 6 | if [ -n "$CHANGED_FILES" ]; then 7 | echo "Running clippy with autofix for changed rust server files:" 8 | echo "$CHANGED_FILES" 9 | cd api && cargo clippy --fix --allow-dirty --allow-staged -- -D warnings && cargo clippy -- -D warnings 10 | else 11 | echo "No server files changed, skipping clippy check" 12 | exit 0 13 | fi 14 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/trace_f.tpl: -------------------------------------------------------------------------------- 1 | (module trace_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (pad 1 smd rect (at 0 0 30) (size 1 1) (layers F.Cu F.Paste F.Mask) 6 | (net {{net_P1_id}} "{{net_P1}}") (solder_mask_margin 0.2)) 7 | 8 | (pad 2 smd rect (at 5 5 30) (size 1 1) (layers F.Cu F.Paste F.Mask) 9 | (net {{net_P1_id}} "{{net_P1}}") (solder_mask_margin 0.2)) 10 | 11 | ) -------------------------------------------------------------------------------- /fixtures/m6/pcbs/alps_jumper_omron_via.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints: 5 | - what: alps 6 | params: 7 | from: a_from 8 | to: a_to 9 | - what: jumper 10 | params: 11 | from: j_from 12 | to: j_to 13 | adjust.shift: [40, 0] 14 | - what: omron 15 | params: 16 | from: o_from 17 | to: o_to 18 | adjust.shift: [80, 0] 19 | - what: via 20 | params: 21 | net: vnet 22 | adjust.shift: [120, 0] 23 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/trace_b.tpl: -------------------------------------------------------------------------------- 1 | (module trace_test (layer B.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (pad 1 smd rect (at 0 0 -30) (size 1 1) (layers B.Cu B.Paste B.Mask) 6 | (net {{net_P1_id}} "{{net_P1}}") (solder_mask_margin 0.2)) 7 | 8 | (pad 2 smd rect (at -5 5 -30) (size 1 1) (layers B.Cu B.Paste B.Mask) 9 | (net {{net_P1_id}} "{{net_P1}}") (solder_mask_margin 0.2)) 10 | 11 | ) -------------------------------------------------------------------------------- /fixtures/m5/outlines/basic.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left.key.bind: [,10,,] 6 | right.key.bind: [,,,10] 7 | rows: 8 | bottom.key.bind: [10,,,] 9 | top.key.bind: [,,10,] 10 | key: 11 | bind: [0, 0, 0, 0] 12 | outlines: 13 | outline: 14 | main: 15 | what: rectangle 16 | where: true 17 | size: 20 18 | min: 19 | what: rectangle 20 | where: true 21 | bound: false 22 | size: 14 23 | operation: subtract -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/basic.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left.key.bind: [,10,,] 6 | right.key.bind: [,,,10] 7 | rows: 8 | bottom.key.bind: [10,,,] 9 | top.key.bind: [,,10,] 10 | key: 11 | bind: [0, 0, 0, 0] 12 | outlines: 13 | outline: 14 | main: 15 | what: rectangle 16 | where: true 17 | size: 20 18 | min: 19 | what: rectangle 20 | where: true 21 | bound: false 22 | size: 14 23 | operation: subtract -------------------------------------------------------------------------------- /crates/ergogen-outline/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-outline" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | ergogen-core = { path = "../ergogen-core" } 8 | ergogen-geometry = { path = "../ergogen-geometry" } 9 | ergogen-layout = { path = "../ergogen-layout" } 10 | ergogen-parser = { path = "../ergogen-parser" } 11 | cavalier_contours = "0.6" 12 | indexmap = "2" 13 | regex = "1" 14 | thiserror = "2" 15 | 16 | [dev-dependencies] 17 | ergogen-export = { path = "../ergogen-export" } 18 | proptest = "1.5.0" 19 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/circles.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: {} 4 | mirror: 20 5 | outlines: 6 | outline: 7 | main: 8 | what: rectangle 9 | where: true 10 | size: 20 11 | bound: false 12 | middle_circle: 13 | what: circle 14 | where: 15 | aggregate.parts: 16 | - matrix 17 | - mirror_matrix 18 | radius: 15 19 | outside_circles: 20 | what: circle 21 | where: 22 | ref: matrix 23 | shift: [-10, 10] 24 | radius: 5 25 | asym: both -------------------------------------------------------------------------------- /fixtures/upstream/test/pcbs/kicad8_template.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | outlines.outline: 3 | - what: rectangle 4 | where: true 5 | size: [25,50] 6 | fillet: 0.5 7 | - what: circle 8 | where: true 9 | radius: 25 10 | - what: circle 11 | radius: 10 12 | where: 13 | - ref: matrix 14 | shift: [50,0] 15 | pcbs: 16 | main: 17 | template: kicad8 18 | outlines.main.outline: outline 19 | footprints: 20 | test: 21 | what: mx 22 | params: 23 | to: to 24 | from: from -------------------------------------------------------------------------------- /fixtures/m3/points/adjustments.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left: 6 | middle.rows.home.adjust: 7 | shift: [-2u, 0] 8 | rotate: 45 9 | right: 10 | key: 11 | stagger: 5 12 | spread: 25 13 | splay: -5 14 | origin: [-9, -9] 15 | rows: 16 | home: 17 | orient: -90 18 | shift: [0, 10] 19 | rotate: 90 20 | rows: 21 | bottom: 22 | home: 23 | top: -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/circles.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: {} 4 | mirror: 20 5 | outlines: 6 | outline: 7 | main: 8 | what: rectangle 9 | where: true 10 | size: 20 11 | bound: false 12 | middle_circle: 13 | what: circle 14 | where: 15 | aggregate.parts: 16 | - matrix 17 | - mirror_matrix 18 | radius: 15 19 | outside_circles: 20 | what: circle 21 | where: 22 | ref: matrix 23 | shift: [-10, 10] 24 | radius: 5 25 | asym: both -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/knuckles_utility_text.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.template: kicad8 5 | pcbs.pcb.footprints_search_paths: 6 | - knuckles/ergogen/footprints 7 | pcbs.pcb.footprints: 8 | - what: ceoloide/utility_text 9 | params: 10 | text: hello from utility_text 11 | reversible: true 12 | layer: SilkS 13 | height: 1 14 | width: 1 15 | thickness: 0.15 16 | bold: true 17 | italic: true 18 | knockout: true 19 | align: top left 20 | 21 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/adjustments.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: 4 | columns: 5 | left: 6 | middle.rows.home.adjust: 7 | shift: [-2u, 0] 8 | rotate: 45 9 | right: 10 | key: 11 | stagger: 5 12 | spread: 25 13 | splay: -5 14 | origin: [-9, -9] 15 | rows: 16 | home: 17 | orient: -90 18 | shift: [0, 10] 19 | rotate: 90 20 | rows: 21 | bottom: 22 | home: 23 | top: -------------------------------------------------------------------------------- /fixtures/m6/pcbs/oled_rgb_mirror.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points: 4 | mirror: 0 5 | zones: 6 | matrix: 7 | columns: 8 | col: 9 | rows: 10 | row: 11 | pcbs.pcb.footprints: 12 | - what: oled 13 | where: true 14 | asym: both 15 | params: 16 | SCL: scl 17 | SDA: sda 18 | GND: gnd 19 | VCC: vcc 20 | - what: rgb 21 | where: true 22 | asym: both 23 | params: 24 | din: din 25 | dout: dout 26 | VCC: vcc 27 | GND: gnd 28 | adjust.shift: [0, 20] 29 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/pad/up_back.tpl: -------------------------------------------------------------------------------- 1 | (module SMDPad (layer F.Cu) (tedit 5B24D78E) 2 | 3 | (at {{at}}) 4 | 5 | 6 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 7 | (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 8 | 9 | 10 | 11 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers B.Cu B.Paste B.Mask) (net {{net_net_id}} "{{net_net}}")) 12 | 13 | 14 | ) -------------------------------------------------------------------------------- /fixtures/upstream/test/footprints/trrs.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs.pcb.footprints: 3 | 4 | # basic 5 | - what: trrs 6 | params: 7 | A: A 8 | B: B 9 | C: C 10 | D: D 11 | 12 | # reversible 13 | - what: trrs 14 | params: 15 | A: A 16 | B: B 17 | C: C 18 | D: D 19 | reverse: true 20 | adjust.shift: [50, 0] 21 | 22 | # reversible + symmetric 23 | - what: trrs 24 | params: 25 | A: A 26 | B: B 27 | C: C 28 | D: D 29 | reverse: true 30 | symmetric: true 31 | adjust.shift: [100, 0] -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_kle/reference/points/demo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/rectangles.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: {} 4 | mirror: 20 5 | outlines: 6 | outline: 7 | main: 8 | what: rectangle 9 | where: true 10 | size: 20 11 | bound: false 12 | middle_rect: 13 | what: rectangle 14 | where: 15 | aggregate.parts: 16 | - matrix 17 | - mirror_matrix 18 | shift: [0, sy/2] 19 | size: [20, 40] 20 | corner: 5 21 | outside_rects: 22 | what: rectangle 23 | where: 24 | ref: matrix 25 | shift: [-10, 10] 26 | size: 10 27 | asym: both -------------------------------------------------------------------------------- /crates/ergogen-parser/tests/fixtures.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use ergogen_parser::PreparedConfig; 4 | 5 | #[test] 6 | fn parses_fixture_minimal_yaml() { 7 | let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); 8 | let workspace_root = manifest_dir 9 | .parent() 10 | .and_then(|p| p.parent()) 11 | .expect("workspace root"); 12 | let yaml = std::fs::read_to_string(workspace_root.join("fixtures/m1/minimal.yaml")).unwrap(); 13 | 14 | let prepared = PreparedConfig::from_yaml_str(&yaml).unwrap(); 15 | assert_eq!(prepared.units.get("foo"), Some(22.0)); 16 | } 17 | -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/rectangles.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: {} 4 | mirror: 20 5 | outlines: 6 | outline: 7 | main: 8 | what: rectangle 9 | where: true 10 | size: 20 11 | bound: false 12 | middle_rect: 13 | what: rectangle 14 | where: 15 | aggregate.parts: 16 | - matrix 17 | - mirror_matrix 18 | shift: [0, sy/2] 19 | size: [20, 40] 20 | corner: 5 21 | outside_rects: 22 | what: rectangle 23 | where: 24 | ref: matrix 25 | shift: [-10, 10] 26 | size: 10 27 | asym: both -------------------------------------------------------------------------------- /fixtures/m7/js_footprints/simple.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | params: { 3 | net: { type: "net", value: "GND" }, 4 | label: { type: "string", value: "JS" } 5 | }, 6 | body: p => ` 7 | (footprint "js_simple" 8 | (layer ${p.side}.Cu) 9 | ${p.at} 10 | (property "Reference" "${p.ref}" (at 0 0) (layer ${p.side}.SilkS) ${p.ref_hide}) 11 | (pad "1" thru_hole circle (at 0 0) (size 1 1) (drill 0.5) (layers *.Cu *.Mask) ${p.net}) 12 | (pad "2" thru_hole circle (at ${p.xy(1, 2)}) (size 1 1) (drill 0.5) (layers *.Cu *.Mask) ${p.local_net("A")}) 13 | (fp_text user "${p.label}" (at 0 1) (layer ${p.side}.SilkS)) 14 | ) 15 | `.trim() 16 | }; 17 | -------------------------------------------------------------------------------- /fixtures/m7/footprints/pad_templated.yaml: -------------------------------------------------------------------------------- 1 | name: pad_templated 2 | params: 3 | net: 4 | type: net 5 | required: true 6 | dx: 7 | type: number 8 | default: 0 9 | dy: 10 | type: number 11 | default: 0 12 | size_x: 13 | type: number 14 | default: 1 15 | size_y: 16 | type: number 17 | default: 1 18 | layer: 19 | type: string 20 | default: F.Cu 21 | primitives: 22 | - type: pad 23 | at: 24 | - "{{ dx }}" 25 | - "{{ dy }}" 26 | size: 27 | - "{{ size_x }}" 28 | - "{{ size_y }}" 29 | layers: 30 | - "{{ layer }}" 31 | - "F.Mask" 32 | net: "{{ net }}" 33 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/polygons.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: {} 4 | mirror: 20 5 | outlines: 6 | outline: 7 | main: 8 | what: rectangle 9 | where: true 10 | size: 20 11 | bound: false 12 | middle_poly: 13 | what: polygon 14 | where.aggregate.parts: 15 | - matrix 16 | - mirror_matrix 17 | points: 18 | - shift: [0, 20] 19 | - shift: [20, -40] 20 | - shift: [-40, 0] 21 | outside_polys: 22 | what: polygon 23 | where.ref: matrix 24 | points: 25 | - shift: [-10, 15] 26 | - shift: [5, -10] 27 | - shift: [-10, 0] 28 | asym: both -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/polygons.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | zones: 3 | matrix: {} 4 | mirror: 20 5 | outlines: 6 | outline: 7 | main: 8 | what: rectangle 9 | where: true 10 | size: 20 11 | bound: false 12 | middle_poly: 13 | what: polygon 14 | where.aggregate.parts: 15 | - matrix 16 | - mirror_matrix 17 | points: 18 | - shift: [0, 20] 19 | - shift: [20, -40] 20 | - shift: [-40, 0] 21 | outside_polys: 22 | what: polygon 23 | where.ref: matrix 24 | points: 25 | - shift: [-10, 15] 26 | - shift: [5, -10] 27 | - shift: [-10, 0] 28 | asym: both -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/source/canonical.yaml: -------------------------------------------------------------------------------- 1 | meta: 2 | author: MrZealot 3 | version: v3.14 4 | units: 5 | a: 28 + u 6 | points: 7 | zones: 8 | matrix: null 9 | outlines: 10 | export: 11 | - 12 | what: rectangle 13 | where: true 14 | size: 18 15 | _export: 16 | - 17 | what: rectangle 18 | where: true 19 | size: 18 20 | cases: 21 | export: 22 | - 23 | name: export 24 | extrude: 1 25 | _export: 26 | - 27 | name: export 28 | extrude: 1 29 | pcbs: 30 | export: {} 31 | _export: {} 32 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/path__outlines_arc_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | ARC 49 | 8 50 | 0 51 | 10 52 | 0 53 | 20 54 | 9.5 55 | 40 56 | 9.5 57 | 50 58 | 0 59 | 51 60 | 180 61 | 0 62 | LINE 63 | 8 64 | 0 65 | 10 66 | -9.5 67 | 20 68 | 9.5 69 | 11 70 | 9.5 71 | 21 72 | 9.5 73 | 0 74 | ENDSEC 75 | 0 76 | EOF -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/pad/base.tpl: -------------------------------------------------------------------------------- 1 | (module SMDPad (layer F.Cu) (tedit 5B24D78E) 2 | 3 | (at {{at}}) 4 | 5 | 6 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 7 | (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 8 | 9 | 10 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) (net {{net_net_id}} "{{net_net}}")) 11 | 12 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers B.Cu B.Paste B.Mask) (net {{net_net_id}} "{{net_net}}")) 13 | 14 | 15 | ) -------------------------------------------------------------------------------- /fixtures/m5/outlines/path__outlines_arc_path_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | ARC 49 | 8 50 | 0 51 | 10 52 | 0 53 | 20 54 | 9.5 55 | 40 56 | 9.5 57 | 50 58 | 0 59 | 51 60 | 180 61 | 0 62 | LINE 63 | 8 64 | 0 65 | 10 66 | 9.5 67 | 20 68 | 9.5 69 | 11 70 | -9.5 71 | 21 72 | 9.5 73 | 0 74 | ENDSEC 75 | 0 76 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/path__outlines_arc_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | ARC 49 | 8 50 | 0 51 | 10 52 | 0 53 | 20 54 | 9.5 55 | 40 56 | 9.5 57 | 50 58 | 0 59 | 51 60 | 180 61 | 0 62 | LINE 63 | 8 64 | 0 65 | 10 66 | -9.5 67 | 20 68 | 9.5 69 | 11 70 | 9.5 71 | 21 72 | 9.5 73 | 0 74 | ENDSEC 75 | 0 76 | EOF -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/pad/down_mirrored.tpl: -------------------------------------------------------------------------------- 1 | (module SMDPad (layer F.Cu) (tedit 5B24D78E) 2 | 3 | (at {{at}}) 4 | 5 | 6 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 7 | (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 8 | 9 | 10 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) (net {{net_net_id}} "{{net_net}}")) 11 | 12 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers B.Cu B.Paste B.Mask) (net {{net_net_id}} "{{net_net}}")) 13 | 14 | 15 | ) -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/pad/left_mirrored.tpl: -------------------------------------------------------------------------------- 1 | (module SMDPad (layer F.Cu) (tedit 5B24D78E) 2 | 3 | (at {{at}}) 4 | 5 | 6 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 7 | (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 8 | 9 | 10 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) (net {{net_net_id}} "{{net_net}}")) 11 | 12 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers B.Cu B.Paste B.Mask) (net {{net_net_id}} "{{net_net}}")) 13 | 14 | 15 | ) -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/pad/right_mirrored.tpl: -------------------------------------------------------------------------------- 1 | (module SMDPad (layer F.Cu) (tedit 5B24D78E) 2 | 3 | (at {{at}}) 4 | 5 | 6 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 7 | (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 8 | 9 | 10 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) (net {{net_net_id}} "{{net_net}}")) 11 | 12 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers B.Cu B.Paste B.Mask) (net {{net_net_id}} "{{net_net}}")) 13 | 14 | 15 | ) -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/path__outlines_arc_path_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | ARC 49 | 8 50 | 0 51 | 10 52 | 0 53 | 20 54 | 9.5 55 | 40 56 | 9.5 57 | 50 58 | 0 59 | 51 60 | 180 61 | 0 62 | LINE 63 | 8 64 | 0 65 | 10 66 | 9.5 67 | 20 68 | 9.5 69 | 11 70 | -9.5 71 | 21 72 | 9.5 73 | 0 74 | ENDSEC 75 | 0 76 | EOF -------------------------------------------------------------------------------- /footprints/pad.yaml: -------------------------------------------------------------------------------- 1 | name: pad 2 | module: SMDPad 3 | layer: F.Cu 4 | tedit: 5B24D78E 5 | ref_prefix: PAD 6 | net_order: 7 | - net 8 | params: 9 | net: 10 | type: net 11 | required: true 12 | primitives: 13 | - type: pad 14 | at: 15 | - 0 16 | - 0 17 | size: 18 | - 1 19 | - 1 20 | rotation: 0 21 | layers: 22 | - F.Cu 23 | - F.Paste 24 | - F.Mask 25 | net: "{{ net }}" 26 | number: "1" 27 | - type: pad 28 | at: 29 | - 0 30 | - 0 31 | size: 32 | - 1 33 | - 1 34 | rotation: 0 35 | layers: 36 | - B.Cu 37 | - B.Paste 38 | - B.Mask 39 | net: "{{ net }}" 40 | number: "1" 41 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/rest/jumper.tpl: -------------------------------------------------------------------------------- 1 | (module lib:Jumper (layer F.Cu) (tedit 5E1ADAC2) 2 | (at {{at}}) 3 | 4 | 5 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 6 | (fp_text value Jumper (at 0 -7.3) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15)))) 7 | 8 | 9 | (pad 1 smd rect (at -0.50038 0 0) (size 0.635 1.143) (layers F.Cu F.Paste F.Mask) 10 | (clearance 0.1905) (net {{net_from_id}} "{{net_from}}")) 11 | (pad 2 smd rect (at 0.50038 0 0) (size 0.635 1.143) (layers F.Cu F.Paste F.Mask) 12 | (clearance 0.1905) (net {{net_to_id}} "{{net_to}}"))) -------------------------------------------------------------------------------- /fixtures/m3/points/mirrors.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | mirror: 3 | ref: matrix_right_top 4 | distance: U 5 | zones: 6 | matrix: 7 | columns: 8 | left: 9 | rows: 10 | bottom.asym: source 11 | top.asym: clone 12 | right: 13 | rows: 14 | bottom: 15 | top: 16 | other: 17 | anchor: 18 | ref: matrix_right_top 19 | shift: [100, 100] 20 | # default mirror object, ref = [0, 0], distance = 0 21 | mirror: {} 22 | columns: 23 | left: 24 | rows: 25 | bottom.asym: source 26 | top.asym: clone 27 | right: 28 | rows: 29 | bottom: 30 | top: 31 | -------------------------------------------------------------------------------- /crates/ergogen-export/tests/jscad_v2.rs: -------------------------------------------------------------------------------- 1 | use ergogen_export::jscad::generate_cases_jscad_v2; 2 | use ergogen_parser::PreparedConfig; 3 | 4 | #[test] 5 | fn jscad_v2_uses_modern_api_for_jscad_app() { 6 | let yaml_path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) 7 | .join("../../fixtures/upstream/test/cases/cube.yaml"); 8 | let yaml = std::fs::read_to_string(yaml_path).unwrap(); 9 | let prepared = PreparedConfig::from_yaml_str(&yaml).unwrap(); 10 | 11 | let jscad = generate_cases_jscad_v2(&prepared, "cube").unwrap(); 12 | assert!(jscad.contains("require('@jscad/modeling')")); 13 | assert!(jscad.contains("module.exports = { main };")); 14 | assert!(!jscad.contains("CSG")); 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/m2/upstream/points_mirrors.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | mirror: 3 | ref: matrix_right_top 4 | distance: U 5 | zones: 6 | matrix: 7 | columns: 8 | left: 9 | rows: 10 | bottom.asym: source 11 | top.asym: clone 12 | right: 13 | rows: 14 | bottom: 15 | top: 16 | other: 17 | anchor: 18 | ref: matrix_right_top 19 | shift: [100, 100] 20 | # default mirror object, ref = [0, 0], distance = 0 21 | mirror: {} 22 | columns: 23 | left: 24 | rows: 25 | bottom.asym: source 26 | top.asym: clone 27 | right: 28 | rows: 29 | bottom: 30 | top: 31 | -------------------------------------------------------------------------------- /fixtures/m7/pcbs/spec_pad.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints_search_paths: 5 | - fixtures/m7/footprints 6 | pcbs.pcb.footprints: 7 | - what: spec 8 | params: 9 | spec: pad_minimal.yaml 10 | net: GND 11 | adjust.shift: [10, 0] 12 | - what: spec 13 | params: 14 | spec: pad_primitives.yaml 15 | net: VCC 16 | drill: 0.7 17 | adjust.shift: [30, 0] 18 | - what: spec 19 | params: 20 | spec: primitives_templated.yaml 21 | radius: 2.5 22 | line_w: 0.18 23 | arc_angle: 120 24 | rect_w: 6 25 | rect_h: 3 26 | text_size: 1.2 27 | label: T1 28 | adjust.shift: [50, 0] 29 | -------------------------------------------------------------------------------- /fixtures/upstream/test/footprints/chocmini.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs.pcb.footprints: 3 | 4 | # base 5 | - what: chocmini 6 | params: 7 | from: from 8 | to: to 9 | 10 | # keycap visualization 11 | - what: chocmini 12 | params: 13 | from: from 14 | to: to 15 | keycaps: true 16 | adjust.shift: [50, 0] 17 | 18 | # reverse 19 | - what: chocmini 20 | params: 21 | from: from 22 | to: to 23 | reverse: true 24 | adjust.shift: [100, 0] 25 | 26 | # reverse with keycap visualization 27 | - what: chocmini 28 | params: 29 | from: from 30 | to: to 31 | keycaps: true 32 | reverse: true 33 | adjust.shift: [150, 0] 34 | -------------------------------------------------------------------------------- /fixtures/upstream/test/points/mirrors.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | mirror: 3 | ref: matrix_right_top 4 | distance: U 5 | zones: 6 | matrix: 7 | columns: 8 | left: 9 | rows: 10 | bottom.asym: source 11 | top.asym: clone 12 | right: 13 | rows: 14 | bottom: 15 | top: 16 | other: 17 | anchor: 18 | ref: matrix_right_top 19 | shift: [100, 100] 20 | # default mirror object, ref = [0, 0], distance = 0 21 | mirror: {} 22 | columns: 23 | left: 24 | rows: 25 | bottom.asym: source 26 | top.asym: clone 27 | right: 28 | rows: 29 | bottom: 30 | top: 31 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/test/dynamic_net.tpl: -------------------------------------------------------------------------------- 1 | (module dynamic_net_test (layer F.Cu) (tedit 5CF31DEF) 2 | 3 | (at {{at}}) 4 | 5 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) 6 | (net {{net_T4_1_id}} "{{net_T4_1}}") (solder_mask_margin 0.2)) 7 | 8 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) 9 | (net {{net_T4_2_id}} "{{net_T4_2}}") (solder_mask_margin 0.2)) 10 | 11 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) 12 | (net {{net_T4_3_id}} "{{net_T4_3}}") (solder_mask_margin 0.2)) 13 | 14 | ) -------------------------------------------------------------------------------- /crates/ergogen-cli/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-cli" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [[bin]] 7 | name = "ergogen" 8 | path = "src/main.rs" 9 | 10 | [dependencies] 11 | clap = { version = "4", features = ["derive"] } 12 | ergogen-dxf2png = { path = "../ergogen-dxf2png" } 13 | ergogen-export = { path = "../ergogen-export" } 14 | ergogen-layout = { path = "../ergogen-layout" } 15 | ergogen-outline = { path = "../ergogen-outline" } 16 | ergogen-parser = { path = "../ergogen-parser" } 17 | ergogen-pcb = { path = "../ergogen-pcb", features = ["js-footprints"] } 18 | serde = { version = "1", features = ["derive"] } 19 | serde_yaml = "0.9" 20 | 21 | [dev-dependencies] 22 | serde_json = "1" 23 | tempfile = "3" 24 | -------------------------------------------------------------------------------- /fixtures/upstream/test/pcbs/outlines.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | columns: 3 | left: 4 | right: 5 | rows.only: 6 | outlines: 7 | left: 8 | out: 9 | what: rectangle 10 | where: matrix_left_only 11 | size: u 12 | fillet: u/5 13 | in: 14 | what: circle 15 | where: matrix_left_only 16 | radius: u/4 17 | operation: subtract 18 | right: 19 | out: 20 | what: rectangle 21 | where: matrix_right_only 22 | size: u 23 | bevel: u/5 24 | in: 25 | what: rectangle 26 | where: matrix_right_only 27 | size: u/2 28 | bevel: u/4 29 | operation: subtract 30 | pcbs: 31 | main: 32 | outlines: 33 | - outline: 'left' 34 | - outline: 'right' 35 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/path__outlines_line_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9.5 53 | 20 54 | 9.5 55 | 11 56 | 9.5 57 | 21 58 | 9.5 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | -9.5 65 | 20 66 | 9.5 67 | 11 68 | 0 69 | 21 70 | 19 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 0 77 | 20 78 | 19 79 | 11 80 | 9.5 81 | 21 82 | 9.5 83 | 0 84 | ENDSEC 85 | 0 86 | EOF -------------------------------------------------------------------------------- /fixtures/m5/outlines/outlines.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | key: 3 | padding: cy 4 | bind: 0.1 5 | zones: 6 | matrix: 7 | columns: 8 | one: 9 | two: 10 | rows: 11 | bottom: 12 | top: 13 | outlines: 14 | base: 15 | - what: rectangle 16 | where: true 17 | size: cy 18 | bound: true 19 | adjust: 20 | - what: circle 21 | where: true 22 | radius: 2 23 | # adjust works, and it can use shape-specific units 24 | adjust.shift: [0, r] 25 | fillet: 26 | - name: base 27 | fillet: 2 28 | scale: 29 | - name: fillet 30 | scale: 0.5 31 | combination: 32 | - "base" 33 | - "-scale" 34 | - "~fillet" 35 | expand: 36 | - name: combination 37 | expand: 1 38 | -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/path__outlines_line_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9.5 53 | 20 54 | 9.5 55 | 11 56 | 9.5 57 | 21 58 | 9.5 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | -9.5 65 | 20 66 | 9.5 67 | 11 68 | 0 69 | 21 70 | 19 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 0 77 | 20 78 | 19 79 | 11 80 | 9.5 81 | 21 82 | 9.5 83 | 0 84 | ENDSEC 85 | 0 86 | EOF -------------------------------------------------------------------------------- /fixtures/m6/pcbs/mx_choc_asym.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points: 4 | mirror: 0 5 | zones: 6 | matrix: 7 | anchor: 8 | shift: [10, 0] 9 | columns: 10 | col: 11 | rows: 12 | row: 13 | pcbs.pcb.footprints: 14 | - what: mx 15 | where: true 16 | asym: source 17 | params: 18 | from: net_from 19 | to: net_to 20 | keycaps: true 21 | - what: choc 22 | where: true 23 | asym: clone 24 | params: 25 | to: net_b 26 | from: net_a 27 | reverse: true 28 | adjust.shift: [0, 20] 29 | - what: mx 30 | where: true 31 | asym: both 32 | params: 33 | from: net_c 34 | to: net_d 35 | hotswap: true 36 | adjust.shift: [0, 40] 37 | -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/outlines.yaml: -------------------------------------------------------------------------------- 1 | points: 2 | key: 3 | padding: cy 4 | bind: 0.1 5 | zones: 6 | matrix: 7 | columns: 8 | one: 9 | two: 10 | rows: 11 | bottom: 12 | top: 13 | outlines: 14 | base: 15 | - what: rectangle 16 | where: true 17 | size: cy 18 | bound: true 19 | adjust: 20 | - what: circle 21 | where: true 22 | radius: 2 23 | # adjust works, and it can use shape-specific units 24 | adjust.shift: [0, r] 25 | fillet: 26 | - name: base 27 | fillet: 2 28 | scale: 29 | - name: fillet 30 | scale: 0.5 31 | combination: 32 | - "base" 33 | - "-scale" 34 | - "~fillet" 35 | expand: 36 | - name: combination 37 | expand: 1 38 | -------------------------------------------------------------------------------- /fixtures/m5/outlines/outlines___outlines_adjust_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | CIRCLE 49 | 8 50 | 0 51 | 10 52 | 0 53 | 20 54 | 2 55 | 40 56 | 2 57 | 0 58 | CIRCLE 59 | 8 60 | 0 61 | 10 62 | 0 63 | 20 64 | 19 65 | 40 66 | 2 67 | 0 68 | CIRCLE 69 | 8 70 | 0 71 | 10 72 | 19 73 | 20 74 | 2 75 | 40 76 | 2 77 | 0 78 | CIRCLE 79 | 8 80 | 0 81 | 10 82 | 19 83 | 20 84 | 19 85 | 40 86 | 2 87 | 0 88 | ENDSEC 89 | 0 90 | EOF -------------------------------------------------------------------------------- /fixtures/m5/outlines/path__outlines_s_curve_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | 9.5 53 | 20 54 | 9.5 55 | 11 56 | -9.5 57 | 21 58 | -9.5 59 | 0 60 | ARC 61 | 8 62 | 0 63 | 10 64 | 0 65 | 20 66 | 9.5 67 | 40 68 | 9.5 69 | 50 70 | 270 71 | 51 72 | 360 73 | 0 74 | ARC 75 | 8 76 | 0 77 | 10 78 | 0 79 | 20 80 | -9.5 81 | 40 82 | 9.5 83 | 50 84 | 90 85 | 51 86 | 180 87 | 0 88 | ENDSEC 89 | 0 90 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/outlines___outlines_adjust_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | CIRCLE 49 | 8 50 | 0 51 | 10 52 | 0 53 | 20 54 | 2 55 | 40 56 | 2 57 | 0 58 | CIRCLE 59 | 8 60 | 0 61 | 10 62 | 0 63 | 20 64 | 19 65 | 40 66 | 2 67 | 0 68 | CIRCLE 69 | 8 70 | 0 71 | 10 72 | 19 73 | 20 74 | 2 75 | 40 76 | 2 77 | 0 78 | CIRCLE 79 | 8 80 | 0 81 | 10 82 | 19 83 | 20 84 | 19 85 | 40 86 | 2 87 | 0 88 | ENDSEC 89 | 0 90 | EOF -------------------------------------------------------------------------------- /fixtures/m5/outlines/path__outlines_s_curve_path_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9.5 53 | 20 54 | -9.5 55 | 11 56 | 9.5 57 | 21 58 | 9.5 59 | 0 60 | ARC 61 | 8 62 | 0 63 | 10 64 | 0 65 | 20 66 | 9.5 67 | 40 68 | 9.5 69 | 50 70 | 270 71 | 51 72 | 360 73 | 0 74 | ARC 75 | 8 76 | 0 77 | 10 78 | 0 79 | 20 80 | -9.5 81 | 40 82 | 9.5 83 | 50 84 | 90 85 | 51 86 | 180 87 | 0 88 | ENDSEC 89 | 0 90 | EOF -------------------------------------------------------------------------------- /crates/ergogen-parser/examples/prepare.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use ergogen_parser::PreparedIr; 4 | 5 | fn main() { 6 | let mut args = std::env::args_os(); 7 | let _ = args.next(); 8 | let Some(path) = args.next() else { 9 | eprintln!("usage: prepare "); 10 | std::process::exit(2); 11 | }; 12 | 13 | let path = PathBuf::from(path); 14 | let raw = std::fs::read_to_string(&path).unwrap_or_else(|e| { 15 | eprintln!("failed to read {}: {e}", path.display()); 16 | std::process::exit(2); 17 | }); 18 | 19 | let ir = PreparedIr::from_yaml_str(&raw).unwrap_or_else(|e| { 20 | eprintln!("prepare failed: {e}"); 21 | std::process::exit(1); 22 | }); 23 | 24 | println!("{}", ir.canonical.to_json_compact_string()); 25 | } 26 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cases/operations.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: {} 2 | outlines: 3 | _square: 4 | - what: rectangle 5 | where: true 6 | size: [8, 8] 7 | _circle: 8 | - what: circle 9 | where: true 10 | radius: 3 11 | cases: 12 | _cube: 13 | - name: _square 14 | extrude: 8 15 | _cylinder_one: 16 | - name: _circle 17 | extrude: 8 18 | _subtract: 19 | target: 20 | name: _cube 21 | what: case 22 | tool: 23 | name: _cylinder_one 24 | what: case 25 | operation: subtract 26 | _cylinder_two: 27 | - name: _circle 28 | extrude: 8 29 | shift: [0,4,4] 30 | rotate: [90,0,0] 31 | _flat_square: 32 | - "_square" 33 | combination: 34 | - "_subtract" 35 | - "~_cylinder_two" 36 | - "+_flat_square" 37 | -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/path__outlines_s_curve_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | 9.5 53 | 20 54 | 9.5 55 | 11 56 | -9.5 57 | 21 58 | -9.5 59 | 0 60 | ARC 61 | 8 62 | 0 63 | 10 64 | 0 65 | 20 66 | 9.5 67 | 40 68 | 9.5 69 | 50 70 | 270 71 | 51 72 | 360 73 | 0 74 | ARC 75 | 8 76 | 0 77 | 10 78 | 0 79 | 20 80 | -9.5 81 | 40 82 | 9.5 83 | 50 84 | 90 85 | 51 86 | 180 87 | 0 88 | ENDSEC 89 | 0 90 | EOF -------------------------------------------------------------------------------- /fixtures/m6/pcbs/oled_rgb_scrollwheel_slider.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints: 5 | - what: oled 6 | params: 7 | SCL: scl 8 | SDA: sda 9 | GND: gnd 10 | VCC: vcc 11 | - what: rgb 12 | params: 13 | din: din 14 | dout: dout 15 | VCC: vcc 16 | GND: gnd 17 | adjust.shift: [40, 0] 18 | - what: scrollwheel 19 | params: 20 | from: sf 21 | to: st 22 | A: sa 23 | B: sb 24 | C: sc 25 | D: sd 26 | reverse: true 27 | adjust.shift: [0, 40] 28 | - what: slider 29 | params: 30 | from: sfrom 31 | to: sto 32 | side: B 33 | adjust.shift: [40, 40] 34 | - what: via 35 | params: 36 | net: gnd 37 | adjust.shift: [80, 0] 38 | -------------------------------------------------------------------------------- /fixtures/upstream/test/outlines/path__outlines_s_curve_path_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9.5 53 | 20 54 | -9.5 55 | 11 56 | 9.5 57 | 21 58 | 9.5 59 | 0 60 | ARC 61 | 8 62 | 0 63 | 10 64 | 0 65 | 20 66 | 9.5 67 | 40 68 | 9.5 69 | 50 70 | 270 71 | 51 72 | 360 73 | 0 74 | ARC 75 | 8 76 | 0 77 | 10 78 | 0 79 | 20 80 | -9.5 81 | 40 82 | 9.5 83 | 50 84 | 90 85 | 51 86 | 180 87 | 0 88 | ENDSEC 89 | 0 90 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/footprints/pad.yaml: -------------------------------------------------------------------------------- 1 | points.zones.matrix: 2 | pcbs.pcb.footprints: 3 | 4 | - what: pad 5 | params: 6 | net: net 7 | 8 | - what: pad 9 | params: 10 | net: net 11 | align: right 12 | text: text 13 | adjust.shift: [50, 0] 14 | 15 | - what: pad 16 | params: 17 | net: net 18 | align: up 19 | front: false 20 | adjust.shift: [0, 50] 21 | 22 | - what: pad 23 | params: 24 | net: net 25 | align: down 26 | mirrored: true 27 | adjust.shift: [50, 50] 28 | 29 | - what: pad 30 | params: 31 | net: net 32 | align: right 33 | mirrored: true 34 | adjust.shift: [100, 0] 35 | 36 | - what: pad 37 | params: 38 | net: net 39 | align: left 40 | mirrored: true 41 | adjust.shift: [100, 50] 42 | -------------------------------------------------------------------------------- /crates/ergogen-wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-wasm" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [lib] 7 | crate-type = ["cdylib", "rlib"] 8 | 9 | [dependencies] 10 | wasm-bindgen = "0.2" 11 | serde = { version = "1", features = ["derive"] } 12 | serde-wasm-bindgen = "0.6" 13 | ergogen-export = { path = "../ergogen-export" } 14 | ergogen-geometry = { path = "../ergogen-geometry" } 15 | ergogen-outline = { path = "../ergogen-outline" } 16 | ergogen-layout = { path = "../ergogen-layout" } 17 | ergogen-pcb = { path = "../ergogen-pcb" } 18 | ergogen-parser = { path = "../ergogen-parser" } 19 | indexmap = "2" 20 | 21 | [dev-dependencies] 22 | wasm-bindgen-test = "0.3" 23 | 24 | [target.'cfg(target_arch = "wasm32")'.dependencies] 25 | ergogen-pcb = { path = "../ergogen-pcb", features = ["js-footprints-wasm"] } 26 | -------------------------------------------------------------------------------- /fixtures/m7/footprints/visual_arc_text.yaml: -------------------------------------------------------------------------------- 1 | name: visual_arc_text 2 | params: 3 | label: 4 | type: string 5 | default: ARC90 6 | angle: 7 | type: number 8 | default: 90 9 | rotation: 10 | type: number 11 | default: 30 12 | primitives: 13 | - type: arc 14 | center: 15 | - 0 16 | - 0 17 | radius: 5 18 | start_angle: 0 19 | angle: "{{ angle }}" 20 | layer: F.SilkS 21 | width: 0.15 22 | - type: line 23 | start: 24 | - 0 25 | - 0 26 | end: 27 | - 5 28 | - 0 29 | layer: F.SilkS 30 | width: 0.15 31 | - type: text 32 | at: 33 | - 0 34 | - 7 35 | text: "{{ label }}" 36 | layer: F.SilkS 37 | size: 38 | - 1.2 39 | - 1.2 40 | thickness: 0.15 41 | rotation: "{{ rotation }}" 42 | justify: right 43 | hide: true 44 | -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/outlines/export.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | -9 55 | 11 56 | 9 57 | 21 58 | -9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | -9 67 | 11 68 | 9 69 | 21 70 | 9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | 9 79 | 11 80 | -9 81 | 21 82 | 9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | 9 91 | 11 92 | -9 93 | 21 94 | -9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/points/demo.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | 9 55 | 11 56 | 9 57 | 21 58 | 9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | 9 67 | 11 68 | 9 69 | 21 70 | -9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | -9 79 | 11 80 | -9 81 | 21 82 | -9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | -9 91 | 11 92 | -9 93 | 21 94 | 9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/bundle/reference/outlines/box.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | -9 55 | 11 56 | 9 57 | 21 58 | -9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | -9 67 | 11 68 | 9 69 | 21 70 | 9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | 9 79 | 11 80 | -9 81 | 21 82 | 9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | 9 91 | 11 92 | -9 93 | 21 94 | -9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal/reference/points/demo.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | 9 55 | 11 56 | 9 57 | 21 58 | 9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | 9 67 | 11 68 | 9 69 | 21 70 | -9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | -9 79 | 11 80 | -9 81 | 21 82 | -9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | -9 91 | 11 92 | -9 93 | 21 94 | 9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/big/reference/outlines/_export.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | -9 55 | 11 56 | 9 57 | 21 58 | -9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | -9 67 | 11 68 | 9 69 | 21 70 | 9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | 9 79 | 11 80 | -9 81 | 21 82 | 9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | 9 91 | 11 92 | -9 93 | 21 94 | -9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/clean/reference/outlines/export.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | -9 55 | 11 56 | 9 57 | 21 58 | -9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | -9 67 | 11 68 | 9 69 | 21 70 | 9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | 9 79 | 11 80 | -9 81 | 21 82 | 9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | 9 91 | 11 92 | -9 93 | 21 94 | -9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/medium/reference/outlines/export.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | -9 55 | 11 56 | 9 57 | 21 58 | -9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | -9 67 | 11 68 | 9 69 | 21 70 | 9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | 9 79 | 11 80 | -9 81 | 21 82 | 9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | 9 91 | 11 92 | -9 93 | 21 94 | -9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/minimal_yml/reference/points/demo.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | 9 55 | 11 56 | 9 57 | 21 58 | 9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | 9 67 | 11 68 | 9 69 | 21 70 | -9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | -9 79 | 11 80 | -9 81 | 21 82 | -9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | -9 91 | 11 92 | -9 93 | 21 94 | 9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/upstream/test/cli/no_clean/reference/outlines/export.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9 53 | 20 54 | -9 55 | 11 56 | 9 57 | 21 58 | -9 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | 9 65 | 20 66 | -9 67 | 11 68 | 9 69 | 21 70 | 9 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | 9 77 | 20 78 | 9 79 | 11 80 | -9 81 | 21 82 | 9 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | -9 89 | 20 90 | 9 91 | 11 92 | -9 93 | 21 94 | -9 95 | 0 96 | ENDSEC 97 | 0 98 | EOF -------------------------------------------------------------------------------- /fixtures/m6/reference_outputs/big/outlines/export.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -9.0 53 | 20 54 | -9.0 55 | 11 56 | -9.0 57 | 21 58 | 9.0 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | -9.0 65 | 20 66 | -9.0 67 | 11 68 | 9.0 69 | 21 70 | -9.0 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | -9.0 77 | 20 78 | 9.0 79 | 11 80 | 9.0 81 | 21 82 | 9.0 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | 9.0 89 | 20 90 | -9.0 91 | 11 92 | 9.0 93 | 21 94 | 9.0 95 | 0 96 | ENDSEC 97 | 0 98 | EOF 99 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/pad/right_text.tpl: -------------------------------------------------------------------------------- 1 | (module SMDPad (layer F.Cu) (tedit 5B24D78E) 2 | 3 | (at {{at}}) 4 | 5 | 6 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 7 | (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 8 | 9 | 10 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers F.Cu F.Paste F.Mask) (net {{net_net_id}} "{{net_net}}")) 11 | (fp_text user text (at 3 0 0) (layer F.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)) )) 12 | (pad 1 smd rect (at 0 0 0) (size 1 1) (layers B.Cu B.Paste B.Mask) (net {{net_net_id}} "{{net_net}}")) 13 | (fp_text user text (at 3 0 0) (layer B.SilkS) (effects (font (size 0.8 0.8) (thickness 0.15)) (justify mirror))) 14 | 15 | ) -------------------------------------------------------------------------------- /fixtures/m6/pcbs/pad_button_chocmini.yaml: -------------------------------------------------------------------------------- 1 | meta.author: Ergogen Tests 2 | meta.version: v9.9 3 | points.zones.matrix: 4 | pcbs.pcb.footprints: 5 | - what: chocmini 6 | params: 7 | from: net1 8 | to: net2 9 | keycaps: true 10 | reverse: true 11 | - what: button 12 | params: 13 | from: b1 14 | to: b2 15 | side: B 16 | adjust.shift: [40, 0] 17 | - what: pad 18 | params: 19 | net: net_p1 20 | align: right 21 | text: txt 22 | adjust.shift: [0, 40] 23 | - what: pad 24 | params: 25 | net: net_p2 26 | front: false 27 | adjust.shift: [40, 40] 28 | - what: pad 29 | params: 30 | net: net_p3 31 | align: left 32 | mirrored: true 33 | adjust.shift: [80, 0] 34 | - what: pad 35 | params: 36 | net: net_p4 37 | align: down 38 | mirrored: true 39 | adjust.shift: [80, 40] 40 | -------------------------------------------------------------------------------- /fixtures/m8/knuckles/knuckles_assets___outlines_pcb_dxf.dxf: -------------------------------------------------------------------------------- 1 | 0 2 | SECTION 3 | 2 4 | HEADER 5 | 9 6 | $INSUNITS 7 | 70 8 | 4 9 | 0 10 | ENDSEC 11 | 0 12 | SECTION 13 | 2 14 | TABLES 15 | 0 16 | TABLE 17 | 2 18 | LTYPE 19 | 0 20 | LTYPE 21 | 72 22 | 65 23 | 70 24 | 64 25 | 2 26 | CONTINUOUS 27 | 3 28 | ______ 29 | 73 30 | 0 31 | 40 32 | 0 33 | 0 34 | ENDTAB 35 | 0 36 | TABLE 37 | 2 38 | LAYER 39 | 0 40 | ENDTAB 41 | 0 42 | ENDSEC 43 | 0 44 | SECTION 45 | 2 46 | ENTITIES 47 | 0 48 | LINE 49 | 8 50 | 0 51 | 10 52 | -50.0 53 | 20 54 | -40.0 55 | 11 56 | -50.0 57 | 21 58 | 40.0 59 | 0 60 | LINE 61 | 8 62 | 0 63 | 10 64 | -50.0 65 | 20 66 | -40.0 67 | 11 68 | 50.0 69 | 21 70 | -40.0 71 | 0 72 | LINE 73 | 8 74 | 0 75 | 10 76 | -50.0 77 | 20 78 | 40.0 79 | 11 80 | 50.0 81 | 21 82 | 40.0 83 | 0 84 | LINE 85 | 8 86 | 0 87 | 10 88 | 50.0 89 | 20 90 | -40.0 91 | 11 92 | 50.0 93 | 21 94 | 40.0 95 | 0 96 | ENDSEC 97 | 0 98 | EOF 99 | -------------------------------------------------------------------------------- /fixtures/m7/footprints/pad_primitives.yaml: -------------------------------------------------------------------------------- 1 | name: pad_primitives 2 | params: 3 | net: 4 | type: net 5 | required: true 6 | drill: 7 | type: number 8 | default: 0.8 9 | primitives: 10 | - type: pad 11 | at: 12 | - 0 13 | - 0 14 | size: 15 | - 2 16 | - 2 17 | layers: 18 | - F.Cu 19 | - F.Mask 20 | net: "{{ net }}" 21 | - type: pad_thru 22 | at: 23 | - 5 24 | - 0 25 | size: 26 | - 1.6 27 | - 1.6 28 | drill: "{{ drill }}" 29 | layers: 30 | - F.Cu 31 | - B.Cu 32 | - F.Mask 33 | - B.Mask 34 | net: "{{ net }}" 35 | - type: circle 36 | center: 37 | - 0 38 | - 5 39 | radius: 1.5 40 | layer: F.SilkS 41 | width: 0.12 42 | - type: line 43 | start: 44 | - -2 45 | - -2 46 | end: 47 | - 2 48 | - -2 49 | layer: F.SilkS 50 | width: 0.12 51 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ergogen-pcb" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | ergogen-core = { path = "../ergogen-core" } 8 | ergogen-geometry = { path = "../ergogen-geometry" } 9 | ergogen-layout = { path = "../ergogen-layout" } 10 | ergogen-outline = { path = "../ergogen-outline" } 11 | ergogen-parser = { path = "../ergogen-parser" } 12 | cavalier_contours = "0.6" 13 | indexmap = "2" 14 | regex = "1" 15 | serde_json = "1" 16 | thiserror = "1" 17 | boa_engine = { version = "0.19", optional = true } 18 | wasm-bindgen = { version = "0.2", optional = true } 19 | js-sys = { version = "0.3", optional = true } 20 | serde-wasm-bindgen = { version = "0.6", optional = true } 21 | 22 | [features] 23 | js-footprints = ["boa_engine"] 24 | js-footprints-wasm = ["wasm-bindgen", "js-sys", "serde-wasm-bindgen"] 25 | 26 | [dev-dependencies] 27 | ergogen-export = { path = "../ergogen-export" } 28 | -------------------------------------------------------------------------------- /crates/ergogen-pcb/templates/footprints/rest/oled.tpl: -------------------------------------------------------------------------------- 1 | (module lib:OLED_headers (layer F.Cu) (tedit 5E1ADAC2) 2 | (at {{at}}) 3 | 4 | 5 | (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15)))) 6 | (fp_text value OLED (at 0 -7.3) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15)))) 7 | 8 | 9 | (pad 4 thru_hole oval (at 1.6 2.18 270) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 10 | (net {{net_SDA_id}} "{{net_SDA}}")) 11 | (pad 3 thru_hole oval (at 1.6 4.72 270) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 12 | (net {{net_SCL_id}} "{{net_SCL}}")) 13 | (pad 2 thru_hole oval (at 1.6 7.26 270) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 14 | (net {{net_VCC_id}} "{{net_VCC}}")) 15 | (pad 1 thru_hole rect (at 1.6 9.8 270) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask) 16 | (net {{net_GND_id}} "{{net_GND}}")) 17 | ) -------------------------------------------------------------------------------- /crates/ergogen-wasm/examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ergogen WASM Example 7 | 22 | 23 | 24 |

Ergogen WASM Example

25 |

Edit YAML and click Render.

26 | 27 | 28 |

Output

29 |

30 |     
31 |   
32 | 
33 | 


--------------------------------------------------------------------------------
/crates/ergogen-parser/tests/upstream_units.rs:
--------------------------------------------------------------------------------
 1 | use ergogen_parser::PreparedConfig;
 2 | 
 3 | #[test]
 4 | fn units_fixture_matches_upstream_snapshot() {
 5 |     let root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
 6 |         .parent()
 7 |         .and_then(|p| p.parent())
 8 |         .expect("workspace root")
 9 |         .to_path_buf();
10 |     let dir = root.join("fixtures/m3/points");
11 | 
12 |     let yaml = std::fs::read_to_string(dir.join("units.yaml")).unwrap();
13 |     let expected: std::collections::BTreeMap =
14 |         serde_json::from_str(&std::fs::read_to_string(dir.join("units___units.json")).unwrap())
15 |             .unwrap();
16 | 
17 |     let prepared = PreparedConfig::from_yaml_str(&yaml).unwrap();
18 |     let got: std::collections::BTreeMap = prepared
19 |         .units
20 |         .snapshot()
21 |         .into_iter()
22 |         .map(|e| (e.name, e.value))
23 |         .collect();
24 | 
25 |     assert_eq!(got, expected);
26 | }
27 | 


--------------------------------------------------------------------------------
/scripts/README.md:
--------------------------------------------------------------------------------
 1 | # Scripts
 2 | 
 3 | ## update-upstream-baselines.sh
 4 | 
 5 | Generate JS Ergogen baselines for fixture comparison.
 6 | 
 7 | Usage:
 8 | 
 9 | ```
10 | ./scripts/update-upstream-baselines.sh   [fixture-name]
11 | ```
12 | 
13 | Examples:
14 | 
15 | ```
16 | ./scripts/update-upstream-baselines.sh 8286e18f fixtures/upstream/fixtures/big.yaml big
17 | ./scripts/update-upstream-baselines.sh 8286e18f fixtures/upstream/fixtures/minimal.yaml minimal
18 | ```
19 | 
20 | Notes:
21 | - To pin a local clone, set `ERGOGEN_UPSTREAM_DIR=/path/to/ergogen`.
22 | - To override the command, set `ERGOGEN_UPSTREAM_CMD='npx -y ergogen'` (or another CLI command).
23 | - Outputs land in `fixtures/upstream-baselines///` with a `MANIFEST.txt`.
24 | 
25 | CI integration:
26 | - The upstream baselines workflow reads repository variables if inputs are empty:
27 |   - `UPSTREAM_BASELINE_COMMIT`
28 |   - `UPSTREAM_BASELINE_FIXTURE`
29 |   - `UPSTREAM_BASELINE_NAME`
30 | 


--------------------------------------------------------------------------------
/fixtures/m5/outlines/expand.yaml:
--------------------------------------------------------------------------------
 1 | points:
 2 |   zones:
 3 |     matrix: {}
 4 | outlines:
 5 |   base:
 6 |     - what: rectangle
 7 |       where: true
 8 |       size: 20
 9 |       bound: false
10 |   sh_beveled:
11 |     - what: outline
12 |       name: base
13 |       expand: "5]"
14 |   sh_round:
15 |     - what: outline
16 |       name: base
17 |       expand: "6)"
18 |   sh_pointy:
19 |     - what: outline
20 |       name: base
21 |       expand: "7>"
22 |   shorthand-combo:
23 |     - "sh_pointy"
24 |     - "-sh_round"
25 |     - "+sh_beveled"
26 |     - "-base"
27 |   jnt_beveled:
28 |     - what: outline
29 |       name: base
30 |       expand: 8
31 |       joints: beveled
32 |   jnt_round:
33 |     - what: outline
34 |       name: base
35 |       expand: 9
36 |       joints: round
37 |   jnt_pointy:
38 |     - what: outline
39 |       name: base
40 |       expand: 10
41 |       joints: pointy
42 |   joint-name-combo:
43 |     - "jnt_pointy"
44 |     - "-jnt_round"
45 |     - "+jnt_beveled"
46 |     - "-base"
47 | 


--------------------------------------------------------------------------------
/fixtures/m6/pcbs/trrs_rotary_promicro.yaml:
--------------------------------------------------------------------------------
 1 | meta.author: Ergogen Tests
 2 | meta.version: v9.9
 3 | points:
 4 |   mirror: 0
 5 |   zones:
 6 |     matrix:
 7 |       anchor:
 8 |         shift: [10, 0]
 9 |       columns:
10 |         col:
11 |           rows:
12 |             row:
13 | pcbs.pcb.footprints:
14 |   - what: promicro
15 |     where: true
16 |     asym: source
17 |     params:
18 |       orientation: up
19 |       VCC: vcc
20 |       GND: gnd
21 |       RAW: raw
22 |   - what: trrs
23 |     where: true
24 |     asym: clone
25 |     params:
26 |       D: net_d
27 |       B: net_b
28 |       A: net_a
29 |       C: net_c
30 |       reverse: true
31 |     adjust.shift: [0, 20]
32 |   - what: rotary
33 |     where: true
34 |     asym: both
35 |     params:
36 |       C: rc
37 |       from: rf
38 |       B: rb
39 |       to: rt
40 |       A: ra
41 |     adjust.shift: [0, 40]
42 |   - what: jstph
43 |     where: true
44 |     asym: both
45 |     params:
46 |       neg: n
47 |       pos: p
48 |     adjust.shift: [0, 60]
49 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/big/reference/points/points.yaml:
--------------------------------------------------------------------------------
 1 | matrix:
 2 |     x: 0
 3 |     'y': 0
 4 |     r: 0
 5 |     meta:
 6 |         stagger: 0
 7 |         spread: 19
 8 |         splay: 0
 9 |         origin:
10 |             - 0
11 |             - 0
12 |         orient: 0
13 |         shift:
14 |             - 0
15 |             - 0
16 |         rotate: 0
17 |         adjust: {}
18 |         width: 18
19 |         height: 18
20 |         padding: 19
21 |         autobind: 10
22 |         skip: false
23 |         asym: both
24 |         colrow: default_default
25 |         name: matrix
26 |         zone:
27 |             columns:
28 |                 default:
29 |                     rows: {}
30 |                     key: {}
31 |                     name: default
32 |             name: matrix
33 |         col:
34 |             rows: {}
35 |             key: {}
36 |             name: default
37 |         row: default
38 |         bind:
39 |             - 0
40 |             - 0
41 |             - 0
42 |             - 0
43 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/expand.yaml:
--------------------------------------------------------------------------------
 1 | points:
 2 |   zones:
 3 |     matrix: {}
 4 | outlines:
 5 |   base:
 6 |     - what: rectangle
 7 |       where: true
 8 |       size: 20
 9 |       bound: false
10 |   sh_beveled:
11 |     - what: outline
12 |       name: base
13 |       expand: "5]"
14 |   sh_round:
15 |     - what: outline
16 |       name: base
17 |       expand: "6)"
18 |   sh_pointy:
19 |     - what: outline
20 |       name: base
21 |       expand: "7>"
22 |   shorthand-combo:
23 |     - "sh_pointy"
24 |     - "-sh_round"
25 |     - "+sh_beveled"
26 |     - "-base"
27 |   jnt_beveled:
28 |     - what: outline
29 |       name: base
30 |       expand: 8
31 |       joints: beveled
32 |   jnt_round:
33 |     - what: outline
34 |       name: base
35 |       expand: 9
36 |       joints: round
37 |   jnt_pointy:
38 |     - what: outline
39 |       name: base
40 |       expand: 10
41 |       joints: pointy
42 |   joint-name-combo:
43 |     - "jnt_pointy"
44 |     - "-jnt_round"
45 |     - "+jnt_beveled"
46 |     - "-base"
47 | 


--------------------------------------------------------------------------------
/fixtures/m8/knuckles/knuckles_assets.yaml:
--------------------------------------------------------------------------------
 1 | meta:
 2 |   name: knuckles_assets
 3 |   version: v0.0
 4 |   author: Ergogen Tests
 5 | 
 6 | points:
 7 |   zones:
 8 |     # Minimal point set (single point at origin) so outline placement via `where: true` works.
 9 |     matrix: {}
10 | 
11 | outlines:
12 |   pcb:
13 |     - what: rectangle
14 |       where: true
15 |       size: [100, 80]
16 | 
17 | pcbs:
18 |   pcb:
19 |     template: kicad8
20 |     footprints_search_paths:
21 |       - knuckles/ergogen/footprints
22 |     outlines:
23 |       main:
24 |         outline: pcb
25 |     footprints:
26 |       - what: ceoloide/mounting_hole_npth
27 |         params:
28 |           hole_size: "2.2"
29 |           hole_drill: "2.2"
30 |           side: F
31 |         adjust:
32 |           shift: [0, 0]
33 |       - what: ceoloide/diode_tht_sod123
34 |         params:
35 |           side: F
36 |           reversible: false
37 |           include_tht: false
38 |           from: NET1
39 |           to: NET2
40 |         adjust:
41 |           shift: [10, 0]
42 | 
43 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/minimal/reference/points/points.yaml:
--------------------------------------------------------------------------------
 1 | matrix_col_row:
 2 |     x: 0
 3 |     'y': 0
 4 |     r: 0
 5 |     meta:
 6 |         stagger: 0
 7 |         spread: 19
 8 |         splay: 0
 9 |         origin:
10 |             - 0
11 |             - 0
12 |         orient: 0
13 |         shift:
14 |             - 0
15 |             - 0
16 |         rotate: 0
17 |         adjust: {}
18 |         width: 18
19 |         height: 18
20 |         padding: 19
21 |         autobind: 10
22 |         skip: false
23 |         asym: both
24 |         colrow: col_row
25 |         name: matrix_col_row
26 |         zone:
27 |             columns:
28 |                 col:
29 |                     rows: {}
30 |                     key: {}
31 |                     name: col
32 |             rows:
33 |                 row: {}
34 |             name: matrix
35 |         col:
36 |             rows: {}
37 |             key: {}
38 |             name: col
39 |         row: row
40 |         bind:
41 |             - 0
42 |             - 0
43 |             - 0
44 |             - 0
45 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/minimal_yml/reference/points/points.yaml:
--------------------------------------------------------------------------------
 1 | matrix_col_row:
 2 |     x: 0
 3 |     'y': 0
 4 |     r: 0
 5 |     meta:
 6 |         stagger: 0
 7 |         spread: 19
 8 |         splay: 0
 9 |         origin:
10 |             - 0
11 |             - 0
12 |         orient: 0
13 |         shift:
14 |             - 0
15 |             - 0
16 |         rotate: 0
17 |         adjust: {}
18 |         width: 18
19 |         height: 18
20 |         padding: 19
21 |         autobind: 10
22 |         skip: false
23 |         asym: both
24 |         colrow: col_row
25 |         name: matrix_col_row
26 |         zone:
27 |             columns:
28 |                 col:
29 |                     rows: {}
30 |                     key: {}
31 |                     name: col
32 |             rows:
33 |                 row: {}
34 |             name: matrix
35 |         col:
36 |             rows: {}
37 |             key: {}
38 |             name: col
39 |         row: row
40 |         bind:
41 |             - 0
42 |             - 0
43 |             - 0
44 |             - 0
45 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/footprints/mx.yaml:
--------------------------------------------------------------------------------
 1 | points.zones.matrix:
 2 | pcbs.pcb.footprints:
 3 |   
 4 |   # base
 5 |   - what: mx
 6 |     params:
 7 |       from: from
 8 |       to: to
 9 |   
10 |   # keycap visualization
11 |   - what: mx
12 |     params:
13 |       from: from
14 |       to: to
15 |       keycaps: true
16 |     adjust.shift: [50, 0]
17 | 
18 |   # reverse
19 |   - what: mx
20 |     params:
21 |       from: from
22 |       to: to
23 |       reverse: true
24 |     adjust.shift: [100, 0]
25 | 
26 |   # hotswap
27 |   - what: mx
28 |     params:
29 |       from: from
30 |       to: to
31 |       hotswap: true
32 |     adjust.shift: [150, 0]
33 | 
34 |   # both reverse and hotswap
35 |   - what: mx
36 |     params:
37 |       from: from
38 |       to: to
39 |       reverse: true
40 |       hotswap: true
41 |     adjust.shift: [200, 0]
42 | 
43 |   # all of keycaps, reverse and hotswap
44 |   - what: mx
45 |     params:
46 |       from: from
47 |       to: to
48 |       keycaps: true
49 |       reverse: true
50 |       hotswap: true
51 |     adjust.shift: [250, 0]
52 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/footprints/choc.yaml:
--------------------------------------------------------------------------------
 1 | points.zones.matrix:
 2 | pcbs.pcb.footprints:
 3 |   
 4 |   # base
 5 |   - what: choc
 6 |     params:
 7 |       from: from
 8 |       to: to
 9 |   
10 |   # keycap visualization
11 |   - what: choc
12 |     params:
13 |       from: from
14 |       to: to
15 |       keycaps: true
16 |     adjust.shift: [50, 0]
17 | 
18 |   # reverse
19 |   - what: choc
20 |     params:
21 |       from: from
22 |       to: to
23 |       reverse: true
24 |     adjust.shift: [100, 0]
25 | 
26 |   # hotswap
27 |   - what: choc
28 |     params:
29 |       from: from
30 |       to: to
31 |       hotswap: true
32 |     adjust.shift: [150, 0]
33 | 
34 |   # both reverse and hotswap
35 |   - what: choc
36 |     params:
37 |       from: from
38 |       to: to
39 |       reverse: true
40 |       hotswap: true
41 |     adjust.shift: [200, 0]
42 | 
43 |   # all of keycaps, reverse and hotswap
44 |   - what: choc
45 |     params:
46 |       from: from
47 |       to: to
48 |       keycaps: true
49 |       reverse: true
50 |       hotswap: true
51 |     adjust.shift: [250, 0]
52 | 


--------------------------------------------------------------------------------
/crates/ergogen-pcb/tests/virtual_fs.rs:
--------------------------------------------------------------------------------
 1 | use indexmap::IndexMap;
 2 | 
 3 | #[test]
 4 | fn spec_search_paths_can_resolve_from_virtual_fs_without_disk_files() {
 5 |     let mut files = IndexMap::new();
 6 |     files.insert(
 7 |         "footprints/specs/test.yaml".to_string(),
 8 |         r#"
 9 | name: test
10 | params:
11 |   net:
12 |     type: net
13 |     required: true
14 | primitives:
15 |   - type: pad
16 |     at: [0, 0]
17 |     size: [1, 1]
18 |     layers: [F.Cu]
19 |     net: "{{ net }}"
20 | "#
21 |         .to_string(),
22 |     );
23 |     ergogen_pcb::set_virtual_files(files);
24 | 
25 |     let yaml = r#"
26 | points.zones.matrix: {}
27 | pcbs:
28 |   pcb:
29 |     template: kicad8
30 |     outlines: {}
31 |     footprints_search_paths:
32 |       - footprints/specs
33 |     footprints:
34 |       - what: spec
35 |         where: true
36 |         params:
37 |           spec: test.yaml
38 |           net: GND
39 | "#;
40 | 
41 |     let pcb = ergogen_pcb::generate_kicad_pcb_from_yaml_str(yaml, "pcb").expect("pcb renders");
42 |     assert!(pcb.contains("\"GND\""));
43 | 
44 |     ergogen_pcb::clear_virtual_files();
45 | }
46 | 


--------------------------------------------------------------------------------
/crates/ergogen-export/tests/m3_points_dxf.rs:
--------------------------------------------------------------------------------
 1 | use std::path::PathBuf;
 2 | 
 3 | use ergogen_export::dxf::{Dxf, NormalizeOptions};
 4 | 
 5 | fn workspace_root() -> PathBuf {
 6 |     PathBuf::from(env!("CARGO_MANIFEST_DIR"))
 7 |         .parent()
 8 |         .and_then(|p| p.parent())
 9 |         .expect("workspace root")
10 |         .to_path_buf()
11 | }
12 | 
13 | #[test]
14 | fn parses_and_normalizes_all_m3_points_dxfs() {
15 |     let root = workspace_root();
16 |     let dir = root.join("fixtures/m3/points");
17 | 
18 |     let mut dxfs: Vec<_> = std::fs::read_dir(&dir)
19 |         .unwrap()
20 |         .filter_map(|e| e.ok())
21 |         .map(|e| e.path())
22 |         .filter(|p| p.extension().is_some_and(|ext| ext == "dxf"))
23 |         .collect();
24 |     dxfs.sort();
25 | 
26 |     assert!(!dxfs.is_empty(), "no .dxf files found in {dir:?}");
27 | 
28 |     for path in dxfs {
29 |         let dxf =
30 |             Dxf::parse_file(&path).unwrap_or_else(|e| panic!("failed to parse {path:?}: {e}"));
31 |         dxf.normalize(NormalizeOptions::default())
32 |             .unwrap_or_else(|e| panic!("failed to normalize {path:?}: {e}"));
33 |     }
34 | }
35 | 


--------------------------------------------------------------------------------
/crates/ergogen-export/tests/dxf_compare_files.rs:
--------------------------------------------------------------------------------
 1 | use ergogen_export::dxf::{NormalizeOptions, compare_files_semantic};
 2 | 
 3 | #[test]
 4 | fn compares_two_files_semantically() {
 5 |     let tmp = std::env::temp_dir().join("ergogen-export-dxf-compare");
 6 |     std::fs::create_dir_all(&tmp).unwrap();
 7 | 
 8 |     let left_path = tmp.join("left.dxf");
 9 |     let right_path = tmp.join("right.dxf");
10 | 
11 |     // Same entities, different ordering and LINE direction.
12 |     let left = r#"0
13 | SECTION
14 | 2
15 | ENTITIES
16 | 0
17 | LINE
18 | 10
19 | 0
20 | 20
21 | 0
22 | 11
23 | 1
24 | 21
25 | 0
26 | 0
27 | CIRCLE
28 | 10
29 | 5
30 | 20
31 | 6
32 | 40
33 | 7
34 | 0
35 | ENDSEC
36 | 0
37 | EOF
38 | "#;
39 | 
40 |     let right = r#"0
41 | SECTION
42 | 2
43 | ENTITIES
44 | 0
45 | CIRCLE
46 | 10
47 | 5
48 | 20
49 | 6
50 | 40
51 | 7
52 | 0
53 | LINE
54 | 10
55 | 1
56 | 20
57 | 0
58 | 11
59 | 0
60 | 21
61 | 0
62 | 0
63 | ENDSEC
64 | 0
65 | EOF
66 | "#;
67 | 
68 |     std::fs::write(&left_path, left).unwrap();
69 |     std::fs::write(&right_path, right).unwrap();
70 | 
71 |     compare_files_semantic(&left_path, &right_path, NormalizeOptions::default()).unwrap();
72 | }
73 | 


--------------------------------------------------------------------------------
/crates/ergogen-export/tests/m5_outlines_dxf.rs:
--------------------------------------------------------------------------------
 1 | use std::path::PathBuf;
 2 | 
 3 | use ergogen_export::dxf::{Dxf, NormalizeOptions};
 4 | 
 5 | fn workspace_root() -> PathBuf {
 6 |     PathBuf::from(env!("CARGO_MANIFEST_DIR"))
 7 |         .parent()
 8 |         .and_then(|p| p.parent())
 9 |         .expect("workspace root")
10 |         .to_path_buf()
11 | }
12 | 
13 | #[test]
14 | fn parses_and_normalizes_all_m5_outline_goldens() {
15 |     let root = workspace_root();
16 |     let dir = root.join("fixtures/m5/outlines");
17 | 
18 |     let mut dxfs: Vec<_> = std::fs::read_dir(&dir)
19 |         .unwrap()
20 |         .filter_map(|e| e.ok())
21 |         .map(|e| e.path())
22 |         .filter(|p| p.extension().is_some_and(|ext| ext == "dxf"))
23 |         .collect();
24 |     dxfs.sort();
25 | 
26 |     assert!(!dxfs.is_empty(), "no .dxf files found in {dir:?}");
27 | 
28 |     for path in dxfs {
29 |         let dxf =
30 |             Dxf::parse_file(&path).unwrap_or_else(|e| panic!("failed to parse {path:?}: {e}"));
31 |         dxf.normalize(NormalizeOptions::default())
32 |             .unwrap_or_else(|e| panic!("failed to normalize {path:?}: {e}"));
33 |     }
34 | }
35 | 


--------------------------------------------------------------------------------
/fixtures/m5/outlines/hull___outlines_extend_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 200
 53 | 20
 54 | 0
 55 | 11
 56 | 155
 57 | 21
 58 | 19
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 155
 65 | 20
 66 | 19
 67 | 11
 68 | 155
 69 | 21
 70 | 38
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 155
 77 | 20
 78 | 38
 79 | 11
 80 | 45
 81 | 21
 82 | 38
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 45
 89 | 20
 90 | 38
 91 | 11
 92 | 45
 93 | 21
 94 | 19
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 45
101 | 20
102 | 19
103 | 11
104 | 0
105 | 21
106 | 0
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 0
113 | 20
114 | 0
115 | 11
116 | 200
117 | 21
118 | 0
119 | 0
120 | ENDSEC
121 | 0
122 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/hull___outlines_extend_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 200
 53 | 20
 54 | 0
 55 | 11
 56 | 155
 57 | 21
 58 | 19
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 155
 65 | 20
 66 | 19
 67 | 11
 68 | 155
 69 | 21
 70 | 38
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 155
 77 | 20
 78 | 38
 79 | 11
 80 | 45
 81 | 21
 82 | 38
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 45
 89 | 20
 90 | 38
 91 | 11
 92 | 45
 93 | 21
 94 | 19
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 45
101 | 20
102 | 19
103 | 11
104 | 0
105 | 21
106 | 0
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 0
113 | 20
114 | 0
115 | 11
116 | 200
117 | 21
118 | 0
119 | 0
120 | ENDSEC
121 | 0
122 | EOF


--------------------------------------------------------------------------------
/crates/ergogen-cli/tests/render_smoke.rs:
--------------------------------------------------------------------------------
 1 | use std::path::PathBuf;
 2 | use std::process::Command;
 3 | 
 4 | fn workspace_root() -> PathBuf {
 5 |     PathBuf::from(env!("CARGO_MANIFEST_DIR"))
 6 |         .parent()
 7 |         .and_then(|p| p.parent())
 8 |         .expect("workspace root")
 9 |         .to_path_buf()
10 | }
11 | 
12 | #[test]
13 | fn render_bundle_folder_smoke() {
14 |     let bin = env!("CARGO_BIN_EXE_ergogen");
15 |     let input = workspace_root().join("fixtures/upstream/fixtures/bundle");
16 |     let out_dir = tempfile::tempdir().expect("tempdir");
17 |     let output = out_dir.path().join("output");
18 | 
19 |     let status = Command::new(bin)
20 |         .args([
21 |             "render",
22 |             input.to_string_lossy().as_ref(),
23 |             "--output",
24 |             output.to_string_lossy().as_ref(),
25 |             "--clean",
26 |         ])
27 |         .status()
28 |         .expect("run ergogen render");
29 |     assert!(status.success());
30 | 
31 |     assert!(output.join("outlines/box.dxf").is_file());
32 |     assert!(output.join("pcbs/pcb.kicad_pcb").is_file());
33 |     assert!(output.join("pcbs/custom_template.kicad_pcb").is_file());
34 | }
35 | 


--------------------------------------------------------------------------------
/crates/ergogen-parser/tests/m2_canonical.rs:
--------------------------------------------------------------------------------
 1 | use std::path::PathBuf;
 2 | 
 3 | use ergogen_parser::PreparedIr;
 4 | 
 5 | fn workspace_root() -> PathBuf {
 6 |     PathBuf::from(env!("CARGO_MANIFEST_DIR"))
 7 |         .parent()
 8 |         .and_then(|p| p.parent())
 9 |         .expect("workspace root")
10 |         .to_path_buf()
11 | }
12 | 
13 | fn assert_canonical_fixture(name: &str) {
14 |     let root = workspace_root();
15 |     let yaml_path = root.join(format!("fixtures/m2/upstream/{name}.yaml"));
16 |     let json_path = root.join(format!("fixtures/m2/upstream/{name}.canonical.json"));
17 | 
18 |     let yaml = std::fs::read_to_string(&yaml_path).unwrap();
19 |     let expected = std::fs::read_to_string(&json_path).unwrap();
20 | 
21 |     let ir = PreparedIr::from_yaml_str(&yaml).unwrap();
22 |     let got = ir.canonical.to_json_compact_string();
23 | 
24 |     assert_eq!(got, expected.trim_end(), "fixture={name}");
25 | }
26 | 
27 | #[test]
28 | fn canonical_matches_snapshots_for_upstream_points_fixtures() {
29 |     for name in [
30 |         "points_default",
31 |         "points_units",
32 |         "points_overrides",
33 |         "points_mirrors",
34 |         "points_rotations",
35 |     ] {
36 |         assert_canonical_fixture(name);
37 |     }
38 | }
39 | 


--------------------------------------------------------------------------------
/crates/ergogen-wasm/README.md:
--------------------------------------------------------------------------------
 1 | # ergogen-wasm
 2 | 
 3 | Minimal WASM entrypoint crate for Ergogen‑RS.
 4 | 
 5 | ## Current API
 6 | 
 7 | ```js
 8 | import init, { version, render_pcb, render_dxf, render_svg, render_all } from "ergogen_wasm";
 9 | 
10 | await init();
11 | console.log(version());
12 | const pcb = render_pcb(configYaml, "pcb");
13 | const outlineDxf = render_dxf(configYaml, "outline");
14 | const outlineSvg = render_svg(configYaml, "outline");
15 | const outputs = render_all(configYaml);
16 | ```
17 | 
18 | Rendering APIs are available for PCB + outline exports. `render_all` returns the
19 | same shape expected by the web UI (canonical/points/units, demo DXF/SVG, outlines,
20 | cases JSCAD, and PCBs), plus an `errors` array for per-target failures.
21 | 
22 | ## JS Footprints (WASM)
23 | 
24 | The wasm bridge expects host JS functions to exist:
25 | 
26 | ```js
27 | import {
28 |   installErgogenJsFootprints,
29 |   registerErgogenJsFootprintSource
30 | } from "./js/footprints.js";
31 | 
32 | installErgogenJsFootprints();
33 | registerErgogenJsFootprintSource("simple.js", "module.exports = { ... }");
34 | ```
35 | 
36 | The host can also provide a global `ergogenJsFootprintSourceLoader(path)` function
37 | to load footprints dynamically (e.g., via `fetch` or a registry map).
38 | 


--------------------------------------------------------------------------------
/fixtures/m5/outlines/hull___outlines_defaults_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 54
 53 | 20
 54 | 47
 55 | 11
 56 | 36
 57 | 21
 58 | 47
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 36
 65 | 20
 66 | 47
 67 | 11
 68 | 21.6
 69 | 21
 70 | 36
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | -36
 77 | 20
 78 | 36
 79 | 11
 80 | 21.6
 81 | 21
 82 | 36
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -36
 89 | 20
 90 | -36
 91 | 11
 92 | -36
 93 | 21
 94 | 36
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -36
101 | 20
102 | -36
103 | 11
104 | 36
105 | 21
106 | -36
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 36
113 | 20
114 | -36
115 | 11
116 | 54
117 | 21
118 | -9
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 54
125 | 20
126 | -9
127 | 11
128 | 54
129 | 21
130 | 47
131 | 0
132 | ENDSEC
133 | 0
134 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/hull___outlines_defaults_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 54
 53 | 20
 54 | 47
 55 | 11
 56 | 36
 57 | 21
 58 | 47
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 36
 65 | 20
 66 | 47
 67 | 11
 68 | 21.6
 69 | 21
 70 | 36
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | -36
 77 | 20
 78 | 36
 79 | 11
 80 | 21.6
 81 | 21
 82 | 36
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -36
 89 | 20
 90 | -36
 91 | 11
 92 | -36
 93 | 21
 94 | 36
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -36
101 | 20
102 | -36
103 | 11
104 | 36
105 | 21
106 | -36
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 36
113 | 20
114 | -36
115 | 11
116 | 54
117 | 21
118 | -9
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 54
125 | 20
126 | -9
127 | 11
128 | 54
129 | 21
130 | 47
131 | 0
132 | ENDSEC
133 | 0
134 | EOF


--------------------------------------------------------------------------------
/crates/ergogen-pcb/templates/footprints/rest/alps.tpl:
--------------------------------------------------------------------------------
 1 | (module ALPS (layer F.Cu) (tedit 5CF31DEF)
 2 | 
 3 |         (at {{at}})
 4 |         
 5 |         
 6 |         (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
 7 |         (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
 8 |         
 9 |         
10 |         (fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15))
11 |         (fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15))
12 |         (fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15))
13 |         (fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15))
14 |         (fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15))
15 |         (fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15))
16 |         (fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15))
17 |         (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))
18 | 
19 |         
20 |         (pad 1 thru_hole circle (at 2.5 -4.5) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) (net {{net_from_id}} "{{net_from}}"))
21 |         (pad 2 thru_hole circle (at -2.5 -4) (size 2.25 2.25) (drill 1.47) (layers *.Cu *.Mask) (net {{net_to_id}} "{{net_to}}"))
22 |     )


--------------------------------------------------------------------------------
/fixtures/m5/outlines/affect_mirror.yaml:
--------------------------------------------------------------------------------
 1 | points:
 2 |   zones:
 3 |     matrix:
 4 |       columns:
 5 |         only:
 6 |       rows:
 7 |         bottom:
 8 |         top:
 9 |   mirror:
10 |     ref: matrix_only_top
11 |     distance: 30
12 | outlines:
13 |   test:
14 |     keys:
15 |       what: rectangle
16 |       where: true
17 |       size: 14
18 |       bound: false
19 |     rb:
20 |       what: rectangle
21 |       where:
22 |         - ref: mirror_matrix_only_bottom
23 |           # we do NOT specify `affect: xyr` here
24 |         - shift: [-3,-3]
25 |           orient: 30
26 |       size: [6,6]
27 |       operation: stack
28 |     rt:
29 |       what: rectangle
30 |       where:
31 |         - ref: mirror_matrix_only_top
32 |           affect: xyr
33 |         - shift: [-3,-3]
34 |           orient: 30
35 |       size: [6,6]
36 |       operation: stack
37 |     lb:
38 |       what: rectangle
39 |       where:
40 |         - ref: matrix_only_bottom
41 |           # again, no `affect: xyr`
42 |         - shift: [-3,-3]
43 |           orient: 30
44 |       size: [6,6]
45 |       operation: stack
46 |     lt:
47 |       what: rectangle
48 |       where:
49 |         - ref: matrix_only_top
50 |           affect: xyr
51 |         - shift: [-3,-3]
52 |           orient: 30
53 |       size: [6,6]
54 |       operation: stack


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/affect_mirror.yaml:
--------------------------------------------------------------------------------
 1 | points:
 2 |   zones:
 3 |     matrix:
 4 |       columns:
 5 |         only:
 6 |       rows:
 7 |         bottom:
 8 |         top:
 9 |   mirror:
10 |     ref: matrix_only_top
11 |     distance: 30
12 | outlines:
13 |   test:
14 |     keys:
15 |       what: rectangle
16 |       where: true
17 |       size: 14
18 |       bound: false
19 |     rb:
20 |       what: rectangle
21 |       where:
22 |         - ref: mirror_matrix_only_bottom
23 |           # we do NOT specify `affect: xyr` here
24 |         - shift: [-3,-3]
25 |           orient: 30
26 |       size: [6,6]
27 |       operation: stack
28 |     rt:
29 |       what: rectangle
30 |       where:
31 |         - ref: mirror_matrix_only_top
32 |           affect: xyr
33 |         - shift: [-3,-3]
34 |           orient: 30
35 |       size: [6,6]
36 |       operation: stack
37 |     lb:
38 |       what: rectangle
39 |       where:
40 |         - ref: matrix_only_bottom
41 |           # again, no `affect: xyr`
42 |         - shift: [-3,-3]
43 |           orient: 30
44 |       size: [6,6]
45 |       operation: stack
46 |     lt:
47 |       what: rectangle
48 |       where:
49 |         - ref: matrix_only_top
50 |           affect: xyr
51 |         - shift: [-3,-3]
52 |           orient: 30
53 |       size: [6,6]
54 |       operation: stack


--------------------------------------------------------------------------------
/fixtures/m3/points/default___demo_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -9
 53 | 20
 54 | 9
 55 | 11
 56 | 9
 57 | 21
 58 | 9
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 9
 65 | 20
 66 | 9
 67 | 11
 68 | 9
 69 | 21
 70 | -9
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 9
 77 | 20
 78 | -9
 79 | 11
 80 | -9
 81 | 21
 82 | -9
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -9
 89 | 20
 90 | -9
 91 | 11
 92 | -9
 93 | 21
 94 | 9
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -9
101 | 20
102 | 9
103 | 11
104 | 9
105 | 21
106 | 9
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 9
113 | 20
114 | 9
115 | 11
116 | 9
117 | 21
118 | -9
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 9
125 | 20
126 | -9
127 | 11
128 | -9
129 | 21
130 | -9
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | -9
137 | 20
138 | -9
139 | 11
140 | -9
141 | 21
142 | 9
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/m3/points/mirror_variable__demo_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -9
 53 | 20
 54 | 9
 55 | 11
 56 | 9
 57 | 21
 58 | 9
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 9
 65 | 20
 66 | 9
 67 | 11
 68 | 9
 69 | 21
 70 | -9
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 9
 77 | 20
 78 | -9
 79 | 11
 80 | -9
 81 | 21
 82 | -9
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -9
 89 | 20
 90 | -9
 91 | 11
 92 | -9
 93 | 21
 94 | 9
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 1
101 | 20
102 | 9
103 | 11
104 | 19
105 | 21
106 | 9
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 19
113 | 20
114 | 9
115 | 11
116 | 19
117 | 21
118 | -9
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 19
125 | 20
126 | -9
127 | 11
128 | 1
129 | 21
130 | -9
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 1
137 | 20
138 | -9
139 | 11
140 | 1
141 | 21
142 | 9
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/points/default___demo_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -9
 53 | 20
 54 | 9
 55 | 11
 56 | 9
 57 | 21
 58 | 9
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 9
 65 | 20
 66 | 9
 67 | 11
 68 | 9
 69 | 21
 70 | -9
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 9
 77 | 20
 78 | -9
 79 | 11
 80 | -9
 81 | 21
 82 | -9
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -9
 89 | 20
 90 | -9
 91 | 11
 92 | -9
 93 | 21
 94 | 9
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -9
101 | 20
102 | 9
103 | 11
104 | 9
105 | 21
106 | 9
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 9
113 | 20
114 | 9
115 | 11
116 | 9
117 | 21
118 | -9
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 9
125 | 20
126 | -9
127 | 11
128 | -9
129 | 21
130 | -9
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | -9
137 | 20
138 | -9
139 | 11
140 | -9
141 | 21
142 | 9
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/points/mirror_variable__demo_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -9
 53 | 20
 54 | 9
 55 | 11
 56 | 9
 57 | 21
 58 | 9
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 9
 65 | 20
 66 | 9
 67 | 11
 68 | 9
 69 | 21
 70 | -9
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 9
 77 | 20
 78 | -9
 79 | 11
 80 | -9
 81 | 21
 82 | -9
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -9
 89 | 20
 90 | -9
 91 | 11
 92 | -9
 93 | 21
 94 | 9
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 1
101 | 20
102 | 9
103 | 11
104 | 19
105 | 21
106 | 9
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 19
113 | 20
114 | 9
115 | 11
116 | 19
117 | 21
118 | -9
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 19
125 | 20
126 | -9
127 | 11
128 | 1
129 | 21
130 | -9
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 1
137 | 20
138 | -9
139 | 11
140 | 1
141 | 21
142 | 9
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/pcbs/mock_footprints.yaml:
--------------------------------------------------------------------------------
 1 | points.zones.matrix:
 2 |   mirror: 10
 3 |   key:
 4 |     magic_value: 5
 5 | outlines:
 6 |   edge:
 7 |     - what: rectangle
 8 |       where: true
 9 |       size: u
10 | pcbs:
11 |   main:
12 |     outlines:
13 |       edge:
14 |         outline: edge
15 |     footprints:
16 |       trace:
17 |         what: trace_test
18 |         where: true
19 |         adjust:
20 |           shift: [1, 1]
21 |           rotate: 30
22 |         params:
23 |           width: u/40
24 |           side: F
25 |           mirror:
26 |             side: B
27 |       zone:
28 |         what: zone_test
29 |         where:
30 |           shift: [1, 1]
31 |           rotate: 30
32 |       dyn:
33 |         what: dynamic_net_test
34 |       anc1:
35 |         what: anchor_test
36 |         params:
37 |           end:
38 |             ref: matrix
39 |             shift: [10, 10]
40 |       anc2:
41 |         what: anchor_test
42 |         params:
43 |           end: matrix
44 |       arrobj:
45 |         what: arrobj_test
46 |         params:
47 |           start: {x: 5, y: 5}
48 |           end: [[6, 6], [7, 7]]
49 |       arrobj_templated:
50 |         what: arrobj_test
51 |         where:
52 |           ref: matrix
53 |         params:
54 |           start: '{x: {{magic_value}}, y: {{magic_value}}}'
55 |           end: '[[6, 6], [7, {{magic_value}}]]'
56 | 


--------------------------------------------------------------------------------
/crates/ergogen-layout/examples/points.rs:
--------------------------------------------------------------------------------
 1 | use std::path::PathBuf;
 2 | 
 3 | use ergogen_layout::parse_points;
 4 | use ergogen_parser::PreparedConfig;
 5 | 
 6 | fn main() {
 7 |     let mut args = std::env::args_os();
 8 |     let _ = args.next();
 9 |     let Some(path) = args.next() else {
10 |         eprintln!("usage: points ");
11 |         std::process::exit(2);
12 |     };
13 | 
14 |     let path = PathBuf::from(path);
15 |     let yaml = std::fs::read_to_string(&path).unwrap_or_else(|e| {
16 |         eprintln!("failed to read {}: {e}", path.display());
17 |         std::process::exit(2);
18 |     });
19 | 
20 |     let prepared = PreparedConfig::from_yaml_str(&yaml).unwrap_or_else(|e| {
21 |         eprintln!("parse failed: {e}");
22 |         std::process::exit(1);
23 |     });
24 | 
25 |     let points = parse_points(&prepared.canonical, &prepared.units).unwrap_or_else(|e| {
26 |         eprintln!("layout failed: {e}");
27 |         std::process::exit(1);
28 |     });
29 | 
30 |     let mut names: Vec<&str> = points.keys().map(|s| s.as_str()).collect();
31 |     names.sort_unstable();
32 |     for n in names {
33 |         let p = points.get(n).unwrap();
34 |         println!(
35 |             "{n}\tx={:.6}\ty={:.6}\tr={:.6}\tbind={:?}\tasym={:?}\tskip={}\tmirrored={:?}",
36 |             p.x, p.y, p.r, p.meta.bind, p.meta.asym, p.meta.skip, p.meta.mirrored
37 |         );
38 |     }
39 | }
40 | 


--------------------------------------------------------------------------------
/fixtures/m3/points/autobind___outlines_none_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -2.5
 53 | 20
 54 | -2.5
 55 | 11
 56 | 2.5
 57 | 21
 58 | -2.5
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 2.5
 65 | 20
 66 | -2.5
 67 | 11
 68 | 2.5
 69 | 21
 70 | 2.5
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 2.5
 77 | 20
 78 | 2.5
 79 | 11
 80 | -2.5
 81 | 21
 82 | 2.5
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -2.5
 89 | 20
 90 | 2.5
 91 | 11
 92 | -2.5
 93 | 21
 94 | -2.5
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 16.5
101 | 20
102 | -2.5
103 | 11
104 | 21.5
105 | 21
106 | -2.5
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 21.5
113 | 20
114 | -2.5
115 | 11
116 | 21.5
117 | 21
118 | 2.5
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 21.5
125 | 20
126 | 2.5
127 | 11
128 | 16.5
129 | 21
130 | 2.5
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 16.5
137 | 20
138 | 2.5
139 | 11
140 | 16.5
141 | 21
142 | -2.5
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/m3/points/autobind___outlines_some_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -2.5
 53 | 20
 54 | -2.5
 55 | 11
 56 | 3.5
 57 | 21
 58 | -2.5
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | -2.5
 65 | 20
 66 | 2.5
 67 | 11
 68 | 3.5
 69 | 21
 70 | 2.5
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | -2.5
 77 | 20
 78 | 2.5
 79 | 11
 80 | -2.5
 81 | 21
 82 | -2.5
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 3.5
 89 | 20
 90 | -2.5
 91 | 11
 92 | 3.5
 93 | 21
 94 | 2.5
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 15.5
101 | 20
102 | -2.5
103 | 11
104 | 21.5
105 | 21
106 | -2.5
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 21.5
113 | 20
114 | -2.5
115 | 11
116 | 21.5
117 | 21
118 | 2.5
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 15.5
125 | 20
126 | 2.5
127 | 11
128 | 21.5
129 | 21
130 | 2.5
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 15.5
137 | 20
138 | -2.5
139 | 11
140 | 15.5
141 | 21
142 | 2.5
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/points/autobind___outlines_none_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -2.5
 53 | 20
 54 | -2.5
 55 | 11
 56 | 2.5
 57 | 21
 58 | -2.5
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 2.5
 65 | 20
 66 | -2.5
 67 | 11
 68 | 2.5
 69 | 21
 70 | 2.5
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 2.5
 77 | 20
 78 | 2.5
 79 | 11
 80 | -2.5
 81 | 21
 82 | 2.5
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -2.5
 89 | 20
 90 | 2.5
 91 | 11
 92 | -2.5
 93 | 21
 94 | -2.5
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 16.5
101 | 20
102 | -2.5
103 | 11
104 | 21.5
105 | 21
106 | -2.5
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 21.5
113 | 20
114 | -2.5
115 | 11
116 | 21.5
117 | 21
118 | 2.5
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 21.5
125 | 20
126 | 2.5
127 | 11
128 | 16.5
129 | 21
130 | 2.5
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 16.5
137 | 20
138 | 2.5
139 | 11
140 | 16.5
141 | 21
142 | -2.5
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/points/autobind___outlines_some_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -2.5
 53 | 20
 54 | -2.5
 55 | 11
 56 | 3.5
 57 | 21
 58 | -2.5
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | -2.5
 65 | 20
 66 | 2.5
 67 | 11
 68 | 3.5
 69 | 21
 70 | 2.5
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | -2.5
 77 | 20
 78 | 2.5
 79 | 11
 80 | -2.5
 81 | 21
 82 | -2.5
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 3.5
 89 | 20
 90 | -2.5
 91 | 11
 92 | 3.5
 93 | 21
 94 | 2.5
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 15.5
101 | 20
102 | -2.5
103 | 11
104 | 21.5
105 | 21
106 | -2.5
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 21.5
113 | 20
114 | -2.5
115 | 11
116 | 21.5
117 | 21
118 | 2.5
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 15.5
125 | 20
126 | 2.5
127 | 11
128 | 21.5
129 | 21
130 | 2.5
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 15.5
137 | 20
138 | -2.5
139 | 11
140 | 15.5
141 | 21
142 | 2.5
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/.github/workflows/knuckles-parity.yml:
--------------------------------------------------------------------------------
 1 | name: Knuckles Parity
 2 | 
 3 | on:
 4 |   pull_request:
 5 |   schedule:
 6 |     - cron: "0 3 * * *"
 7 | 
 8 | jobs:
 9 |   knuckles-parity:
10 |     runs-on: ubuntu-latest
11 |     # To gate on a PR label later, uncomment and adjust:
12 |     # if: github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'run-knuckles-parity')
13 |     steps:
14 |       - name: Checkout
15 |         uses: actions/checkout@v4
16 | 
17 |       - name: Install Node
18 |         uses: actions/setup-node@v4
19 |         with:
20 |           node-version: "20"
21 | 
22 |       - name: Install Rust
23 |         uses: dtolnay/rust-toolchain@stable
24 | 
25 |       - name: Cache Rust
26 |         uses: Swatinem/rust-cache@v2
27 | 
28 |       - name: Generate upstream baselines (JS ergogen)
29 |         env:
30 |           ERGOGEN_UPSTREAM_CMD: "npx -y ergogen@4.1.0"
31 |         run: |
32 |           set -euo pipefail
33 |           ./scripts/update-upstream-baselines.sh \
34 |             8286e18f18ac064aa6d2ebca9c449bf2f6ba4d37 \
35 |             fixtures/m8/knuckles/knuckles_assets.yaml \
36 |             knuckles_assets
37 | 
38 |       - name: Compare Rust outputs to goldens + upstream
39 |         env:
40 |           UPSTREAM_BASELINE_DIR: fixtures/upstream-baselines/8286e18f18ac064aa6d2ebca9c449bf2f6ba4d37/knuckles_assets
41 |         run: cargo test -p ergogen-pcb --features js-footprints --test knuckles_parity
42 | 
43 | 


--------------------------------------------------------------------------------
/AGENTS.md:
--------------------------------------------------------------------------------
 1 | # AGENTS.md
 2 | 
 3 | Project-specific instructions for agents working in this repo.
 4 | 
 5 | ## Commit Message Guidelines
 6 | 
 7 | - Use Angular-style commit messages (e.g., `feat: ...`, `chore: ...`) and include a short detail summary in the body.
 8 | 
 9 | ## Code hygene
10 | 
11 | - After each feature implementation, run `cargo check`, `cargo fmt --all` and `cargo clippy`.
12 |   - Fix all the reported issues.
13 | - Ensure all new and existing tests pass with `cargo test`.
14 | 
15 | ## Output validation
16 | 
17 | - You can compare output files against reference outputs using `npx -y ergogen` for help with the command, use `npx -y ergogen --help`.
18 | - If you need to compare DXF outputs, you can use the dxf2png command `cargo run -- dxf2png`, for help use `cargo run -- dxf2png --help`.
19 | 
20 | ## Snapshot terminology + upstream baselines
21 | 
22 | - "Goldens" = outputs generated by our Rust tool, committed as fixtures.
23 | - "Upstream baselines" = outputs generated by JS ergogen at a pinned commit.
24 | 
25 | To refresh upstream baselines:
26 | - Use `scripts/update-upstream-baselines.sh   [fixture-name]`.
27 | - Set `ERGOGEN_UPSTREAM_DIR` to a local clone to pin commits, or `ERGOGEN_UPSTREAM_CMD` to override the CLI.
28 | - Outputs land in `fixtures/upstream-baselines///` with a MANIFEST.txt.
29 | - Optional comparisons can be run by setting `UPSTREAM_BASELINE_DIR` when running the reference output tests.
30 | 


--------------------------------------------------------------------------------
/fixtures/m8/knuckles/README.md:
--------------------------------------------------------------------------------
 1 | # Knuckles parity (assets-level)
 2 | 
 3 | This fixture exercises **real-world JS footprints** from the bundled Knuckles assets and compares:
 4 | 
 5 | - Rust outputs vs **committed goldens** (always)
 6 | - Rust outputs vs **upstream JS ergogen** (optional, env-gated)
 7 | 
 8 | ## What it covers
 9 | 
10 | - `outlines/pcb.dxf` (semantic DXF compare)
11 | - `pcbs/pcb.kicad_pcb` (normalized text compare)
12 | 
13 | The footprint sources come from `knuckles/ergogen/footprints` in this repo.
14 | 
15 | ## Run locally
16 | 
17 | Generate goldens:
18 | 
19 | ```bash
20 | cd ergogen-rs
21 | UPDATE_GOLDENS=1 cargo test -p ergogen-pcb --features js-footprints --test knuckles_parity
22 | ```
23 | 
24 | Run against committed goldens:
25 | 
26 | ```bash
27 | cd ergogen-rs
28 | cargo test -p ergogen-pcb --features js-footprints --test knuckles_parity
29 | ```
30 | 
31 | ## Upstream baseline (optional)
32 | 
33 | Generate upstream outputs for this fixture:
34 | 
35 | ```bash
36 | cd ergogen-rs
37 | ./scripts/update-upstream-baselines.sh 8286e18f18ac064aa6d2ebca9c449bf2f6ba4d37 fixtures/m8/knuckles/knuckles_assets.yaml knuckles_assets
38 | ```
39 | 
40 | Then compare Rust outputs against those upstream outputs:
41 | 
42 | ```bash
43 | cd ergogen-rs
44 | UPSTREAM_BASELINE_DIR=fixtures/upstream-baselines/8286e18f18ac064aa6d2ebca9c449bf2f6ba4d37/knuckles_assets \
45 |   cargo test -p ergogen-pcb --features js-footprints --test knuckles_parity
46 | ```
47 | 
48 | 


--------------------------------------------------------------------------------
/scripts/update-upstream-baselines.sh:
--------------------------------------------------------------------------------
 1 | #!/usr/bin/env bash
 2 | set -euo pipefail
 3 | 
 4 | if [[ $# -lt 2 ]]; then
 5 |   echo "Usage: $0   [fixture-name]" >&2
 6 |   exit 1
 7 | fi
 8 | 
 9 | commit="$1"
10 | fixture="$2"
11 | fixture_name="${3:-$(basename "${fixture%.*}")}"
12 | 
13 | repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
14 | out_root="${repo_root}/fixtures/upstream-baselines/${commit}/${fixture_name}"
15 | 
16 | mkdir -p "${out_root}"
17 | 
18 | if [[ -n "${ERGOGEN_UPSTREAM_DIR:-}" ]]; then
19 |   if [[ -d "${ERGOGEN_UPSTREAM_DIR}" ]]; then
20 |     git -C "${ERGOGEN_UPSTREAM_DIR}" checkout "${commit}" >/dev/null
21 |   fi
22 |   if [[ -f "${ERGOGEN_UPSTREAM_DIR}/bin/ergogen.js" ]]; then
23 |     cmd=(node "${ERGOGEN_UPSTREAM_DIR}/bin/ergogen.js")
24 |   elif [[ -f "${ERGOGEN_UPSTREAM_DIR}/src/cli.js" ]]; then
25 |     cmd=(node "${ERGOGEN_UPSTREAM_DIR}/src/cli.js")
26 |   else
27 |     echo "Could not find ergogen CLI under ERGOGEN_UPSTREAM_DIR=${ERGOGEN_UPSTREAM_DIR}" >&2
28 |     exit 1
29 |   fi
30 | else
31 |   cmd=(bash -lc "${ERGOGEN_UPSTREAM_CMD:-npx -y ergogen}")
32 | fi
33 | 
34 | "${cmd[@]}" "${fixture}" -o "${out_root}" --clean
35 | 
36 | cat > "${out_root}/MANIFEST.txt" < `
30 |   (footprint "ceoloide:mounting_hole_npth"
31 |     (layer "${p.side}.Cu")
32 |     ${p.at}
33 |     (property "Reference" "${p.ref}"
34 |       (at 0 2.55 ${p.r})
35 |       (layer "${p.side}.SilkS")
36 |       ${p.ref_hide}
37 |       (effects (font (size 1 1) (thickness 0.15)))
38 |     )
39 |     (pad "" np_thru_hole circle
40 |       (at 0 0 ${p.r})
41 |       (size ${p.hole_size} ${p.hole_size})
42 |       (drill ${p.hole_drill})
43 |       (layers "*.Cu" "*.Mask")
44 |     )
45 |   )
46 |   `
47 | }
48 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/minimal/reference/points/demo.yaml:
--------------------------------------------------------------------------------
 1 | models:
 2 |     export:
 3 |         models:
 4 |             matrix_col_row:
 5 |                 paths:
 6 |                     top:
 7 |                         type: line
 8 |                         origin:
 9 |                             - -9
10 |                             - 9
11 |                         end:
12 |                             - 9
13 |                             - 9
14 |                     right:
15 |                         type: line
16 |                         origin:
17 |                             - 9
18 |                             - 9
19 |                         end:
20 |                             - 9
21 |                             - -9
22 |                     bottom:
23 |                         type: line
24 |                         origin:
25 |                             - 9
26 |                             - -9
27 |                         end:
28 |                             - -9
29 |                             - -9
30 |                     left:
31 |                         type: line
32 |                         origin:
33 |                             - -9
34 |                             - -9
35 |                         end:
36 |                             - -9
37 |                             - 9
38 |                 origin:
39 |                     - 0
40 |                     - 0
41 |         origin:
42 |             - 0
43 |             - 0
44 | units: mm
45 | origin:
46 |     - 0
47 |     - 0
48 | 


--------------------------------------------------------------------------------
/fixtures/m5/outlines/hull___outlines_rotation_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 54
 53 | 20
 54 | 47
 55 | 11
 56 | 36
 57 | 21
 58 | 47
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 36
 65 | 20
 66 | -9
 67 | 11
 68 | 36
 69 | 21
 70 | 47
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 36
 77 | 20
 78 | -9
 79 | 11
 80 | 1.3948779
 81 | 21
 82 | -18.304489
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 1.3948779
 89 | 20
 90 | -18.304489
 91 | 11
 92 | -14.9186622
 93 | 21
 94 | -10.6973603
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -14.9186622
101 | 20
102 | -10.6973603
103 | 11
104 | -22.5257909
105 | 21
106 | -27.0109004
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | -22.5257909
113 | 20
114 | -27.0109004
115 | 11
116 | -6.2122508
117 | 21
118 | -34.6180291
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | -6.2122508
125 | 20
126 | -34.6180291
127 | 11
128 | 54
129 | 21
130 | -9
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 54
137 | 20
138 | -9
139 | 11
140 | 54
141 | 21
142 | 47
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/minimal_yml/reference/points/demo.yaml:
--------------------------------------------------------------------------------
 1 | models:
 2 |     export:
 3 |         models:
 4 |             matrix_col_row:
 5 |                 paths:
 6 |                     top:
 7 |                         type: line
 8 |                         origin:
 9 |                             - -9
10 |                             - 9
11 |                         end:
12 |                             - 9
13 |                             - 9
14 |                     right:
15 |                         type: line
16 |                         origin:
17 |                             - 9
18 |                             - 9
19 |                         end:
20 |                             - 9
21 |                             - -9
22 |                     bottom:
23 |                         type: line
24 |                         origin:
25 |                             - 9
26 |                             - -9
27 |                         end:
28 |                             - -9
29 |                             - -9
30 |                     left:
31 |                         type: line
32 |                         origin:
33 |                             - -9
34 |                             - -9
35 |                         end:
36 |                             - -9
37 |                             - 9
38 |                 origin:
39 |                     - 0
40 |                     - 0
41 |         origin:
42 |             - 0
43 |             - 0
44 | units: mm
45 | origin:
46 |     - 0
47 |     - 0
48 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/hull___outlines_rotation_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 54
 53 | 20
 54 | 47
 55 | 11
 56 | 36
 57 | 21
 58 | 47
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 36
 65 | 20
 66 | -9
 67 | 11
 68 | 36
 69 | 21
 70 | 47
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 36
 77 | 20
 78 | -9
 79 | 11
 80 | 1.3948779
 81 | 21
 82 | -18.304489
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 1.3948779
 89 | 20
 90 | -18.304489
 91 | 11
 92 | -14.9186622
 93 | 21
 94 | -10.6973603
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -14.9186622
101 | 20
102 | -10.6973603
103 | 11
104 | -22.5257909
105 | 21
106 | -27.0109004
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | -22.5257909
113 | 20
114 | -27.0109004
115 | 11
116 | -6.2122508
117 | 21
118 | -34.6180291
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | -6.2122508
125 | 20
126 | -34.6180291
127 | 11
128 | 54
129 | 21
130 | -9
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 54
137 | 20
138 | -9
139 | 11
140 | 54
141 | 21
142 | 47
143 | 0
144 | ENDSEC
145 | 0
146 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/cases/cube___cases_cube_jscad.jscad:
--------------------------------------------------------------------------------
 1 | function square_extrude_5_outline_fn(){
 2 |     return new CSG.Path2D([[-2.5,-2.5],[2.5,-2.5]]).appendPoint([2.5,2.5]).appendPoint([-2.5,2.5]).appendPoint([-2.5,-2.5]).close().innerToCAG()
 3 | .extrude({ offset: [0, 0, 5] });
 4 | }
 5 | 
 6 | 
 7 | 
 8 | 
 9 |                 function cube_case_fn() {
10 |                     
11 | 
12 |                 // creating part 0 of case cube
13 |                 let cube__part_0 = square_extrude_5_outline_fn();
14 | 
15 |                 // make sure that rotations are relative
16 |                 let cube__part_0_bounds = cube__part_0.getBounds();
17 |                 let cube__part_0_x = cube__part_0_bounds[0].x + (cube__part_0_bounds[1].x - cube__part_0_bounds[0].x) / 2
18 |                 let cube__part_0_y = cube__part_0_bounds[0].y + (cube__part_0_bounds[1].y - cube__part_0_bounds[0].y) / 2
19 |                 cube__part_0 = translate([-cube__part_0_x, -cube__part_0_y, 0], cube__part_0);
20 |                 cube__part_0 = rotate([0,0,0], cube__part_0);
21 |                 cube__part_0 = translate([cube__part_0_x, cube__part_0_y, 0], cube__part_0);
22 | 
23 |                 cube__part_0 = translate([0,0,0], cube__part_0);
24 |                 let result = cube__part_0;
25 |                 
26 |             
27 |                     return result;
28 |                 }
29 |             
30 |             
31 |         
32 |             function main() {
33 |                 return cube_case_fn();
34 |             }
35 | 
36 |         


--------------------------------------------------------------------------------
/crates/ergogen-export/tests/m5_outlines_golden_semantic.rs:
--------------------------------------------------------------------------------
 1 | use std::path::PathBuf;
 2 | 
 3 | use ergogen_export::dxf::{NormalizeOptions, compare_files_semantic};
 4 | 
 5 | fn workspace_root() -> PathBuf {
 6 |     PathBuf::from(env!("CARGO_MANIFEST_DIR"))
 7 |         .parent()
 8 |         .and_then(|p| p.parent())
 9 |         .expect("workspace root")
10 |         .to_path_buf()
11 | }
12 | 
13 | #[test]
14 | fn outline_dxf_goldens_are_self_semantically_consistent() {
15 |     // This is a "harness test": it ensures we can enumerate the upstream DXF goldens and that
16 |     // parse+normalize+compare works end-to-end.
17 |     //
18 |     // Once we have an outline generator + DXF writer, replace the "golden vs golden" comparison
19 |     // with "generated vs golden".
20 |     let root = workspace_root();
21 |     let dir = root.join("fixtures/m5/outlines");
22 | 
23 |     let mut dxfs: Vec<_> = std::fs::read_dir(&dir)
24 |         .unwrap()
25 |         .filter_map(|e| e.ok())
26 |         .map(|e| e.path())
27 |         .filter(|p| {
28 |             p.file_name()
29 |                 .and_then(|n| n.to_str())
30 |                 .is_some_and(|n| n.contains("___outlines_") && n.ends_with("_dxf.dxf"))
31 |         })
32 |         .collect();
33 |     dxfs.sort();
34 | 
35 |     assert!(!dxfs.is_empty(), "no outline goldens found in {dir:?}");
36 | 
37 |     for dxf in dxfs {
38 |         compare_files_semantic(&dxf, &dxf, NormalizeOptions::default())
39 |             .unwrap_or_else(|e| panic!("semantic compare failed for {dxf:?}: {e}"));
40 |     }
41 | }
42 | 


--------------------------------------------------------------------------------
/fixtures/m7/footprints/primitives_templated.yaml:
--------------------------------------------------------------------------------
 1 | name: primitives_templated
 2 | params:
 3 |   radius:
 4 |     type: number
 5 |     default: 2
 6 |   line_w:
 7 |     type: number
 8 |     default: 0.2
 9 |   arc_angle:
10 |     type: number
11 |     default: 90
12 |   rect_w:
13 |     type: number
14 |     default: 4
15 |   rect_h:
16 |     type: number
17 |     default: 2
18 |   text_size:
19 |     type: number
20 |     default: 1.5
21 |   label:
22 |     type: string
23 |     default: TEXT
24 |   justify:
25 |     type: string
26 |     default: left
27 | primitives:
28 |   - type: circle
29 |     center:
30 |       - 0
31 |       - 0
32 |     radius: "{{ radius }}"
33 |     layer: F.SilkS
34 |     width: "{{ line_w }}"
35 |   - type: line
36 |     start:
37 |       - -3
38 |       - -3
39 |     end:
40 |       - 3
41 |       - -3
42 |     layer: F.SilkS
43 |     width: "{{ line_w }}"
44 |   - type: arc
45 |     center:
46 |       - 0
47 |       - 0
48 |     radius: "{{ radius }}"
49 |     start_angle: 0
50 |     angle: "{{ arc_angle }}"
51 |     layer: F.SilkS
52 |     width: "{{ line_w }}"
53 |   - type: rect
54 |     center:
55 |       - 0
56 |       - 0
57 |     size:
58 |       - "{{ rect_w }}"
59 |       - "{{ rect_h }}"
60 |     layer: F.SilkS
61 |     width: "{{ line_w }}"
62 |   - type: text
63 |     at:
64 |       - 0
65 |       - 5
66 |     text: "{{ label }}"
67 |     layer: F.SilkS
68 |     size:
69 |       - "{{ text_size }}"
70 |       - "{{ text_size }}"
71 |     thickness: "{{ line_w }}"
72 |     rotation: 15
73 |     justify: "{{ justify }}"
74 | 


--------------------------------------------------------------------------------
/fixtures/m6/reference_outputs/big/cases/export.jscad:
--------------------------------------------------------------------------------
 1 | function export_extrude_1_outline_fn(){
 2 |     return new CSG.Path2D([[-9,-9],[9,-9]]).appendPoint([9,9]).appendPoint([-9,9]).appendPoint([-9,-9]).close().innerToCAG()
 3 | .extrude({ offset: [0, 0, 1] });
 4 | }
 5 | 
 6 | 
 7 | 
 8 | 
 9 |                 function export_case_fn() {
10 |                     
11 | 
12 |                 // creating part 0 of case export
13 |                 let export__part_0 = export_extrude_1_outline_fn();
14 | 
15 |                 // make sure that rotations are relative
16 |                 let export__part_0_bounds = export__part_0.getBounds();
17 |                 let export__part_0_x = export__part_0_bounds[0].x + (export__part_0_bounds[1].x - export__part_0_bounds[0].x) / 2
18 |                 let export__part_0_y = export__part_0_bounds[0].y + (export__part_0_bounds[1].y - export__part_0_bounds[0].y) / 2
19 |                 export__part_0 = translate([-export__part_0_x, -export__part_0_y, 0], export__part_0);
20 |                 export__part_0 = rotate([0,0,0], export__part_0);
21 |                 export__part_0 = translate([export__part_0_x, export__part_0_y, 0], export__part_0);
22 | 
23 |                 export__part_0 = translate([0,0,0], export__part_0);
24 |                 let result = export__part_0;
25 |                 
26 |             
27 |                     return result;
28 |                 }
29 |             
30 |             
31 |         
32 |             function main() {
33 |                 return export_case_fn();
34 |             }
35 | 
36 |         
37 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/big/reference/cases/export.jscad:
--------------------------------------------------------------------------------
 1 | function export_extrude_1_outline_fn(){
 2 |     return new CSG.Path2D([[-9,-9],[9,-9]]).appendPoint([9,9]).appendPoint([-9,9]).appendPoint([-9,-9]).close().innerToCAG()
 3 | .extrude({ offset: [0, 0, 1] });
 4 | }
 5 | 
 6 | 
 7 | 
 8 | 
 9 |                 function export_case_fn() {
10 |                     
11 | 
12 |                 // creating part 0 of case export
13 |                 let export__part_0 = export_extrude_1_outline_fn();
14 | 
15 |                 // make sure that rotations are relative
16 |                 let export__part_0_bounds = export__part_0.getBounds();
17 |                 let export__part_0_x = export__part_0_bounds[0].x + (export__part_0_bounds[1].x - export__part_0_bounds[0].x) / 2
18 |                 let export__part_0_y = export__part_0_bounds[0].y + (export__part_0_bounds[1].y - export__part_0_bounds[0].y) / 2
19 |                 export__part_0 = translate([-export__part_0_x, -export__part_0_y, 0], export__part_0);
20 |                 export__part_0 = rotate([0,0,0], export__part_0);
21 |                 export__part_0 = translate([export__part_0_x, export__part_0_y, 0], export__part_0);
22 | 
23 |                 export__part_0 = translate([0,0,0], export__part_0);
24 |                 let result = export__part_0;
25 |                 
26 |             
27 |                     return result;
28 |                 }
29 |             
30 |             
31 |         
32 |             function main() {
33 |                 return export_case_fn();
34 |             }
35 | 
36 |         


--------------------------------------------------------------------------------
/crates/ergogen-wasm/examples/index.js:
--------------------------------------------------------------------------------
 1 | import init, { render_pcb } from "./pkg/ergogen_wasm.js";
 2 | import { installErgogenJsFootprints, registerErgogenJsFootprintSource } from "./footprints.js";
 3 | 
 4 | const yamlEl = document.getElementById("yaml");
 5 | const outputEl = document.getElementById("output");
 6 | const renderBtn = document.getElementById("render");
 7 | 
 8 | const demoYaml = `meta:
 9 |   author: Ergogen WASM
10 |   version: v0.1
11 | points.zones.matrix:
12 | pcbs.pcb.template: kicad8
13 | pcbs.pcb.footprints_search_paths:
14 |   - .
15 | pcbs.pcb.footprints:
16 |   - what: simple
17 |     params:
18 |       net: GND
19 |       label: JS
20 | `;
21 | 
22 | const demoJs = `module.exports = {
23 |   params: {
24 |     net: { type: "net", value: "GND" },
25 |     label: { type: "string", value: "JS" }
26 |   },
27 |   body: p => \`
28 | (footprint "js_simple"
29 |   (layer \${p.side}.Cu)
30 |   \${p.at}
31 |   (property "Reference" "\${p.ref}" (at 0 0) (layer \${p.side}.SilkS) \${p.ref_hide})
32 |   (pad "1" thru_hole circle (at 0 0) (size 1 1) (drill 0.5) (layers *.Cu *.Mask) \${p.net})
33 | )\`.trim()
34 | };`;
35 | 
36 | yamlEl.value = demoYaml;
37 | 
38 | async function main() {
39 |   await init();
40 |   installErgogenJsFootprints();
41 |   registerErgogenJsFootprintSource("simple.js", demoJs);
42 | }
43 | 
44 | renderBtn.addEventListener("click", () => {
45 |   try {
46 |     const out = render_pcb(yamlEl.value, "pcb");
47 |     outputEl.textContent = out;
48 |   } catch (err) {
49 |     outputEl.textContent = String(err);
50 |   }
51 | });
52 | 
53 | main();
54 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/big/reference/cases/_export.jscad:
--------------------------------------------------------------------------------
 1 | function export_extrude_1_outline_fn(){
 2 |     return new CSG.Path2D([[-9,-9],[9,-9]]).appendPoint([9,9]).appendPoint([-9,9]).appendPoint([-9,-9]).close().innerToCAG()
 3 | .extrude({ offset: [0, 0, 1] });
 4 | }
 5 | 
 6 | 
 7 | 
 8 | 
 9 |                 function _export_case_fn() {
10 |                     
11 | 
12 |                 // creating part 0 of case _export
13 |                 let _export__part_0 = export_extrude_1_outline_fn();
14 | 
15 |                 // make sure that rotations are relative
16 |                 let _export__part_0_bounds = _export__part_0.getBounds();
17 |                 let _export__part_0_x = _export__part_0_bounds[0].x + (_export__part_0_bounds[1].x - _export__part_0_bounds[0].x) / 2
18 |                 let _export__part_0_y = _export__part_0_bounds[0].y + (_export__part_0_bounds[1].y - _export__part_0_bounds[0].y) / 2
19 |                 _export__part_0 = translate([-_export__part_0_x, -_export__part_0_y, 0], _export__part_0);
20 |                 _export__part_0 = rotate([0,0,0], _export__part_0);
21 |                 _export__part_0 = translate([_export__part_0_x, _export__part_0_y, 0], _export__part_0);
22 | 
23 |                 _export__part_0 = translate([0,0,0], _export__part_0);
24 |                 let result = _export__part_0;
25 |                 
26 |             
27 |                     return result;
28 |                 }
29 |             
30 |             
31 |         
32 |             function main() {
33 |                 return _export_case_fn();
34 |             }
35 | 
36 |         


--------------------------------------------------------------------------------
/fixtures/m5/outlines/hull___outlines_concavity-high_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 236
 53 | 20
 54 | 36
 55 | 11
 56 | 164
 57 | 21
 58 | 47
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 36
 65 | 20
 66 | 47
 67 | 11
 68 | 164
 69 | 21
 70 | 47
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 36
 77 | 20
 78 | 47
 79 | 11
 80 | -36
 81 | 21
 82 | 36
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -36
 89 | 20
 90 | 36
 91 | 11
 92 | -36
 93 | 21
 94 | -36
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -36
101 | 20
102 | -36
103 | 11
104 | 36
105 | 21
106 | -36
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 36
113 | 20
114 | -36
115 | 11
116 | 54
117 | 21
118 | 29
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 54
125 | 20
126 | 29
127 | 11
128 | 146
129 | 21
130 | 29
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 146
137 | 20
138 | 29
139 | 11
140 | 164
141 | 21
142 | -36
143 | 0
144 | LINE
145 | 8
146 | 0
147 | 10
148 | 164
149 | 20
150 | -36
151 | 11
152 | 236
153 | 21
154 | -36
155 | 0
156 | LINE
157 | 8
158 | 0
159 | 10
160 | 236
161 | 20
162 | -36
163 | 11
164 | 236
165 | 21
166 | 36
167 | 0
168 | ENDSEC
169 | 0
170 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/hull___outlines_concavity-high_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | 236
 53 | 20
 54 | 36
 55 | 11
 56 | 164
 57 | 21
 58 | 47
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 36
 65 | 20
 66 | 47
 67 | 11
 68 | 164
 69 | 21
 70 | 47
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 36
 77 | 20
 78 | 47
 79 | 11
 80 | -36
 81 | 21
 82 | 36
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | -36
 89 | 20
 90 | 36
 91 | 11
 92 | -36
 93 | 21
 94 | -36
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | -36
101 | 20
102 | -36
103 | 11
104 | 36
105 | 21
106 | -36
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 36
113 | 20
114 | -36
115 | 11
116 | 54
117 | 21
118 | 29
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 54
125 | 20
126 | 29
127 | 11
128 | 146
129 | 21
130 | 29
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 146
137 | 20
138 | 29
139 | 11
140 | 164
141 | 21
142 | -36
143 | 0
144 | LINE
145 | 8
146 | 0
147 | 10
148 | 164
149 | 20
150 | -36
151 | 11
152 | 236
153 | 21
154 | -36
155 | 0
156 | LINE
157 | 8
158 | 0
159 | 10
160 | 236
161 | 20
162 | -36
163 | 11
164 | 236
165 | 21
166 | 36
167 | 0
168 | ENDSEC
169 | 0
170 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/footprints/rest.yaml:
--------------------------------------------------------------------------------
 1 | points.zones.matrix:
 2 | pcbs.pcb.footprints:
 3 | 
 4 |   - what: alps
 5 |     params:
 6 |       from: from
 7 |       to: to
 8 | 
 9 |   - what: jstph
10 |     params:
11 |       pos: pos
12 |       neg: neg 
13 |     adjust.shift: [50, 0]
14 | 
15 |   - what: jumper
16 |     params:
17 |       from: from
18 |       to: to
19 |     adjust.shift: [100, 0]
20 | 
21 |   - what: oled
22 |     params:
23 |       SDA: SDA
24 |       SCL: SCL 
25 |     adjust.shift: [0, 50]
26 | 
27 |   - what: omron
28 |     params:
29 |       from: from
30 |       to: to
31 |     adjust.shift: [50, 50]
32 | 
33 |   - what: rgb
34 |     params:
35 |       din: din
36 |       dout: dout
37 |     adjust.shift: [100, 50]
38 | 
39 |   - what: rotary
40 |     params:
41 |       from: from
42 |       to: to
43 |       A: A
44 |       B: B
45 |       C: C
46 |     adjust.shift: [0, 100]
47 | 
48 |   - what: scrollwheel
49 |     params:
50 |       from: from
51 |       to: to
52 |       A: A
53 |       B: B
54 |       C: C
55 |       D: D
56 |     adjust.shift: [50, 100]
57 | 
58 |   - what: slider
59 |     params:
60 |       from: from
61 |       to: to
62 |     adjust.shift: [100, 100]
63 | 
64 |   - what: via
65 |     params:
66 |       net: net
67 |     adjust.shift: [0, 150]
68 | 
69 |   - what: scrollwheel
70 |     params:
71 |       from: from
72 |       to: to
73 |       A: A
74 |       B: B
75 |       C: C
76 |       D: D
77 |       reverse: true
78 |     adjust.shift: [50, 150]
79 | 
80 |   - what: slider
81 |     params:
82 |       from: from
83 |       to: to
84 |       side: B
85 |     adjust.shift: [100, 150]
86 | 


--------------------------------------------------------------------------------
/fixtures/upstream/fixtures/makerjs/bug_465_weird_bad.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 0
  6 | ENDSEC
  7 | 0
  8 | SECTION
  9 | 2
 10 | TABLES
 11 | 0
 12 | TABLE
 13 | 2
 14 | LTYPE
 15 | 0
 16 | LTYPE
 17 | 72
 18 | 65
 19 | 70
 20 | 64
 21 | 2
 22 | CONTINUOUS
 23 | 3
 24 | ______
 25 | 73
 26 | 0
 27 | 40
 28 | 0
 29 | 0
 30 | ENDTAB
 31 | 0
 32 | TABLE
 33 | 2
 34 | LAYER
 35 | 0
 36 | ENDTAB
 37 | 0
 38 | ENDSEC
 39 | 0
 40 | SECTION
 41 | 2
 42 | ENTITIES
 43 | 0
 44 | ARC
 45 | 8
 46 | 0
 47 | 10
 48 | 1
 49 | 20
 50 | 9
 51 | 40
 52 | 1
 53 | 50
 54 | 90
 55 | 51
 56 | 180
 57 | 0
 58 | LINE
 59 | 8
 60 | 0
 61 | 10
 62 | 1
 63 | 20
 64 | 0
 65 | 11
 66 | 5
 67 | 21
 68 | 0
 69 | 0
 70 | LINE
 71 | 8
 72 | 0
 73 | 10
 74 | 5
 75 | 20
 76 | 10
 77 | 11
 78 | 1
 79 | 21
 80 | 10
 81 | 0
 82 | LINE
 83 | 8
 84 | 0
 85 | 10
 86 | 0
 87 | 20
 88 | 9
 89 | 11
 90 | 0
 91 | 21
 92 | 1
 93 | 0
 94 | LINE
 95 | 8
 96 | 0
 97 | 10
 98 | 10
 99 | 20
100 | 5
101 | 11
102 | 15
103 | 21
104 | 5
105 | 0
106 | LINE
107 | 8
108 | 0
109 | 10
110 | 15
111 | 20
112 | 5
113 | 11
114 | 15
115 | 21
116 | 15
117 | 0
118 | LINE
119 | 8
120 | 0
121 | 10
122 | 15
123 | 20
124 | 15
125 | 11
126 | 5
127 | 21
128 | 15
129 | 0
130 | LINE
131 | 8
132 | 0
133 | 10
134 | 5
135 | 20
136 | 15
137 | 11
138 | 5
139 | 21
140 | 10
141 | 0
142 | LINE
143 | 8
144 | 0
145 | 10
146 | 5
147 | 20
148 | -5
149 | 11
150 | 15
151 | 21
152 | -5
153 | 0
154 | LINE
155 | 8
156 | 0
157 | 10
158 | 15
159 | 20
160 | -5
161 | 11
162 | 15
163 | 21
164 | 5
165 | 0
166 | LINE
167 | 8
168 | 0
169 | 10
170 | 5
171 | 20
172 | 0
173 | 11
174 | 5
175 | 21
176 | -5
177 | 0
178 | ENDSEC
179 | 0
180 | EOF


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/big/reference/outlines/_export.yaml:
--------------------------------------------------------------------------------
 1 | models:
 2 |     export:
 3 |         models:
 4 |             a:
 5 |                 models: {}
 6 |                 origin:
 7 |                     - 0
 8 |                     - 0
 9 |             b:
10 |                 paths:
11 |                     ShapeLine1:
12 |                         type: line
13 |                         origin:
14 |                             - -9
15 |                             - -9
16 |                         end:
17 |                             - 9
18 |                             - -9
19 |                     ShapeLine2:
20 |                         type: line
21 |                         origin:
22 |                             - 9
23 |                             - -9
24 |                         end:
25 |                             - 9
26 |                             - 9
27 |                     ShapeLine3:
28 |                         type: line
29 |                         origin:
30 |                             - 9
31 |                             - 9
32 |                         end:
33 |                             - -9
34 |                             - 9
35 |                     ShapeLine4:
36 |                         type: line
37 |                         origin:
38 |                             - -9
39 |                             - 9
40 |                         end:
41 |                             - -9
42 |                             - -9
43 |                 origin:
44 |                     - 0
45 |                     - 0
46 |         origin:
47 |             - 0
48 |             - 0
49 | units: mm
50 | origin:
51 |     - 0
52 |     - 0
53 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/cli/big/reference/outlines/export.yaml:
--------------------------------------------------------------------------------
 1 | models:
 2 |     export:
 3 |         models:
 4 |             a:
 5 |                 models: {}
 6 |                 origin:
 7 |                     - 0
 8 |                     - 0
 9 |             b:
10 |                 paths:
11 |                     ShapeLine1:
12 |                         type: line
13 |                         origin:
14 |                             - -9
15 |                             - -9
16 |                         end:
17 |                             - 9
18 |                             - -9
19 |                     ShapeLine2:
20 |                         type: line
21 |                         origin:
22 |                             - 9
23 |                             - -9
24 |                         end:
25 |                             - 9
26 |                             - 9
27 |                     ShapeLine3:
28 |                         type: line
29 |                         origin:
30 |                             - 9
31 |                             - 9
32 |                         end:
33 |                             - -9
34 |                             - 9
35 |                     ShapeLine4:
36 |                         type: line
37 |                         origin:
38 |                             - -9
39 |                             - 9
40 |                         end:
41 |                             - -9
42 |                             - -9
43 |                 origin:
44 |                     - 0
45 |                     - 0
46 |         origin:
47 |             - 0
48 |             - 0
49 | units: mm
50 | origin:
51 |     - 0
52 |     - 0
53 | 


--------------------------------------------------------------------------------
/fixtures/upstream/fixtures/makerjs/bug_465_weird_good.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 0
  6 | ENDSEC
  7 | 0
  8 | SECTION
  9 | 2
 10 | TABLES
 11 | 0
 12 | TABLE
 13 | 2
 14 | LTYPE
 15 | 0
 16 | LTYPE
 17 | 72
 18 | 65
 19 | 70
 20 | 64
 21 | 2
 22 | CONTINUOUS
 23 | 3
 24 | ______
 25 | 73
 26 | 0
 27 | 40
 28 | 0
 29 | 0
 30 | ENDTAB
 31 | 0
 32 | TABLE
 33 | 2
 34 | LAYER
 35 | 0
 36 | ENDTAB
 37 | 0
 38 | ENDSEC
 39 | 0
 40 | SECTION
 41 | 2
 42 | ENTITIES
 43 | 0
 44 | ARC
 45 | 8
 46 | 0
 47 | 10
 48 | 1
 49 | 20
 50 | 1
 51 | 40
 52 | 1
 53 | 50
 54 | 180
 55 | 51
 56 | 270
 57 | 0
 58 | ARC
 59 | 8
 60 | 0
 61 | 10
 62 | 1
 63 | 20
 64 | 9
 65 | 40
 66 | 1
 67 | 50
 68 | 90
 69 | 51
 70 | 180
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | 1
 77 | 20
 78 | 0
 79 | 11
 80 | 5
 81 | 21
 82 | 0
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 5
 89 | 20
 90 | 10
 91 | 11
 92 | 1
 93 | 21
 94 | 10
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 0
101 | 20
102 | 9
103 | 11
104 | 0
105 | 21
106 | 1
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 15
113 | 20
114 | 5
115 | 11
116 | 15
117 | 21
118 | 15
119 | 0
120 | LINE
121 | 8
122 | 0
123 | 10
124 | 15
125 | 20
126 | 15
127 | 11
128 | 5
129 | 21
130 | 15
131 | 0
132 | LINE
133 | 8
134 | 0
135 | 10
136 | 5
137 | 20
138 | 15
139 | 11
140 | 5
141 | 21
142 | 10
143 | 0
144 | LINE
145 | 8
146 | 0
147 | 10
148 | 5
149 | 20
150 | -5
151 | 11
152 | 15
153 | 21
154 | -5
155 | 0
156 | LINE
157 | 8
158 | 0
159 | 10
160 | 15
161 | 20
162 | -5
163 | 11
164 | 15
165 | 21
166 | 5
167 | 0
168 | LINE
169 | 8
170 | 0
171 | 10
172 | 5
173 | 20
174 | 0
175 | 11
176 | 5
177 | 21
178 | -5
179 | 0
180 | ENDSEC
181 | 0
182 | EOF


--------------------------------------------------------------------------------
/crates/ergogen-pcb/templates/footprints/choc/base.tpl:
--------------------------------------------------------------------------------
 1 | (module PG1350 (layer F.Cu) (tedit 5DD50112)
 2 |       (at {{at}})
 3 | 
 4 |       
 5 |       (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
 6 |       (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
 7 | 
 8 |       
 9 |       (fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15))
10 |       (fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15))
11 |       (fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15))
12 |       (fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15))
13 |       (fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15))
14 |       (fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15))
15 |       (fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15))
16 |       (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))      
17 |       
18 |       
19 |       (pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
20 |         
21 |       
22 |       (pad "" np_thru_hole circle (at 5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
23 |       (pad "" np_thru_hole circle (at -5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
24 |       
25 |         
26 |         
27 |             
28 |             (pad 1 thru_hole circle (at 5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) (net {{net_from_id}} "{{net_from}}"))
29 |             (pad 2 thru_hole circle (at 0 -5.9) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) (net {{net_to_id}} "{{net_to}}"))
30 |           )


--------------------------------------------------------------------------------
/crates/ergogen-pcb/templates/footprints/mx/base.tpl:
--------------------------------------------------------------------------------
 1 | (module MX (layer F.Cu) (tedit 5DD4F656)
 2 |       (at {{at}})
 3 | 
 4 |       
 5 |       (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
 6 |       (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
 7 | 
 8 |       
 9 |       (fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15))
10 |       (fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15))
11 |       (fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15))
12 |       (fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15))
13 |       (fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15))
14 |       (fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15))
15 |       (fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15))
16 |       (fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))
17 |     
18 |       
19 |       (pad "" np_thru_hole circle (at 0 0) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask))
20 | 
21 |       
22 |       (pad "" np_thru_hole circle (at 5.08 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
23 |       (pad "" np_thru_hole circle (at -5.08 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
24 |       
25 |         
26 |         
27 |             
28 |             (pad 1 thru_hole circle (at 2.54 -5.08) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) (net {{net_from_id}} "{{net_from}}"))
29 |             (pad 2 thru_hole circle (at -3.81 -2.54) (size 2.286 2.286) (drill 1.4986) (layers *.Cu *.Mask) (net {{net_to_id}} "{{net_to}}"))
30 |           )


--------------------------------------------------------------------------------
/crates/ergogen-parser/src/error.rs:
--------------------------------------------------------------------------------
 1 | use thiserror::Error;
 2 | 
 3 | #[derive(Debug, Error)]
 4 | pub enum Error {
 5 |     #[error("failed to parse YAML: {0}")]
 6 |     Yaml(#[from] serde_yaml::Error),
 7 | 
 8 |     #[error("failed to parse JSON: {0}")]
 9 |     Json(String),
10 | 
11 |     #[error("invalid expression for \"{key}\": {expr}")]
12 |     InvalidExpression { key: String, expr: String },
13 | 
14 |     #[error("unknown variable \"{name}\" referenced while evaluating \"{key}\"")]
15 |     UnknownVariable { key: String, name: String },
16 | 
17 |     #[error("expression evaluation failed for \"{key}\": {message}")]
18 |     Eval { key: String, message: String },
19 | 
20 |     #[error("YAML mapping keys must be strings")]
21 |     NonStringKey,
22 | 
23 |     #[error("unsupported YAML value (tags/anchors are not supported in IR yet)")]
24 |     UnsupportedYamlValue,
25 | 
26 |     #[error("YAML number could not be represented as f64")]
27 |     YamlNumber,
28 | 
29 |     #[error("invalid dotted path \"{path}\" at segment \"{segment}\"")]
30 |     InvalidPath { path: String, segment: String },
31 | 
32 |     #[error("inheritance target \"{path}\" does not exist (reached from \"{from}\")")]
33 |     ExtendsTargetMissing { from: String, path: String },
34 | 
35 |     #[error("circular $extends dependency detected: {cycle}")]
36 |     ExtendsCycle { cycle: String },
37 | 
38 |     #[error("parameterization error at \"{at}\": {message}")]
39 |     Parameterize { at: String, message: String },
40 | 
41 |     #[error("\"units\" and \"variables\" must be YAML mappings")]
42 |     UnitsNotMap,
43 | 
44 |     #[error("unit/variable \"{key}\" must be a number or string expression")]
45 |     UnitsValueType { key: String },
46 | }
47 | 


--------------------------------------------------------------------------------
/fixtures/m5/outlines/circles___outlines_outline_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -10
 53 | 20
 54 | -10
 55 | 11
 56 | 8.8196601
 57 | 21
 58 | -10
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 8.8196601
 65 | 20
 66 | 10
 67 | 11
 68 | -5
 69 | 21
 70 | 10
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | -10
 77 | 20
 78 | 5
 79 | 11
 80 | -10
 81 | 21
 82 | -10
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 31.1803399
 89 | 20
 90 | -10
 91 | 11
 92 | 50
 93 | 21
 94 | -10
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 50
101 | 20
102 | -10
103 | 11
104 | 50
105 | 21
106 | 5
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 45
113 | 20
114 | 10
115 | 11
116 | 31.1803399
117 | 21
118 | 10
119 | 0
120 | ARC
121 | 8
122 | 0
123 | 10
124 | 20
125 | 20
126 | 0
127 | 40
128 | 15
129 | 50
130 | 221.8103149
131 | 51
132 | 318.1896851
133 | 0
134 | ARC
135 | 8
136 | 0
137 | 10
138 | 20
139 | 20
140 | 0
141 | 40
142 | 15
143 | 50
144 | 401.8103149
145 | 51
146 | 498.1896851
147 | 0
148 | ARC
149 | 8
150 | 0
151 | 10
152 | -10
153 | 20
154 | 10
155 | 40
156 | 5
157 | 50
158 | 0
159 | 51
160 | 270
161 | 0
162 | ARC
163 | 8
164 | 0
165 | 10
166 | 50
167 | 20
168 | 10
169 | 40
170 | 5
171 | 50
172 | 270
173 | 51
174 | 540
175 | 0
176 | ENDSEC
177 | 0
178 | EOF


--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
 1 | name: CI
 2 | 
 3 | on:
 4 |   pull_request:
 5 |   push:
 6 |     branches:
 7 |       - master
 8 |       - main
 9 | 
10 | concurrency:
11 |   group: ci-${{ github.ref }}
12 |   cancel-in-progress: true
13 | 
14 | jobs:
15 |   test:
16 |     runs-on: ubuntu-latest
17 |     steps:
18 |       - name: Checkout
19 |         uses: actions/checkout@v4
20 | 
21 |       - name: Install Rust
22 |         uses: dtolnay/rust-toolchain@stable
23 |         with:
24 |           components: rustfmt, clippy
25 | 
26 |       - name: Cache Rust
27 |         uses: Swatinem/rust-cache@v2
28 | 
29 |       - name: Format
30 |         run: cargo fmt --all -- --check
31 | 
32 |       - name: Clippy
33 |         run: cargo clippy --all-targets --all-features -- -D warnings
34 | 
35 |       - name: Test
36 |         run: cargo test --workspace
37 | 
38 |   wasm:
39 |     runs-on: ubuntu-latest
40 |     steps:
41 |       - name: Checkout
42 |         uses: actions/checkout@v4
43 | 
44 |       - name: Install Node
45 |         uses: actions/setup-node@v4
46 |         with:
47 |           node-version: "20"
48 | 
49 |       - name: Install Rust
50 |         uses: dtolnay/rust-toolchain@stable
51 |         with:
52 |           targets: wasm32-unknown-unknown
53 | 
54 |       - name: Cache Rust
55 |         uses: Swatinem/rust-cache@v2
56 | 
57 |       - name: Install wasm-bindgen-cli
58 |         run: cargo install wasm-bindgen-cli --version 0.2.106
59 | 
60 |       - name: Build wasm crate
61 |         run: cargo build -p ergogen-wasm --target wasm32-unknown-unknown
62 | 
63 |       - name: Test wasm crate
64 |         run: CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner cargo test -p ergogen-wasm --target wasm32-unknown-unknown
65 | 


--------------------------------------------------------------------------------
/fixtures/upstream/test/outlines/circles___outlines_outline_dxf.dxf:
--------------------------------------------------------------------------------
  1 | 0
  2 | SECTION
  3 | 2
  4 | HEADER
  5 | 9
  6 | $INSUNITS
  7 | 70
  8 | 4
  9 | 0
 10 | ENDSEC
 11 | 0
 12 | SECTION
 13 | 2
 14 | TABLES
 15 | 0
 16 | TABLE
 17 | 2
 18 | LTYPE
 19 | 0
 20 | LTYPE
 21 | 72
 22 | 65
 23 | 70
 24 | 64
 25 | 2
 26 | CONTINUOUS
 27 | 3
 28 | ______
 29 | 73
 30 | 0
 31 | 40
 32 | 0
 33 | 0
 34 | ENDTAB
 35 | 0
 36 | TABLE
 37 | 2
 38 | LAYER
 39 | 0
 40 | ENDTAB
 41 | 0
 42 | ENDSEC
 43 | 0
 44 | SECTION
 45 | 2
 46 | ENTITIES
 47 | 0
 48 | LINE
 49 | 8
 50 | 0
 51 | 10
 52 | -10
 53 | 20
 54 | -10
 55 | 11
 56 | 8.8196601
 57 | 21
 58 | -10
 59 | 0
 60 | LINE
 61 | 8
 62 | 0
 63 | 10
 64 | 8.8196601
 65 | 20
 66 | 10
 67 | 11
 68 | -5
 69 | 21
 70 | 10
 71 | 0
 72 | LINE
 73 | 8
 74 | 0
 75 | 10
 76 | -10
 77 | 20
 78 | 5
 79 | 11
 80 | -10
 81 | 21
 82 | -10
 83 | 0
 84 | LINE
 85 | 8
 86 | 0
 87 | 10
 88 | 31.1803399
 89 | 20
 90 | -10
 91 | 11
 92 | 50
 93 | 21
 94 | -10
 95 | 0
 96 | LINE
 97 | 8
 98 | 0
 99 | 10
100 | 50
101 | 20
102 | -10
103 | 11
104 | 50
105 | 21
106 | 5
107 | 0
108 | LINE
109 | 8
110 | 0
111 | 10
112 | 45
113 | 20
114 | 10
115 | 11
116 | 31.1803399
117 | 21
118 | 10
119 | 0
120 | ARC
121 | 8
122 | 0
123 | 10
124 | 20
125 | 20
126 | 0
127 | 40
128 | 15
129 | 50
130 | 221.8103149
131 | 51
132 | 318.1896851
133 | 0
134 | ARC
135 | 8
136 | 0
137 | 10
138 | 20
139 | 20
140 | 0
141 | 40
142 | 15
143 | 50
144 | 401.8103149
145 | 51
146 | 498.1896851
147 | 0
148 | ARC
149 | 8
150 | 0
151 | 10
152 | -10
153 | 20
154 | 10
155 | 40
156 | 5
157 | 50
158 | 0
159 | 51
160 | 270
161 | 0
162 | ARC
163 | 8
164 | 0
165 | 10
166 | 50
167 | 20
168 | 10
169 | 40
170 | 5
171 | 50
172 | 270
173 | 51
174 | 540
175 | 0
176 | ENDSEC
177 | 0
178 | EOF


--------------------------------------------------------------------------------
/crates/ergogen-pcb/templates/footprints/rest/jstph.tpl:
--------------------------------------------------------------------------------
 1 | (module JST_PH_S2B-PH-K_02x2.00mm_Angled (layer F.Cu) (tedit 58D3FE32)
 2 | 
 3 |         (descr "JST PH series connector, S2B-PH-K, side entry type, through hole, Datasheet: http://www.jst-mfg.com/product/pdf/eng/ePH.pdf")
 4 |         (tags "connector jst ph")
 5 | 
 6 |         (at {{at}})
 7 | 
 8 |         
 9 |         (fp_text reference "{{ref}}" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
10 |         (fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
11 | 
12 |         (fp_line (start -2.25 0.25) (end -2.25 -1.35) (layer F.SilkS) (width 0.15))
13 |         (fp_line (start -2.25 -1.35) (end -2.95 -1.35) (layer F.SilkS) (width 0.15))
14 |         (fp_line (start -2.95 -1.35) (end -2.95 6.25) (layer F.SilkS) (width 0.15))
15 |         (fp_line (start -2.95 6.25) (end 2.95 6.25) (layer F.SilkS) (width 0.15))
16 |         (fp_line (start 2.95 6.25) (end 2.95 -1.35) (layer F.SilkS) (width 0.15))
17 |         (fp_line (start 2.95 -1.35) (end 2.25 -1.35) (layer F.SilkS) (width 0.15))
18 |         (fp_line (start 2.25 -1.35) (end 2.25 0.25) (layer F.SilkS) (width 0.15))
19 |         (fp_line (start 2.25 0.25) (end -2.25 0.25) (layer F.SilkS) (width 0.15))
20 | 
21 |         (fp_line (start -1 1.5) (end -1 2.0) (layer F.SilkS) (width 0.15))
22 |         (fp_line (start -1.25 1.75) (end -0.75 1.75) (layer F.SilkS) (width 0.15))
23 | 
24 |         (pad 1 thru_hole rect (at -1 0 0) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) (net {{net_pos_id}} "{{net_pos}}"))
25 |         (pad 2 thru_hole oval (at 1 0 0) (size 1.2 1.7) (drill 0.75) (layers *.Cu *.Mask) (net {{net_neg_id}} "{{net_neg}}"))
26 |             
27 |     )


--------------------------------------------------------------------------------