Package detail

pcb-stackup

tracespace1.2kMIT4.2.8

Render PCBs as beautiful, precise SVGs from Gerber / NC drill files

pcb, gerber, excellon, svg

readme

pcb stackup

latest next david

Render PCBs as beautiful, precise SVGs from Gerber / NC drill files

Part of the tracespace collection of PCB visualization tools.

install

npm install --save pcb-stackup
# or
yarn add pcb-stackup

Or, use a script tag:

<script src="https://unpkg.com/pcb-stackup@^4.0.0/dist/pcb-stackup.min.js"></script>
<script>
  // global variable pcbStackup now available
  pcbStackup(layers).then(stackup => {
    // ...
  })
</script>

example

arduino-uno-top arduino-uno-bottom

After you clone and set-up the repository as detailed in development setup, you can run pcb-stackup's example script to render the top and bottom of an Arduino Uno PCB.

cd tracespace/packages/pcb-stackup
yarn example

Arduino Uno design files used here under the terms of the Creative Commons Attribution Share-Alike license.

usage

This module is designed to work in Node or in the browser with Browserify or Webpack. The function takes three parameters: an array of layer objects an optional settings object and a callback function.

const fs = require('fs')
const pcbStackup = require('pcb-stackup')

const fileNames = [
  '/path/to/board-F.Cu.gtl',
  '/path/to/board-F.Mask.gts',
  '/path/to/board-F.SilkS.gto',
  '/path/to/board-F.Paste.gtp',
  '/path/to/board-B.Cu.gbl',
  '/path/to/board-B.Mask.gbs',
  '/path/to/board-B.SilkS.gbo',
  '/path/to/board-B.Paste.gbp',
  '/path/to/board-Edge.Cuts.gm1',
  '/path/to/board.drl',
  '/path/to/board-NPTH.drl',
]

const layers = fileNames.map(filename => ({
  filename,
  gerber: fs.createReadStream(filename),
}))

pcbStackup(layers).then(stackup => {
  console.log(stackup.top.svg) // logs "<svg ... </svg>"
  console.log(stackup.bottom.svg) // logs "<svg ... </svg>"
})

API

See the API documentation.

If your board doesn't appear at all or looks weirdly distorted, try rendering it with the options {maskWithOutline: false} or filling in gaps in the outline with e.g. {outlineGapFill: 0.011}.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.2.8 (2022-03-28)

Note: Version bump only for package pcb-stackup

4.2.7 (2022-03-12)

Note: Version bump only for package pcb-stackup

4.2.6 (2022-03-12)

Note: Version bump only for package pcb-stackup

4.2.5 (2020-12-18)

Note: Version bump only for package pcb-stackup

4.2.4 (2020-12-15)

Note: Version bump only for package pcb-stackup

4.2.2 (2020-10-13)

Note: Version bump only for package pcb-stackup

4.2.1 (2020-04-30)

Note: Version bump only for package pcb-stackup

4.2.0 (2019-10-10)

Bug Fixes

4.1.1 (2019-06-05)

Bug Fixes

4.1.0 (2019-05-01)

Bug Fixes

4.0.3 (2019-04-10)

Bug Fixes

  • deps: update dependency @types/node to ^11.13.0 (#193) (44f2d60)
  • deps: update dependency @types/node to ^11.13.2 (#217) (e981a4e)

4.0.2 (2019-03-24)

Bug Fixes

  • deps: update dependency @types/node to ^11.11.6 (#184) (c3bb301)
  • gerber-to-svg: Allow options parameter to be skipped (#181) (bbe5c07)

4.0.1 (2019-03-23)

Note: Version bump only for package pcb-stackup

4.0.0 (2019-03-09)

Note: Version bump only for package pcb-stackup

4.0.0-next.19 (2019-03-09)

Code Refactoring

  • pcb-stackup: Remove special handling of options.createElement (#110) (7d7fbeb), closes #43

Features

  • Add typescript definitions to all consumable modules (#103) (bb6e8f9)
  • Update dependencies and enable Greenkeeper (9db54cc)

Performance Improvements

  • Align and simplify parameters, defaults, and return values (#102) (c4e3a84), closes #99

BREAKING CHANGES

  • pcb-stackup: pcb-stackup no longer tries to help if you use options.createElement. You can still use it, but you'll have to manually align your gerber-to-svg options with pcb-stackup's options
  • Parameters, defaults, and return types have changed in pcb-stackup, pcb-stackup-core, and gerber-to-svg

4.0.0-next.18 (2019-01-26)

Note: Version bump only for package pcb-stackup

4.0.0-next.17 (2018-12-20)

Note: Version bump only for package pcb-stackup

4.0.0-next.15 (2018-11-13)

Features

  • whats-that-gerber: Use collection of filenames to determine type (#77) (6919549)

BREAKING CHANGES

  • whats-that-gerber: Output of whats-that-gerber changed from a single string to an object keyed by the filenames passed in as an array

4.0.0-next.14 (2018-10-13)

Note: Version bump only for package pcb-stackup

4.0.0-next.13 (2018-09-12)

Bug Fixes

4.0.0-next.12 (2018-07-17)

Bug Fixes

  • pcb-stackup: Do not mutate layer options and keep filename (6cbecde)

4.0.0-next.11 (2018-07-02)

Note: Version bump only for package pcb-stackup

4.0.0-next.10 (2018-06-27)

Note: Version bump only for package pcb-stackup

4.0.0-next.9 (2018-06-19)

Note: Version bump only for package pcb-stackup

4.0.0-next.8 (2018-06-16)

Note: Version bump only for package pcb-stackup

4.0.0-next.7 (2018-06-16)

Note: Version bump only for package pcb-stackup

4.0.0-next.6 (2018-06-15)

Note: Version bump only for package pcb-stackup

4.0.0-next.5 (2018-06-15)

Note: Version bump only for package pcb-stackup

4.0.0-next.4 (2018-04-27)

Features

  • fixtures: Move common render server into fixtures module (523f681)

4.0.0-next.3 (2018-04-18)

Features

  • tracespace: Add whats-that-gerber@3.0.0 to monorepo (5d755ed)

4.0.0-next.2 (2018-04-17)

Note: Version bump only for package pcb-stackup