copperflow 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -12
- package/dist/app/THIRD_PARTY_LICENSES.txt +5 -0
- package/dist/app/assets/NewPartDialog-BBJaZFCo.js +160 -0
- package/dist/app/assets/VerifyPartDialog-BHLqD_WJ.css +1 -0
- package/dist/app/assets/VerifyPartDialog-Ey6xpQ_U.js +2 -0
- package/dist/app/assets/index-BKoIKo22.css +1 -0
- package/dist/app/assets/index-DPmr2dR1.js +20 -0
- package/dist/app/assets/texture-worker-CyI_g_XZ.js +1 -0
- package/dist/app/index.html +2 -2
- package/dist/cli-commands.js +170 -23
- package/dist/cli-commands.js.map +1 -1
- package/dist/cli-impedance.d.ts +4 -0
- package/dist/cli-impedance.js +56 -0
- package/dist/cli-impedance.js.map +1 -0
- package/dist/cli-library.d.ts +5 -0
- package/dist/cli-library.js +58 -0
- package/dist/cli-library.js.map +1 -0
- package/dist/cli-modules.d.ts +6 -0
- package/dist/cli-modules.js +33 -0
- package/dist/cli-modules.js.map +1 -0
- package/dist/cli-simulate.d.ts +3 -0
- package/dist/cli-simulate.js +54 -0
- package/dist/cli-simulate.js.map +1 -0
- package/dist/cli-studio.d.ts +1 -0
- package/dist/cli-studio.js +27 -0
- package/dist/cli-studio.js.map +1 -0
- package/dist/core/analyze.js +5 -2
- package/dist/core/analyze.js.map +1 -1
- package/dist/core/board-import.d.ts +39 -0
- package/dist/core/board-import.js +114 -0
- package/dist/core/board-import.js.map +1 -0
- package/dist/core/board-shape-edit.d.ts +13 -0
- package/dist/core/board-shape-edit.js +134 -0
- package/dist/core/board-shape-edit.js.map +1 -0
- package/dist/core/bom.d.ts +6 -1
- package/dist/core/bom.js +23 -4
- package/dist/core/bom.js.map +1 -1
- package/dist/core/case-results.d.ts +4 -0
- package/dist/core/case-results.js +9 -0
- package/dist/core/case-results.js.map +1 -0
- package/dist/core/change-files.d.ts +31 -0
- package/dist/core/change-files.js +67 -0
- package/dist/core/change-files.js.map +1 -0
- package/dist/core/change-render.d.ts +18 -0
- package/dist/core/change-render.js +48 -0
- package/dist/core/change-render.js.map +1 -0
- package/dist/core/change-view.d.ts +33 -0
- package/dist/core/change-view.js +73 -0
- package/dist/core/change-view.js.map +1 -0
- package/dist/core/change-words.d.ts +39 -0
- package/dist/core/change-words.js +214 -0
- package/dist/core/change-words.js.map +1 -0
- package/dist/core/checklist-text.d.ts +21 -0
- package/dist/core/checklist-text.js +59 -0
- package/dist/core/checklist-text.js.map +1 -0
- package/dist/core/edit.js +12 -3
- package/dist/core/edit.js.map +1 -1
- package/dist/core/fabrication.d.ts +9 -2
- package/dist/core/fabrication.js +29 -10
- package/dist/core/fabrication.js.map +1 -1
- package/dist/core/git.d.ts +16 -0
- package/dist/core/git.js +51 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/home.d.ts +2 -0
- package/dist/core/home.js +10 -0
- package/dist/core/home.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/instance-copper.d.ts +25 -0
- package/dist/core/instance-copper.js +142 -0
- package/dist/core/instance-copper.js.map +1 -0
- package/dist/core/instance-move.d.ts +23 -0
- package/dist/core/instance-move.js +59 -0
- package/dist/core/instance-move.js.map +1 -0
- package/dist/core/instance-requests.d.ts +3 -2
- package/dist/core/instance-requests.js +17 -3
- package/dist/core/instance-requests.js.map +1 -1
- package/dist/core/library-modules.d.ts +29 -0
- package/dist/core/library-modules.js +324 -0
- package/dist/core/library-modules.js.map +1 -0
- package/dist/core/library-sources.d.ts +33 -0
- package/dist/core/library-sources.js +179 -0
- package/dist/core/library-sources.js.map +1 -0
- package/dist/core/library.d.ts +46 -0
- package/dist/core/library.js +54 -16
- package/dist/core/library.js.map +1 -1
- package/dist/core/modules.d.ts +45 -0
- package/dist/core/modules.js +301 -0
- package/dist/core/modules.js.map +1 -0
- package/dist/core/new-circuit-sheets.d.ts +11 -2
- package/dist/core/new-circuit-sheets.js +35 -6
- package/dist/core/new-circuit-sheets.js.map +1 -1
- package/dist/core/order-report.d.ts +10 -0
- package/dist/core/order-report.js +93 -0
- package/dist/core/order-report.js.map +1 -0
- package/dist/core/pin-header.d.ts +5 -0
- package/dist/core/pin-header.js +77 -0
- package/dist/core/pin-header.js.map +1 -0
- package/dist/core/pin-map.d.ts +46 -0
- package/dist/core/pin-map.js +101 -0
- package/dist/core/pin-map.js.map +1 -0
- package/dist/core/placement-write.d.ts +2 -0
- package/dist/core/placement-write.js +12 -6
- package/dist/core/placement-write.js.map +1 -1
- package/dist/core/plain-sheet.d.ts +12 -0
- package/dist/core/plain-sheet.js +169 -0
- package/dist/core/plain-sheet.js.map +1 -0
- package/dist/core/render.d.ts +24 -4
- package/dist/core/render.js +16 -6
- package/dist/core/render.js.map +1 -1
- package/dist/core/sheet-card.d.ts +37 -0
- package/dist/core/sheet-card.js +163 -0
- package/dist/core/sheet-card.js.map +1 -0
- package/dist/core/sheet-files.js +10 -3
- package/dist/core/sheet-files.js.map +1 -1
- package/dist/core/simulate.d.ts +19 -0
- package/dist/core/simulate.js +72 -0
- package/dist/core/simulate.js.map +1 -0
- package/dist/core/step-export.d.ts +17 -0
- package/dist/core/step-export.js +35 -0
- package/dist/core/step-export.js.map +1 -0
- package/dist/core/supplier-prop.d.ts +6 -0
- package/dist/core/supplier-prop.js +21 -0
- package/dist/core/supplier-prop.js.map +1 -0
- package/dist/core/types.d.ts +20 -0
- package/dist/core/workspace.d.ts +6 -1
- package/dist/core/workspace.js +15 -3
- package/dist/core/workspace.js.map +1 -1
- package/dist/engine/board.js +3 -1
- package/dist/engine/board.js.map +1 -1
- package/dist/engine/checks/drc-parts.js +7 -7
- package/dist/engine/checks/drc-parts.js.map +1 -1
- package/dist/engine/checks/erc.js +35 -3
- package/dist/engine/checks/erc.js.map +1 -1
- package/dist/engine/checks/fast-lines.d.ts +60 -0
- package/dist/engine/checks/fast-lines.js +209 -0
- package/dist/engine/checks/fast-lines.js.map +1 -0
- package/dist/engine/checks/index.js +2 -0
- package/dist/engine/checks/index.js.map +1 -1
- package/dist/engine/component.d.ts +2 -0
- package/dist/engine/component.js +18 -1
- package/dist/engine/component.js.map +1 -1
- package/dist/engine/design-diff.d.ts +120 -0
- package/dist/engine/design-diff.js +249 -0
- package/dist/engine/design-diff.js.map +1 -0
- package/dist/engine/design.d.ts +3 -0
- package/dist/engine/design.js +7 -2
- package/dist/engine/design.js.map +1 -1
- package/dist/engine/dxf/board.d.ts +42 -0
- package/dist/engine/dxf/board.js +218 -0
- package/dist/engine/dxf/board.js.map +1 -0
- package/dist/engine/dxf/index.d.ts +2 -0
- package/dist/engine/dxf/index.js +3 -0
- package/dist/engine/dxf/index.js.map +1 -0
- package/dist/engine/dxf/reader.d.ts +43 -0
- package/dist/engine/dxf/reader.js +142 -0
- package/dist/engine/dxf/reader.js.map +1 -0
- package/dist/engine/elaborate.js +14 -4
- package/dist/engine/elaborate.js.map +1 -1
- package/dist/engine/fab/designator-places.d.ts +101 -0
- package/dist/engine/fab/designator-places.js +259 -0
- package/dist/engine/fab/designator-places.js.map +1 -0
- package/dist/engine/fab/designators.d.ts +26 -14
- package/dist/engine/fab/designators.js +320 -70
- package/dist/engine/fab/designators.js.map +1 -1
- package/dist/engine/fab/export.d.ts +17 -1
- package/dist/engine/fab/export.js +26 -4
- package/dist/engine/fab/export.js.map +1 -1
- package/dist/engine/fab/layers.js +6 -6
- package/dist/engine/fab/layers.js.map +1 -1
- package/dist/engine/fab/names.d.ts +2 -2
- package/dist/engine/fab/names.js +4 -2
- package/dist/engine/fab/names.js.map +1 -1
- package/dist/engine/fab/picture/board-picture.d.ts +52 -0
- package/dist/engine/fab/picture/board-picture.js +102 -0
- package/dist/engine/fab/picture/board-picture.js.map +1 -0
- package/dist/engine/fab/picture/board-view.d.ts +20 -0
- package/dist/engine/fab/picture/board-view.js +50 -0
- package/dist/engine/fab/picture/board-view.js.map +1 -0
- package/dist/engine/fab/picture/compose.d.ts +50 -0
- package/dist/engine/fab/picture/compose.js +208 -0
- package/dist/engine/fab/picture/compose.js.map +1 -0
- package/dist/engine/fab/picture/layer-images.d.ts +9 -0
- package/dist/engine/fab/picture/layer-images.js +67 -0
- package/dist/engine/fab/picture/layer-images.js.map +1 -0
- package/dist/engine/fab/picture/looks.d.ts +152 -0
- package/dist/engine/fab/picture/looks.js +53 -0
- package/dist/engine/fab/picture/looks.js.map +1 -0
- package/dist/engine/fab/picture/png.d.ts +31 -0
- package/dist/engine/fab/picture/png.js +47 -0
- package/dist/engine/fab/picture/png.js.map +1 -0
- package/dist/engine/fab/picture/raster.d.ts +46 -0
- package/dist/engine/fab/picture/raster.js +170 -0
- package/dist/engine/fab/picture/raster.js.map +1 -0
- package/dist/engine/fab/stroke-font.d.ts +2 -2
- package/dist/engine/fab/stroke-font.js +7 -6
- package/dist/engine/fab/stroke-font.js.map +1 -1
- package/dist/engine/fab/zip.d.ts +2 -1
- package/dist/engine/fab/zip.js +1 -1
- package/dist/engine/fab/zip.js.map +1 -1
- package/dist/engine/impedance.d.ts +72 -0
- package/dist/engine/impedance.js +133 -0
- package/dist/engine/impedance.js.map +1 -0
- package/dist/engine/line-length.d.ts +15 -0
- package/dist/engine/line-length.js +116 -0
- package/dist/engine/line-length.js.map +1 -0
- package/dist/engine/model.d.ts +17 -1
- package/dist/engine/model.js.map +1 -1
- package/dist/engine/pcb-place/block-board.d.ts +9 -0
- package/dist/engine/pcb-place/block-board.js +256 -0
- package/dist/engine/pcb-place/block-board.js.map +1 -0
- package/dist/engine/pcb-place/blocks.d.ts +31 -6
- package/dist/engine/pcb-place/blocks.js +37 -8
- package/dist/engine/pcb-place/blocks.js.map +1 -1
- package/dist/engine/pcb-place/constructive.d.ts +3 -2
- package/dist/engine/pcb-place/constructive.js +14 -2
- package/dist/engine/pcb-place/constructive.js.map +1 -1
- package/dist/engine/pcb-place/index.d.ts +8 -0
- package/dist/engine/pcb-place/index.js +7 -0
- package/dist/engine/pcb-place/index.js.map +1 -1
- package/dist/engine/pcb-place/roles.d.ts +3 -1
- package/dist/engine/pcb-place/roles.js +5 -0
- package/dist/engine/pcb-place/roles.js.map +1 -1
- package/dist/engine/pcb-place/scope.js +6 -1
- package/dist/engine/pcb-place/scope.js.map +1 -1
- package/dist/engine/pcb.d.ts +6 -0
- package/dist/engine/pcb.js +12 -1
- package/dist/engine/pcb.js.map +1 -1
- package/dist/engine/router/replicate.js +4 -0
- package/dist/engine/router/replicate.js.map +1 -1
- package/dist/engine/router/route-board.d.ts +2 -0
- package/dist/engine/router/route-board.js +27 -1
- package/dist/engine/router/route-board.js.map +1 -1
- package/dist/engine/rules/impedance-widths.d.ts +20 -0
- package/dist/engine/rules/impedance-widths.js +57 -0
- package/dist/engine/rules/impedance-widths.js.map +1 -0
- package/dist/engine/rules/load.js +11 -2
- package/dist/engine/rules/load.js.map +1 -1
- package/dist/engine/rules/pairs.d.ts +27 -0
- package/dist/engine/rules/pairs.js +86 -0
- package/dist/engine/rules/pairs.js.map +1 -0
- package/dist/engine/rules/profiles.js +16 -0
- package/dist/engine/rules/profiles.js.map +1 -1
- package/dist/engine/rules/schema.d.ts +44 -0
- package/dist/engine/rules/schema.js +16 -1
- package/dist/engine/rules/schema.js.map +1 -1
- package/dist/engine/sheet-ports.d.ts +17 -1
- package/dist/engine/sheet-ports.js +38 -1
- package/dist/engine/sheet-ports.js.map +1 -1
- package/dist/engine/sim/answer.d.ts +13 -0
- package/dist/engine/sim/answer.js +101 -0
- package/dist/engine/sim/answer.js.map +1 -0
- package/dist/engine/sim/cases.d.ts +29 -0
- package/dist/engine/sim/cases.js +63 -0
- package/dist/engine/sim/cases.js.map +1 -0
- package/dist/engine/sim/devices.d.ts +109 -0
- package/dist/engine/sim/devices.js +137 -0
- package/dist/engine/sim/devices.js.map +1 -0
- package/dist/engine/sim/elements.d.ts +49 -0
- package/dist/engine/sim/elements.js +2 -0
- package/dist/engine/sim/elements.js.map +1 -0
- package/dist/engine/sim/from-circuit.d.ts +52 -0
- package/dist/engine/sim/from-circuit.js +354 -0
- package/dist/engine/sim/from-circuit.js.map +1 -0
- package/dist/engine/sim/limits.d.ts +12 -0
- package/dist/engine/sim/limits.js +79 -0
- package/dist/engine/sim/limits.js.map +1 -0
- package/dist/engine/sim/linear.d.ts +2 -0
- package/dist/engine/sim/linear.js +49 -0
- package/dist/engine/sim/linear.js.map +1 -0
- package/dist/engine/sim/model-schema.d.ts +246 -0
- package/dist/engine/sim/model-schema.js +115 -0
- package/dist/engine/sim/model-schema.js.map +1 -0
- package/dist/engine/sim/part-models.d.ts +47 -0
- package/dist/engine/sim/part-models.js +102 -0
- package/dist/engine/sim/part-models.js.map +1 -0
- package/dist/engine/sim/run.d.ts +14 -0
- package/dist/engine/sim/run.js +13 -0
- package/dist/engine/sim/run.js.map +1 -0
- package/dist/engine/sim/solve.d.ts +42 -0
- package/dist/engine/sim/solve.js +294 -0
- package/dist/engine/sim/solve.js.map +1 -0
- package/dist/engine/sim/spice.d.ts +5 -0
- package/dist/engine/sim/spice.js +66 -0
- package/dist/engine/sim/spice.js.map +1 -0
- package/dist/engine/sim/values.d.ts +4 -0
- package/dist/engine/sim/values.js +40 -0
- package/dist/engine/sim/values.js.map +1 -0
- package/dist/engine/solid/heights.d.ts +29 -0
- package/dist/engine/solid/heights.js +87 -0
- package/dist/engine/solid/heights.js.map +1 -0
- package/dist/engine/solid/limits.d.ts +7 -0
- package/dist/engine/solid/limits.js +20 -0
- package/dist/engine/solid/limits.js.map +1 -0
- package/dist/engine/solid/model.d.ts +54 -0
- package/dist/engine/solid/model.js +147 -0
- package/dist/engine/solid/model.js.map +1 -0
- package/dist/engine/solid/step.d.ts +5 -0
- package/dist/engine/solid/step.js +164 -0
- package/dist/engine/solid/step.js.map +1 -0
- package/dist/engine/solid/thickness.d.ts +11 -0
- package/dist/engine/solid/thickness.js +10 -0
- package/dist/engine/solid/thickness.js.map +1 -0
- package/dist/library/kicad/board.d.ts +26 -0
- package/dist/library/kicad/board.js +96 -0
- package/dist/library/kicad/board.js.map +1 -0
- package/dist/library/kicad/copper.d.ts +44 -0
- package/dist/library/kicad/copper.js +106 -0
- package/dist/library/kicad/copper.js.map +1 -0
- package/dist/library/kicad/footprints.d.ts +62 -0
- package/dist/library/kicad/footprints.js +184 -0
- package/dist/library/kicad/footprints.js.map +1 -0
- package/dist/library/kicad/geometry.d.ts +36 -0
- package/dist/library/kicad/geometry.js +84 -0
- package/dist/library/kicad/geometry.js.map +1 -0
- package/dist/library/kicad/import.d.ts +58 -0
- package/dist/library/kicad/import.js +240 -0
- package/dist/library/kicad/import.js.map +1 -0
- package/dist/library/kicad/plan.d.ts +40 -0
- package/dist/library/kicad/plan.js +139 -0
- package/dist/library/kicad/plan.js.map +1 -0
- package/dist/library/kicad/read.d.ts +30 -0
- package/dist/library/kicad/read.js +105 -0
- package/dist/library/kicad/read.js.map +1 -0
- package/dist/library/kicad/sexpr.d.ts +36 -0
- package/dist/library/kicad/sexpr.js +153 -0
- package/dist/library/kicad/sexpr.js.map +1 -0
- package/dist/library/kicad/tally.d.ts +32 -0
- package/dist/library/kicad/tally.js +55 -0
- package/dist/library/kicad/tally.js.map +1 -0
- package/dist/library/kicad/write.d.ts +37 -0
- package/dist/library/kicad/write.js +146 -0
- package/dist/library/kicad/write.js.map +1 -0
- package/dist/library/new-part.d.ts +2 -0
- package/dist/library/new-part.js +1 -0
- package/dist/library/new-part.js.map +1 -1
- package/dist/mcp/batch.d.ts +2 -2
- package/dist/mcp/batch.js +12 -12
- package/dist/mcp/batch.js.map +1 -1
- package/dist/mcp/board-import-tool.d.ts +25 -0
- package/dist/mcp/board-import-tool.js +35 -0
- package/dist/mcp/board-import-tool.js.map +1 -0
- package/dist/mcp/board-summary.d.ts +1 -1
- package/dist/mcp/board-summary.js +1 -1
- package/dist/mcp/board-summary.js.map +1 -1
- package/dist/mcp/copper-summary.d.ts +2 -0
- package/dist/mcp/copper-summary.js +4 -2
- package/dist/mcp/copper-summary.js.map +1 -1
- package/dist/mcp/copper-tools.d.ts +4 -4
- package/dist/mcp/copper-tools.js +19 -19
- package/dist/mcp/copper-tools.js.map +1 -1
- package/dist/mcp/create-part.d.ts +24 -1
- package/dist/mcp/create-part.js +9 -8
- package/dist/mcp/create-part.js.map +1 -1
- package/dist/mcp/datasheet-tools.d.ts +1 -1
- package/dist/mcp/datasheet-tools.js +4 -4
- package/dist/mcp/datasheet-tools.js.map +1 -1
- package/dist/mcp/fast-summary.d.ts +3 -0
- package/dist/mcp/fast-summary.js +46 -0
- package/dist/mcp/fast-summary.js.map +1 -0
- package/dist/mcp/fillet-tools.d.ts +2 -2
- package/dist/mcp/fillet-tools.js +6 -6
- package/dist/mcp/fillet-tools.js.map +1 -1
- package/dist/mcp/guide.d.ts +1 -1
- package/dist/mcp/guide.js +4 -3
- package/dist/mcp/guide.js.map +1 -1
- package/dist/mcp/import-part.d.ts +1 -1
- package/dist/mcp/import-part.js +4 -4
- package/dist/mcp/import-part.js.map +1 -1
- package/dist/mcp/make-sheet.d.ts +1 -1
- package/dist/mcp/make-sheet.js +6 -6
- package/dist/mcp/make-sheet.js.map +1 -1
- package/dist/mcp/module-tools.d.ts +4 -0
- package/dist/mcp/module-tools.js +21 -0
- package/dist/mcp/module-tools.js.map +1 -0
- package/dist/mcp/new-circuit.d.ts +13 -2
- package/dist/mcp/new-circuit.js +30 -28
- package/dist/mcp/new-circuit.js.map +1 -1
- package/dist/mcp/open-studio.d.ts +30 -0
- package/dist/mcp/open-studio.js +97 -0
- package/dist/mcp/open-studio.js.map +1 -0
- package/dist/mcp/place-tools.d.ts +2 -2
- package/dist/mcp/place-tools.js +14 -11
- package/dist/mcp/place-tools.js.map +1 -1
- package/dist/mcp/pour-tools.d.ts +4 -4
- package/dist/mcp/pour-tools.js +18 -18
- package/dist/mcp/pour-tools.js.map +1 -1
- package/dist/mcp/project-tools.d.ts +3 -3
- package/dist/mcp/project-tools.js +8 -8
- package/dist/mcp/project-tools.js.map +1 -1
- package/dist/mcp/render-tool.d.ts +33 -2
- package/dist/mcp/render-tool.js +23 -7
- package/dist/mcp/render-tool.js.map +1 -1
- package/dist/mcp/route-tools.d.ts +2 -2
- package/dist/mcp/route-tools.js +10 -10
- package/dist/mcp/route-tools.js.map +1 -1
- package/dist/mcp/server.js +60 -34
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/sheet-card-tools.d.ts +30 -0
- package/dist/mcp/sheet-card-tools.js +47 -0
- package/dist/mcp/sheet-card-tools.js.map +1 -0
- package/dist/mcp/simulate-tool.d.ts +10 -0
- package/dist/mcp/simulate-tool.js +12 -0
- package/dist/mcp/simulate-tool.js.map +1 -0
- package/dist/render/render.js +8178 -118
- package/dist/studio/change-route.d.ts +18 -0
- package/dist/studio/change-route.js +24 -0
- package/dist/studio/change-route.js.map +1 -0
- package/dist/studio/http-error.d.ts +5 -0
- package/dist/studio/http-error.js +9 -0
- package/dist/studio/http-error.js.map +1 -0
- package/dist/studio/idle.d.ts +7 -0
- package/dist/studio/idle.js +34 -0
- package/dist/studio/idle.js.map +1 -0
- package/dist/studio/live.d.ts +2 -0
- package/dist/studio/live.js.map +1 -1
- package/dist/studio/place-runner.js +1 -1
- package/dist/studio/place-runner.js.map +1 -1
- package/dist/studio/run-studio.d.ts +21 -0
- package/dist/studio/run-studio.js +68 -0
- package/dist/studio/run-studio.js.map +1 -0
- package/dist/studio/server.d.ts +5 -0
- package/dist/studio/server.js +66 -16
- package/dist/studio/server.js.map +1 -1
- package/dist/studio/studio-control.d.ts +6 -0
- package/dist/studio/studio-control.js +14 -0
- package/dist/studio/studio-control.js.map +1 -0
- package/dist/studio/studio-note.d.ts +33 -0
- package/dist/studio/studio-note.js +130 -0
- package/dist/studio/studio-note.js.map +1 -0
- package/dist/studio/verify-routes.d.ts +42 -0
- package/dist/studio/verify-routes.js +110 -0
- package/dist/studio/verify-routes.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/library/modules/CanNode/CanNode.sheet.tsx +65 -0
- package/library/modules/CanNode/module.json +4 -0
- package/library/modules/CanNode/parts/MCP2515-I-SO/MCP2515_I_SO.tsx +11 -0
- package/library/modules/CanNode/parts/MCP2515-I-SO/part.yaml +66 -0
- package/library/modules/CanNode/parts/MCP2515-I-SO/verification.md +43 -0
- package/library/modules/CanNode/parts/TJA1051T-3/TJA1051T_3.tsx +11 -0
- package/library/modules/CanNode/parts/TJA1051T-3/part.yaml +36 -0
- package/library/modules/CanNode/parts/TJA1051T-3/verification.md +29 -0
- package/library/modules/DigitalInput24V/DigitalInput24V.sheet.tsx +24 -0
- package/library/modules/DigitalInput24V/module.json +4 -0
- package/library/modules/RelayDriver/RelayDriver.sheet.tsx +39 -0
- package/library/modules/RelayDriver/module.json +4 -0
- package/library/modules/RelayDriver/parts/AO3400A/AO3400A.tsx +11 -0
- package/library/modules/RelayDriver/parts/AO3400A/part.yaml +55 -0
- package/library/modules/RelayDriver/parts/AO3400A/verification.md +34 -0
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/SRD_12VDC_SL_C.tsx +12 -0
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/footprint.yaml +70 -0
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/part.yaml +45 -0
- package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/verification.md +40 -0
- package/package.json +2 -1
- package/skills/copperflow/SKILL.md +16 -16
- package/skills/copperflow/references/copper.md +89 -6
- package/skills/copperflow/references/design-rules.md +48 -0
- package/skills/copperflow/references/modules.md +106 -0
- package/skills/copperflow/references/planning.md +55 -11
- package/skills/copperflow/references/writing-circuits.md +32 -3
- package/skills/copperflow-plan/SKILL.md +7 -4
- package/dist/app/assets/NewPartDialog-B_cnPuI-.js +0 -160
- package/dist/app/assets/index-CSWIIMFE.css +0 -1
- package/dist/app/assets/index-CjN3tctq.js +0 -19
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Electrical values as a part writes them ("4.7k", "100nF", "3.3V", "48mohm") and as the simulator's answer shows
|
|
2
|
+
// them ("3.41 V", "29.6 mA"): SI prefixes, case-sensitive (m is milli, M is mega), units ignored on reading.
|
|
3
|
+
const PREFIX = { p: 1e-12, n: 1e-9, u: 1e-6, "µ": 1e-6, m: 1e-3, k: 1e3, K: 1e3, M: 1e6, G: 1e9 };
|
|
4
|
+
const VALUE = /^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)\s*([pnuµmkKMG]?)\s*(V|A|W|F|H|Hz|Ω|ohm|ohms|R)?$/;
|
|
5
|
+
/** A number from 120, "120", "4.7k", "100nF" or "2mA"; undefined when it is not one. */
|
|
6
|
+
export function parseQuantity(value) {
|
|
7
|
+
if (typeof value === "number")
|
|
8
|
+
return Number.isFinite(value) ? value : undefined;
|
|
9
|
+
if (typeof value !== "string")
|
|
10
|
+
return undefined;
|
|
11
|
+
const match = VALUE.exec(value.trim());
|
|
12
|
+
if (!match)
|
|
13
|
+
return undefined;
|
|
14
|
+
const result = Number(match[1]) * (PREFIX[match[2] ?? ""] ?? 1);
|
|
15
|
+
return Number.isFinite(result) ? result : undefined;
|
|
16
|
+
}
|
|
17
|
+
const SHOWN = [
|
|
18
|
+
[1e9, "G"],
|
|
19
|
+
[1e6, "M"],
|
|
20
|
+
[1e3, "k"],
|
|
21
|
+
[1, ""],
|
|
22
|
+
[1e-3, "m"],
|
|
23
|
+
[1e-6, "µ"],
|
|
24
|
+
[1e-9, "n"],
|
|
25
|
+
[1e-12, "p"],
|
|
26
|
+
];
|
|
27
|
+
/** Below this a figure is shown as 0: the small conductance to ground leaves currents of femtoamps. */
|
|
28
|
+
const SHOWN_ZERO = 1e-13;
|
|
29
|
+
/** `3.41 V`, `29.6 mA`, `355 mW`: three significant digits and a prefix. */
|
|
30
|
+
export function formatQuantity(value, unit) {
|
|
31
|
+
if (!Number.isFinite(value))
|
|
32
|
+
return `${value} ${unit}`;
|
|
33
|
+
if (Math.abs(value) < SHOWN_ZERO)
|
|
34
|
+
return `0 ${unit}`;
|
|
35
|
+
const size = Math.abs(Number(value.toPrecision(3)));
|
|
36
|
+
const [scale, prefix] = SHOWN.find(([step]) => size >= step) ?? [1e-12, "p"];
|
|
37
|
+
const digits = (value / scale).toPrecision(3);
|
|
38
|
+
return `${digits.includes("e") ? Number(digits).toString() : digits} ${prefix}${unit}`;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/engine/sim/values.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,6GAA6G;AAE7G,MAAM,MAAM,GAAqC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAA;AACnI,MAAM,KAAK,GAAG,4FAA4F,CAAA;AAE1G,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IAChF,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/D,OAAO,MA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,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,GAAG,IAAI,EAAE,CAAA;AACxF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ParsedFootprint } from "../footprints/parse.js";
|
|
2
|
+
/** The height of a part whose package the table does not know, in mm. */
|
|
3
|
+
export declare const ASSUMED_HEIGHT = 1;
|
|
4
|
+
/** given: the part says its height; read: a table row read from a named document; typical: a table row not read from a document; assumed: nothing known. */
|
|
5
|
+
export type HeightState = "given" | "read" | "typical" | "assumed";
|
|
6
|
+
export interface PartHeight {
|
|
7
|
+
/** Above the board's surface, in mm. */
|
|
8
|
+
height: number;
|
|
9
|
+
/** "given", "assumed", or the table row's source. */
|
|
10
|
+
source: string;
|
|
11
|
+
state: HeightState;
|
|
12
|
+
assumed: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface HeightRow {
|
|
15
|
+
/** The packages the row covers, as a person reads them. */
|
|
16
|
+
packages: string;
|
|
17
|
+
height: number;
|
|
18
|
+
source: string;
|
|
19
|
+
/** The document and page the figure was read from; a row without one is typical. */
|
|
20
|
+
document?: string;
|
|
21
|
+
matches(parsed: ParsedFootprint): boolean;
|
|
22
|
+
}
|
|
23
|
+
/** The heights by package, in the order they are tried. */
|
|
24
|
+
export declare const HEIGHT_TABLE: readonly HeightRow[];
|
|
25
|
+
/** How tall the part is: given, by package, or ASSUMED_HEIGHT and assumed. */
|
|
26
|
+
export declare function partHeight(part: {
|
|
27
|
+
footprint?: string;
|
|
28
|
+
props: Readonly<Record<string, unknown>>;
|
|
29
|
+
}): PartHeight;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// How tall a part stands above the board, for the 3D model: the height the part gives (`height` in part.yaml, which
|
|
2
|
+
// the generated component passes on, or a `height` prop on a built-in part), else a height by package from the table
|
|
3
|
+
// below, else ASSUMED_HEIGHT, marked assumed. Every figure is the largest seated height (the "A max" of the outline).
|
|
4
|
+
// A row with a `document` was read from that document (its page named); every other row is typical: written from
|
|
5
|
+
// general knowledge of the standards and makers' drawings, not read from them, and named "typical" wherever it shows.
|
|
6
|
+
import { parseFootprint } from "../footprints/parse.js";
|
|
7
|
+
import { parseLength } from "../units.js";
|
|
8
|
+
/** The height of a part whose package the table does not know, in mm. */
|
|
9
|
+
export const ASSUMED_HEIGHT = 1;
|
|
10
|
+
const CHIP_SOURCE = "EIA/IEC 60384-21 chip capacitor sizes: thickness up to the body width plus its tolerance (resistors are thinner)";
|
|
11
|
+
const chip = (code, height) => ({
|
|
12
|
+
packages: `chip ${code}`,
|
|
13
|
+
height,
|
|
14
|
+
source: CHIP_SOURCE,
|
|
15
|
+
matches: (p) => p.kind === "" && p.code === code && p.variant === undefined,
|
|
16
|
+
});
|
|
17
|
+
/** A plain pin row or double row at the 2.54 mm pitch: `_p` set to anything else is another kind of connector. */
|
|
18
|
+
const isHeaderPitch = (p) => p.params["p"] === undefined || p.params["p"] === 2.54;
|
|
19
|
+
/** Radial electrolytic cans: the common can length of makers' general-purpose series for each diameter. */
|
|
20
|
+
const RADIAL_SOURCE = "makers' drawings of general-purpose radial aluminium electrolytic series: the common can length for the diameter";
|
|
21
|
+
const radial = (diameter, height) => ({
|
|
22
|
+
packages: `radial can ${diameter} mm across`,
|
|
23
|
+
height,
|
|
24
|
+
source: RADIAL_SOURCE,
|
|
25
|
+
matches: (p) => p.kind === "radial" && p.code === diameter,
|
|
26
|
+
});
|
|
27
|
+
/** The heights by package, in the order they are tried. */
|
|
28
|
+
export const HEIGHT_TABLE = [
|
|
29
|
+
chip("0402", 0.55),
|
|
30
|
+
chip("0603", 0.9),
|
|
31
|
+
chip("0805", 1.45),
|
|
32
|
+
chip("1206", 1.8),
|
|
33
|
+
{
|
|
34
|
+
packages: "SOIC (narrow)",
|
|
35
|
+
height: 1.75,
|
|
36
|
+
source: "JEDEC MS-012, A max 1.75 mm",
|
|
37
|
+
document: "NXP TJA1051 data sheet Rev. 9, p15, Fig 9, SOT96-1 (SO8, JEDEC MS-012): A max 1.75 mm",
|
|
38
|
+
matches: (p) => p.kind === "soic" && p.suffix === undefined,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
packages: "SOIC (wide)",
|
|
42
|
+
height: 2.65,
|
|
43
|
+
source: "JEDEC MS-013, A max 2.65 mm",
|
|
44
|
+
document: "Microchip MCP2515 data sheet DS20001801J, p82, 18-lead SOIC 7.50 mm body (drawing C04-051C): A max 2.65 mm",
|
|
45
|
+
matches: (p) => p.kind === "soic" && p.suffix === "w",
|
|
46
|
+
},
|
|
47
|
+
{ packages: "SOT-23 (3 leads)", height: 1.12, source: "JEDEC TO-236 AB, A max 1.12 mm", matches: (p) => p.kind === "sot" && p.code === "23" && p.variant === undefined },
|
|
48
|
+
{ packages: "SOT-23-5, SOT-23-6", height: 1.45, source: "JEDEC MO-178, A max 1.45 mm", matches: (p) => p.kind === "sot" && p.code === "23" && (p.variant === "5" || p.variant === "6") },
|
|
49
|
+
{ packages: "QFN", height: 1, source: "JEDEC MO-220, A max 1.00 mm", matches: (p) => p.kind === "qfn" },
|
|
50
|
+
{ packages: "DFN", height: 1, source: "JEDEC MO-229, A max 1.00 mm", matches: (p) => p.kind === "dfn" },
|
|
51
|
+
{ packages: "LQFP, QFP", height: 1.6, source: "JEDEC MS-026 (LQFP), A max 1.60 mm", matches: (p) => p.kind === "lqfp" || p.kind === "qfp" },
|
|
52
|
+
{ packages: "TQFP", height: 1.2, source: "JEDEC MS-026 (TQFP), A max 1.20 mm", matches: (p) => p.kind === "tqfp" },
|
|
53
|
+
{ packages: "SOD-123", height: 1.35, source: "makers' SOD-123 drawings (for example onsemi case 425), A max 1.35 mm", matches: (p) => p.kind === "sod" && p.code === "123" },
|
|
54
|
+
{
|
|
55
|
+
packages: "pin header, 2.54 mm pitch",
|
|
56
|
+
height: 8.5,
|
|
57
|
+
source: "makers' drawings of straight 2.54 mm headers: 2.5 mm insulator and 6 mm of pin above it",
|
|
58
|
+
matches: (p) => p.kind === "pinrow" && isHeaderPitch(p),
|
|
59
|
+
},
|
|
60
|
+
{ packages: "HC-49/U crystal", height: 13.46, source: "crystal makers' HC-49/U drawings, height max 13.46 mm", matches: (p) => p.kind === "hc" && p.code === "49" && p.suffix === undefined },
|
|
61
|
+
{ packages: "HC-49/S crystal", height: 3.5, source: "crystal makers' HC-49/S (HC-49/US) drawings, height max 3.5 mm", matches: (p) => p.kind === "hc" && p.code === "49" && p.suffix === "s" },
|
|
62
|
+
radial("4", 7),
|
|
63
|
+
radial("5", 11),
|
|
64
|
+
radial("6.3", 11),
|
|
65
|
+
radial("8", 11.5),
|
|
66
|
+
radial("10", 16),
|
|
67
|
+
radial("12.5", 20),
|
|
68
|
+
radial("16", 25),
|
|
69
|
+
radial("18", 35.5),
|
|
70
|
+
];
|
|
71
|
+
/** A positive length the part gives as its `height` prop, in mm. */
|
|
72
|
+
function givenHeight(props) {
|
|
73
|
+
const height = parseLength(props["height"]);
|
|
74
|
+
return height !== undefined && height > 0 ? height : undefined;
|
|
75
|
+
}
|
|
76
|
+
/** How tall the part is: given, by package, or ASSUMED_HEIGHT and assumed. */
|
|
77
|
+
export function partHeight(part) {
|
|
78
|
+
const given = givenHeight(part.props);
|
|
79
|
+
if (given !== undefined)
|
|
80
|
+
return { height: given, source: "given", state: "given", assumed: false };
|
|
81
|
+
const parsed = part.footprint === undefined || part.footprint.includes("/") ? undefined : parseFootprint(part.footprint);
|
|
82
|
+
const row = parsed === undefined ? undefined : HEIGHT_TABLE.find((candidate) => candidate.matches(parsed));
|
|
83
|
+
if (row === undefined)
|
|
84
|
+
return { height: ASSUMED_HEIGHT, source: "assumed", state: "assumed", assumed: true };
|
|
85
|
+
return row.document === undefined ? { height: row.height, source: row.source, state: "typical", assumed: false } : { height: row.height, source: row.document, state: "read", assumed: false };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=heights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heights.js","sourceRoot":"","sources":["../../../src/engine/solid/heights.ts"],"names":[],"mapp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AAI,CAAC,SAAS,CAAC,CAAA;IACxH,MAAM,GAAG,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1G,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAC5G,OAAO,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;AAChM,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PartSolid } from "./model.js";
|
|
2
|
+
/** The 3D view's line. */
|
|
3
|
+
export declare const MODEL_LIMITS = "Parts are simple shapes, not their real models; heights marked typical come from a package table, assumed ones are guesses.";
|
|
4
|
+
/** The STEP file's name for a design: "can-module.step". */
|
|
5
|
+
export declare const stepFileName: (name: string) => string;
|
|
6
|
+
/** The export's line about its STEP file: what it is not, and which parts' heights are typical or assumed. */
|
|
7
|
+
export declare function modelLine(file: string, parts: readonly Pick<PartSolid, "name" | "state">[]): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// What the 3D model is not, in the words a person reads beside it: the export's answer and the Studio's 3D view.
|
|
2
|
+
import { naturalCompare } from "../order.js";
|
|
3
|
+
/** The 3D view's line. */
|
|
4
|
+
export const MODEL_LIMITS = "Parts are simple shapes, not their real models; heights marked typical come from a package table, assumed ones are guesses.";
|
|
5
|
+
/** The STEP file's name for a design: "can-module.step". */
|
|
6
|
+
export const stepFileName = (name) => `${name}.step`;
|
|
7
|
+
const named = (parts, state) => {
|
|
8
|
+
const names = parts
|
|
9
|
+
.filter((part) => part.state === state)
|
|
10
|
+
.map((part) => part.name)
|
|
11
|
+
.sort(naturalCompare);
|
|
12
|
+
return names.length === 0 ? `none ${state}` : `${state}: ${names.join(", ")}`;
|
|
13
|
+
};
|
|
14
|
+
/** The export's line about its STEP file: what it is not, and which parts' heights are typical or assumed. */
|
|
15
|
+
export function modelLine(file, parts) {
|
|
16
|
+
const typical = named(parts, "typical");
|
|
17
|
+
const assumed = named(parts, "assumed");
|
|
18
|
+
return `${file}: parts are boxes, not their real shapes; heights marked typical come from a package table, assumed ones are guesses (${typical}${typical.startsWith("none") && assumed.startsWith("none") ? ", " : "; "}${assumed}).`;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../../src/engine/solid/limits.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG5C,0BAA0B;AAC1B,MAAM,CAAC,MAAM,YAAY,GAAG,6HAA6H,CAAA;AAEzJ,4DAA4D;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,GAAG,IAAI,OAAO,CAAA;AAEpE,MAAM,KAAK,GAAG,CAAC,KAAmD,EAAE,KAAyB,EAAU,EAAE;IACvG,MAAM,KAAK,GAAG,KAAK;SAChB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;SACtC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;SACxB,IAAI,CAAC,cAAc,CAAC,CAAA;IACvB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;AAC/E,CAAC,CAAA;AAED,8GAA8G;AAC9G,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,KAAmD;IACzF,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,GAAG,IAAI,yHAAyH,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,IAAI,CAAA;AACvO,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Design } from "../design.js";
|
|
2
|
+
import type { Point } from "../model.js";
|
|
3
|
+
import { type HeightState } from "./heights.js";
|
|
4
|
+
/** A straight edge, or an arc around `centre` that turns counter-clockwise (seen from +z) when `ccw`, clockwise if not. */
|
|
5
|
+
export type Segment = {
|
|
6
|
+
kind: "line";
|
|
7
|
+
from: Point;
|
|
8
|
+
to: Point;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "arc";
|
|
11
|
+
from: Point;
|
|
12
|
+
to: Point;
|
|
13
|
+
centre: Point;
|
|
14
|
+
radius: number;
|
|
15
|
+
ccw: boolean;
|
|
16
|
+
};
|
|
17
|
+
export interface BoardSolid {
|
|
18
|
+
/** Counter-clockwise seen from the top. */
|
|
19
|
+
outline: Segment[];
|
|
20
|
+
/** Each clockwise seen from the top. */
|
|
21
|
+
holes: Segment[][];
|
|
22
|
+
thickness: number;
|
|
23
|
+
}
|
|
24
|
+
export interface PartSolid {
|
|
25
|
+
/** The designator. */
|
|
26
|
+
name: string;
|
|
27
|
+
side: "top" | "bottom";
|
|
28
|
+
/** The box's footprint on the board, counter-clockwise seen from the top. */
|
|
29
|
+
corners: [Point, Point, Point, Point];
|
|
30
|
+
/** The box's lowest and highest z, in mm; the board's bottom is z = 0. */
|
|
31
|
+
bottom: number;
|
|
32
|
+
top: number;
|
|
33
|
+
height: number;
|
|
34
|
+
/** Where the height comes from: "given", "assumed", or the height table's source. */
|
|
35
|
+
source: string;
|
|
36
|
+
state: HeightState;
|
|
37
|
+
assumed: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface SolidModel {
|
|
40
|
+
/** Absent when the design has no board with an outline. */
|
|
41
|
+
board?: BoardSolid;
|
|
42
|
+
parts: PartSolid[];
|
|
43
|
+
}
|
|
44
|
+
/** The sweep of an arc segment, in radians: positive counter-clockwise, in (0, 2π] either way. */
|
|
45
|
+
export declare function arcSweep(segment: Extract<Segment, {
|
|
46
|
+
kind: "arc";
|
|
47
|
+
}>): number;
|
|
48
|
+
/** The signed area a closed loop of segments encloses, positive when it runs counter-clockwise. */
|
|
49
|
+
export declare function loopArea(loop: readonly Segment[]): number;
|
|
50
|
+
/** The board and every part of a built design as solids, at the thickness boardThickness gives. */
|
|
51
|
+
export declare function solidModel(design: Design): SolidModel;
|
|
52
|
+
/** The board's volume: its outline's area less its holes', times its thickness. */
|
|
53
|
+
export declare function boardVolume(board: BoardSolid): number;
|
|
54
|
+
export declare function partVolume(part: PartSolid): number;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { partHeight } from "./heights.js";
|
|
2
|
+
import { boardThickness } from "./thickness.js";
|
|
3
|
+
/** A part without a footprint occupies this square (mm), as on the PCB. */
|
|
4
|
+
const FALLBACK_HALF = 0.5;
|
|
5
|
+
/** Twice the signed area of a polygon, positive when counter-clockwise. */
|
|
6
|
+
function doubledArea(points) {
|
|
7
|
+
let sum = 0;
|
|
8
|
+
for (let i = 0; i < points.length; i++) {
|
|
9
|
+
const p = points[i];
|
|
10
|
+
const q = points[(i + 1) % points.length];
|
|
11
|
+
sum += p.x * q.y - q.x * p.y;
|
|
12
|
+
}
|
|
13
|
+
return sum;
|
|
14
|
+
}
|
|
15
|
+
/** The sweep of an arc segment, in radians: positive counter-clockwise, in (0, 2π] either way. */
|
|
16
|
+
export function arcSweep(segment) {
|
|
17
|
+
const { from, to, centre, ccw } = segment;
|
|
18
|
+
const start = Math.atan2(from.y - centre.y, from.x - centre.x);
|
|
19
|
+
const end = Math.atan2(to.y - centre.y, to.x - centre.x);
|
|
20
|
+
let sweep = ccw ? end - start : start - end;
|
|
21
|
+
while (sweep <= 1e-12)
|
|
22
|
+
sweep += 2 * Math.PI;
|
|
23
|
+
while (sweep > 2 * Math.PI + 1e-12)
|
|
24
|
+
sweep -= 2 * Math.PI;
|
|
25
|
+
return ccw ? sweep : -sweep;
|
|
26
|
+
}
|
|
27
|
+
/** The signed area a closed loop of segments encloses, positive when it runs counter-clockwise. */
|
|
28
|
+
export function loopArea(loop) {
|
|
29
|
+
let sum = 0;
|
|
30
|
+
for (const segment of loop) {
|
|
31
|
+
sum += (segment.from.x * segment.to.y - segment.to.x * segment.from.y) / 2;
|
|
32
|
+
if (segment.kind === "arc") {
|
|
33
|
+
// The circular segment between the chord and the arc: r²(θ − sin θ)/2, signed with the turn.
|
|
34
|
+
const theta = arcSweep(segment);
|
|
35
|
+
sum += (segment.radius ** 2 * (theta - Math.sin(theta))) / 2;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return sum;
|
|
39
|
+
}
|
|
40
|
+
const lines = (points) => points.map((from, i) => ({ kind: "line", from, to: points[(i + 1) % points.length] }));
|
|
41
|
+
/** A round hole as two half circles, clockwise seen from the top. */
|
|
42
|
+
function circleHole(centre, radius) {
|
|
43
|
+
const east = { x: centre.x + radius, y: centre.y };
|
|
44
|
+
const west = { x: centre.x - radius, y: centre.y };
|
|
45
|
+
return [
|
|
46
|
+
{ kind: "arc", from: east, to: west, centre, radius, ccw: false },
|
|
47
|
+
{ kind: "arc", from: west, to: east, centre, radius, ccw: false },
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
/** An oval drill as a slot: two half circles joined by straight sides, clockwise seen from the top. */
|
|
51
|
+
function slotHole(pad, drill) {
|
|
52
|
+
const radius = Math.min(drill.width, drill.height) / 2;
|
|
53
|
+
const half = Math.abs(drill.width - drill.height) / 2;
|
|
54
|
+
const along = ((pad.rotation + (drill.width >= drill.height ? 0 : 90)) * Math.PI) / 180;
|
|
55
|
+
const [ux, uy] = [Math.cos(along), Math.sin(along)];
|
|
56
|
+
const at = (s, t) => ({ x: pad.x + ux * s - uy * t, y: pad.y + uy * s + ux * t });
|
|
57
|
+
const [a, b] = [at(half, 0), at(-half, 0)];
|
|
58
|
+
// Clockwise: along the bottom side from a to b, round b's end, back along the top side, round a's end.
|
|
59
|
+
return [
|
|
60
|
+
{ kind: "line", from: at(half, -radius), to: at(-half, -radius) },
|
|
61
|
+
{ kind: "arc", from: at(-half, -radius), to: at(-half, radius), centre: b, radius, ccw: false },
|
|
62
|
+
{ kind: "line", from: at(-half, radius), to: at(half, radius) },
|
|
63
|
+
{ kind: "arc", from: at(half, radius), to: at(half, -radius), centre: a, radius, ccw: false },
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
function drillHole(pad) {
|
|
67
|
+
const drill = pad.drill;
|
|
68
|
+
if (pad.layers !== "through" || drill === undefined || !(drill.width > 0 && drill.height > 0))
|
|
69
|
+
return undefined;
|
|
70
|
+
return drill.width === drill.height ? circleHole(pad, drill.width / 2) : slotHole(pad, drill);
|
|
71
|
+
}
|
|
72
|
+
function boardSolid(design, thickness) {
|
|
73
|
+
const board = design.pcb.board;
|
|
74
|
+
if (board === undefined || board.outline.length < 3)
|
|
75
|
+
return undefined;
|
|
76
|
+
const outline = doubledArea(board.outline) < 0 ? [...board.outline].reverse() : board.outline;
|
|
77
|
+
const drills = design.pcb.parts.flatMap((part) => part.pads.flatMap((pad) => {
|
|
78
|
+
const hole = drillHole(pad);
|
|
79
|
+
return hole === undefined ? [] : [hole];
|
|
80
|
+
}));
|
|
81
|
+
const mounting = design.pcb.holes.map((hole) => circleHole(hole, hole.diameter / 2));
|
|
82
|
+
return { outline: lines(outline), holes: [...mounting, ...drills], thickness };
|
|
83
|
+
}
|
|
84
|
+
/** The rectangle the part's box stands on, in the part's own frame: its courtyard's bounds, else its pads'. */
|
|
85
|
+
function localBounds(footprint) {
|
|
86
|
+
if (footprint === undefined)
|
|
87
|
+
return { minX: -FALLBACK_HALF, minY: -FALLBACK_HALF, maxX: FALLBACK_HALF, maxY: FALLBACK_HALF };
|
|
88
|
+
const points = footprint.courtyard.length >= 3 ? footprint.courtyard : footprint.pads.flatMap(padCorners);
|
|
89
|
+
if (points.length === 0)
|
|
90
|
+
return localBounds(undefined);
|
|
91
|
+
const xs = points.map((p) => p.x);
|
|
92
|
+
const ys = points.map((p) => p.y);
|
|
93
|
+
return { minX: Math.min(...xs), minY: Math.min(...ys), maxX: Math.max(...xs), maxY: Math.max(...ys) };
|
|
94
|
+
}
|
|
95
|
+
function padCorners(pad) {
|
|
96
|
+
const radians = (pad.rotation * Math.PI) / 180;
|
|
97
|
+
const [cos, sin] = [Math.cos(radians), Math.sin(radians)];
|
|
98
|
+
return [
|
|
99
|
+
[-1, -1],
|
|
100
|
+
[1, -1],
|
|
101
|
+
[1, 1],
|
|
102
|
+
[-1, 1],
|
|
103
|
+
].map(([sx, sy]) => {
|
|
104
|
+
const [dx, dy] = [(sx * pad.width) / 2, (sy * pad.height) / 2];
|
|
105
|
+
return { x: pad.x + dx * cos - dy * sin, y: pad.y + dx * sin + dy * cos };
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/** Turn counter-clockwise, mirror x on the bottom side, then move: as the PCB places a footprint. */
|
|
109
|
+
function placed(point, part) {
|
|
110
|
+
const radians = (part.rotation * Math.PI) / 180;
|
|
111
|
+
const [cos, sin] = [Math.cos(radians), Math.sin(radians)];
|
|
112
|
+
const [rx, ry] = [point.x * cos - point.y * sin, point.x * sin + point.y * cos];
|
|
113
|
+
return { x: part.x + (part.side === "bottom" ? -rx : rx), y: part.y + ry };
|
|
114
|
+
}
|
|
115
|
+
function partSolid(part, props, footprintText, thickness) {
|
|
116
|
+
const { minX, minY, maxX, maxY } = localBounds(part.footprint);
|
|
117
|
+
const local = [
|
|
118
|
+
{ x: minX, y: minY },
|
|
119
|
+
{ x: maxX, y: minY },
|
|
120
|
+
{ x: maxX, y: maxY },
|
|
121
|
+
{ x: minX, y: maxY },
|
|
122
|
+
];
|
|
123
|
+
const world = local.map((p) => placed(p, part));
|
|
124
|
+
const corners = (doubledArea(world) < 0 ? [world[0], world[3], world[2], world[1]] : world);
|
|
125
|
+
const { height, source, state, assumed } = partHeight({ ...(footprintText === undefined ? {} : { footprint: footprintText }), props });
|
|
126
|
+
const [bottom, top] = part.side === "top" ? [thickness, thickness + height] : [-height, 0];
|
|
127
|
+
return { name: part.component, side: part.side, corners, bottom, top, height, source, state, assumed };
|
|
128
|
+
}
|
|
129
|
+
/** The board and every part of a built design as solids, at the thickness boardThickness gives. */
|
|
130
|
+
export function solidModel(design) {
|
|
131
|
+
const thickness = boardThickness(design);
|
|
132
|
+
const board = boardSolid(design, thickness);
|
|
133
|
+
const components = new Map(design.circuit.components.map((component) => [component.id, component]));
|
|
134
|
+
const parts = design.pcb.parts.map((part) => {
|
|
135
|
+
const component = components.get(part.component);
|
|
136
|
+
return partSolid(part, component?.props ?? {}, component?.footprint, thickness);
|
|
137
|
+
});
|
|
138
|
+
return { ...(board ? { board } : {}), parts };
|
|
139
|
+
}
|
|
140
|
+
/** The board's volume: its outline's area less its holes', times its thickness. */
|
|
141
|
+
export function boardVolume(board) {
|
|
142
|
+
return (loopArea(board.outline) + board.holes.reduce((sum, hole) => sum + loopArea(hole), 0)) * board.thickness;
|
|
143
|
+
}
|
|
144
|
+
export function partVolume(part) {
|
|
145
|
+
return (doubledArea(part.corners) / 2) * (part.top - part.bottom);
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/engine/solid/model.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAmC/C,2EAA2E;AAC3E,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB,2EAA2E;AAC3E,SAAS,WAAW,CAAC,MAAwB;IAC3C,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAU,CAAA;QAC5B,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAU,CAAA;QAClD,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,QAAQ,CAAC,OAA0C;IACjE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,EAAE,C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KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1C,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAChD,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;IACjF,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAA;AAC/C,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;AACjH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAe;IACxC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;AACnE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SolidModel } from "./model.js";
|
|
2
|
+
/** A real as the format wants it: always with a decimal point, rounded to 1e-10 mm so float noise does not show. */
|
|
3
|
+
export declare function stepReal(value: number): string;
|
|
4
|
+
/** The exchange file of the model: an assembly named `name` holding the board and every part. */
|
|
5
|
+
export declare function stepText(model: SolidModel, name: string): string;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/** A real as the format wants it: always with a decimal point, rounded to 1e-10 mm so float noise does not show. */
|
|
2
|
+
export function stepReal(value) {
|
|
3
|
+
const rounded = Math.round(value * 1e10) / 1e10;
|
|
4
|
+
const clean = Object.is(rounded, -0) || rounded === 0 ? 0 : rounded;
|
|
5
|
+
const text = String(clean);
|
|
6
|
+
if (/e/i.test(text)) {
|
|
7
|
+
const [mantissa = "0", exponent = "0"] = text.toUpperCase().split("E");
|
|
8
|
+
return `${mantissa.includes(".") ? mantissa : `${mantissa}.`}E${exponent.startsWith("-") ? exponent : `+${exponent.replace("+", "")}`}`;
|
|
9
|
+
}
|
|
10
|
+
return text.includes(".") ? text : `${text}.`;
|
|
11
|
+
}
|
|
12
|
+
/** A string as the format quotes it. */
|
|
13
|
+
const quoted = (text) => `'${text.replace(/'/g, "''")}'`;
|
|
14
|
+
class Entities {
|
|
15
|
+
lines = [];
|
|
16
|
+
add(text) {
|
|
17
|
+
this.lines.push(text);
|
|
18
|
+
return this.lines.length;
|
|
19
|
+
}
|
|
20
|
+
text() {
|
|
21
|
+
return this.lines.map((line, i) => `#${i + 1}=${line};\n`).join("");
|
|
22
|
+
}
|
|
23
|
+
point(p) {
|
|
24
|
+
return this.add(`CARTESIAN_POINT('',(${p.map(stepReal).join(",")}))`);
|
|
25
|
+
}
|
|
26
|
+
direction(d) {
|
|
27
|
+
return this.add(`DIRECTION('',(${d.map(stepReal).join(",")}))`);
|
|
28
|
+
}
|
|
29
|
+
placement(at, axis, ref) {
|
|
30
|
+
return this.add(`AXIS2_PLACEMENT_3D('',#${this.point(at)},#${this.direction(axis)},#${this.direction(ref)})`);
|
|
31
|
+
}
|
|
32
|
+
line(at, along) {
|
|
33
|
+
return this.add(`LINE('',#${this.point(at)},#${this.add(`VECTOR('',#${this.direction(along)},1.)`)})`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const UP = [0, 0, 1];
|
|
37
|
+
const DOWN = [0, 0, -1];
|
|
38
|
+
const EAST = [1, 0, 0];
|
|
39
|
+
const unit = (from, to) => {
|
|
40
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
41
|
+
return [(to.x - from.x) / length, (to.y - from.y) / length, 0];
|
|
42
|
+
};
|
|
43
|
+
/** The edge along a segment at height z, from vertex `a` to `b`. */
|
|
44
|
+
function segmentEdge(out, segment, z, a, b) {
|
|
45
|
+
if (segment.kind === "line")
|
|
46
|
+
return out.add(`EDGE_CURVE('',#${a},#${b},#${out.line([segment.from.x, segment.from.y, z], unit(segment.from, segment.to))},.T.)`);
|
|
47
|
+
const circle = out.add(`CIRCLE('',#${out.placement([segment.centre.x, segment.centre.y, z], UP, EAST)},${stepReal(segment.radius)})`);
|
|
48
|
+
return out.add(`EDGE_CURVE('',#${a},#${b},#${circle},${segment.ccw ? ".T." : ".F."})`);
|
|
49
|
+
}
|
|
50
|
+
/** The vertices and edges of one loop of the prism: per segment its two start vertices, its two edges and its riser. */
|
|
51
|
+
function ring(out, loop, z0, z1) {
|
|
52
|
+
const lows = loop.map((s) => out.add(`VERTEX_POINT('',#${out.point([s.from.x, s.from.y, z0])})`));
|
|
53
|
+
const highs = loop.map((s) => out.add(`VERTEX_POINT('',#${out.point([s.from.x, s.from.y, z1])})`));
|
|
54
|
+
return loop.map((segment, i) => {
|
|
55
|
+
const next = (i + 1) % loop.length;
|
|
56
|
+
const [low, high] = [lows[i], highs[i]];
|
|
57
|
+
return {
|
|
58
|
+
segment,
|
|
59
|
+
low,
|
|
60
|
+
high,
|
|
61
|
+
bottomEdge: segmentEdge(out, segment, z0, low, lows[next]),
|
|
62
|
+
topEdge: segmentEdge(out, segment, z1, high, highs[next]),
|
|
63
|
+
riser: out.add(`EDGE_CURVE('',#${low},#${high},#${out.line([segment.from.x, segment.from.y, z0], UP)},.T.)`),
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const oriented = (out, edge, forward) => out.add(`ORIENTED_EDGE('',*,*,#${edge},${forward ? ".T." : ".F."})`);
|
|
68
|
+
const loopOf = (out, edges) => out.add(`EDGE_LOOP('',(${edges.map((e) => `#${e}`).join(",")}))`);
|
|
69
|
+
const bound = (out, loop, outer) => out.add(`${outer ? "FACE_OUTER_BOUND" : "FACE_BOUND"}('',#${loop},.T.)`);
|
|
70
|
+
const face = (out, bounds, surface, sameSense) => out.add(`ADVANCED_FACE('',(${bounds.map((b) => `#${b}`).join(",")}),#${surface},${sameSense ? ".T." : ".F."})`);
|
|
71
|
+
/**
|
|
72
|
+
* A prism between z0 and z1 whose first loop is its outline (counter-clockwise seen from the top) and whose other loops
|
|
73
|
+
* are holes (clockwise): the top and bottom faces, and a side face per segment, a plane for a straight edge and a
|
|
74
|
+
* cylinder for an arc. Every face's loops run counter-clockwise seen from outside the solid. Returns the shell.
|
|
75
|
+
*/
|
|
76
|
+
function prism(out, loops, z0, z1) {
|
|
77
|
+
const rings = loops.map((loop) => ring(out, loop, z0, z1));
|
|
78
|
+
const faces = [];
|
|
79
|
+
const top = rings.map((r, i) => bound(out, loopOf(out, r.map((s) => oriented(out, s.topEdge, true))), i === 0));
|
|
80
|
+
faces.push(face(out, top, out.add(`PLANE('',#${out.placement([0, 0, z1], UP, EAST)})`), true));
|
|
81
|
+
const bottom = rings.map((r, i) => bound(out, loopOf(out, [...r].reverse().map((s) => oriented(out, s.bottomEdge, false))), i === 0));
|
|
82
|
+
faces.push(face(out, bottom, out.add(`PLANE('',#${out.placement([0, 0, z0], DOWN, EAST)})`), true));
|
|
83
|
+
for (const r of rings) {
|
|
84
|
+
r.forEach((side, i) => {
|
|
85
|
+
const next = r[(i + 1) % r.length];
|
|
86
|
+
const edges = [oriented(out, side.bottomEdge, true), oriented(out, next.riser, true), oriented(out, side.topEdge, false), oriented(out, side.riser, false)];
|
|
87
|
+
const { segment } = side;
|
|
88
|
+
const surface = segment.kind === "line"
|
|
89
|
+
? (() => {
|
|
90
|
+
const [dx, dy] = unit(segment.from, segment.to);
|
|
91
|
+
return out.add(`PLANE('',#${out.placement([segment.from.x, segment.from.y, z0], [dy, -dx, 0], [dx, dy, 0])})`);
|
|
92
|
+
})()
|
|
93
|
+
: out.add(`CYLINDRICAL_SURFACE('',#${out.placement([segment.centre.x, segment.centre.y, z0], UP, EAST)},${stepReal(segment.radius)})`);
|
|
94
|
+
faces.push(face(out, [bound(out, loopOf(out, edges), true)], surface, segment.kind === "line" ? true : segment.ccw));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return out.add(`CLOSED_SHELL('',(${faces.map((f) => `#${f}`).join(",")}))`);
|
|
98
|
+
}
|
|
99
|
+
const boxLoop = (part) => part.corners.map((from, i) => ({ kind: "line", from, to: part.corners[(i + 1) % 4] }));
|
|
100
|
+
/** The shared contexts: application, product, definition, and the 3D context in mm, radians and steradians. */
|
|
101
|
+
function contexts(out) {
|
|
102
|
+
const app = out.add("APPLICATION_CONTEXT('core data for automotive mechanical design processes')");
|
|
103
|
+
out.add(`APPLICATION_PROTOCOL_DEFINITION('international standard','automotive_design',2000,#${app})`);
|
|
104
|
+
const product = out.add(`PRODUCT_CONTEXT('',#${app},'mechanical')`);
|
|
105
|
+
const definition = out.add(`PRODUCT_DEFINITION_CONTEXT('part definition',#${app},'design')`);
|
|
106
|
+
const length = out.add("(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.))");
|
|
107
|
+
const angle = out.add("(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.))");
|
|
108
|
+
const solidAngle = out.add("(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT())");
|
|
109
|
+
const accuracy = out.add(`UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#${length},'distance_accuracy_value','confusion accuracy')`);
|
|
110
|
+
const geometry = out.add(`(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#${accuracy}))GLOBAL_UNIT_ASSIGNED_CONTEXT((#${length},#${angle},#${solidAngle}))REPRESENTATION_CONTEXT('Context3D','3D context in mm'))`);
|
|
111
|
+
return { product, definition, geometry };
|
|
112
|
+
}
|
|
113
|
+
/** A product and its definition; returns the definition and its shape. */
|
|
114
|
+
function product(out, context, name) {
|
|
115
|
+
const item = out.add(`PRODUCT(${quoted(name)},${quoted(name)},'',(#${context.product}))`);
|
|
116
|
+
const formation = out.add(`PRODUCT_DEFINITION_FORMATION('','',#${item})`);
|
|
117
|
+
const definition = out.add(`PRODUCT_DEFINITION('design','',#${formation},#${context.definition})`);
|
|
118
|
+
return { definition, shape: out.add(`PRODUCT_DEFINITION_SHAPE('','',#${definition})`) };
|
|
119
|
+
}
|
|
120
|
+
const ORIGIN = [0, 0, 0];
|
|
121
|
+
/** The header's time stamp: the same for every file, so a design always writes the same bytes. */
|
|
122
|
+
const FIXED_STAMP = "2000-01-01T00:00:00";
|
|
123
|
+
/** The exchange file of the model: an assembly named `name` holding the board and every part. */
|
|
124
|
+
export function stepText(model, name) {
|
|
125
|
+
const out = new Entities();
|
|
126
|
+
const context = contexts(out);
|
|
127
|
+
const assembly = product(out, context, name);
|
|
128
|
+
const solids = [
|
|
129
|
+
...(model.board ? [{ name: "board", loops: [model.board.outline, ...model.board.holes], z0: 0, z1: model.board.thickness }] : []),
|
|
130
|
+
...model.parts.map((part) => ({ name: part.name, loops: [boxLoop(part)], z0: part.bottom, z1: part.top })),
|
|
131
|
+
];
|
|
132
|
+
const children = solids.map((solid) => {
|
|
133
|
+
const made = product(out, context, solid.name);
|
|
134
|
+
const brep = out.add(`MANIFOLD_SOLID_BREP(${quoted(solid.name)},#${prism(out, solid.loops, solid.z0, solid.z1)})`);
|
|
135
|
+
const origin = out.placement(ORIGIN, UP, EAST);
|
|
136
|
+
const representation = out.add(`ADVANCED_BREP_SHAPE_REPRESENTATION(${quoted(solid.name)},(#${brep},#${origin}),#${context.geometry})`);
|
|
137
|
+
out.add(`SHAPE_DEFINITION_REPRESENTATION(#${made.shape},#${representation})`);
|
|
138
|
+
return { ...made, name: solid.name, origin, representation };
|
|
139
|
+
});
|
|
140
|
+
const places = children.map(() => out.placement(ORIGIN, UP, EAST));
|
|
141
|
+
const assemblyOrigin = out.placement(ORIGIN, UP, EAST);
|
|
142
|
+
const assemblyShape = out.add(`SHAPE_REPRESENTATION(${quoted(name)},(${[assemblyOrigin, ...places].map((p) => `#${p}`).join(",")}),#${context.geometry})`);
|
|
143
|
+
out.add(`SHAPE_DEFINITION_REPRESENTATION(#${assembly.shape},#${assemblyShape})`);
|
|
144
|
+
children.forEach((child, i) => {
|
|
145
|
+
const usage = out.add(`NEXT_ASSEMBLY_USAGE_OCCURRENCE('NAUO${i + 1}',${quoted(child.name)},'',#${assembly.definition},#${child.definition},$)`);
|
|
146
|
+
const placementShape = out.add(`PRODUCT_DEFINITION_SHAPE('Placement','',#${usage})`);
|
|
147
|
+
const transform = out.add(`ITEM_DEFINED_TRANSFORMATION('','',#${child.origin},#${places[i]})`);
|
|
148
|
+
const relation = out.add(`(REPRESENTATION_RELATIONSHIP('','',#${child.representation},#${assemblyShape})REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#${transform})SHAPE_REPRESENTATION_RELATIONSHIP())`);
|
|
149
|
+
out.add(`CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#${relation},#${placementShape})`);
|
|
150
|
+
});
|
|
151
|
+
return [
|
|
152
|
+
"ISO-10303-21;\n",
|
|
153
|
+
"HEADER;\n",
|
|
154
|
+
"FILE_DESCRIPTION(('The board and its parts as boxes'),'2;1');\n",
|
|
155
|
+
`FILE_NAME(${quoted(`${name}.step`)},'${FIXED_STAMP}',(''),(''),'copperflow','copperflow','');\n`,
|
|
156
|
+
"FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));\n",
|
|
157
|
+
"ENDSEC;\n",
|
|
158
|
+
"DATA;\n",
|
|
159
|
+
out.text(),
|
|
160
|
+
"ENDSEC;\n",
|
|
161
|
+
"END-ISO-10303-21;\n",
|
|
162
|
+
].join("");
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=step.js.map
|