GithubHelp home page GithubHelp logo

neo4reo / pcb-stackup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tracespace/tracespace

0.0 2.0 0.0 819 KB

Generate beautiful and accurate SVG renders of printed circuit boards

License: MIT License

JavaScript 96.23% HTML 3.77%

pcb-stackup's Introduction

pcb stackup

npm Travis Coveralls David David

Sauce Test Status

Generate beautiful, precise SVG renders of printed circuit boards given a set of Gerber and drill files. Powered by gerber-to-svg and pcb-stackup-core.

Install with:

$ npm install --save pcb-stackup

example

arduino-uno-top

  1. $ git clone https://github.com/tracespace/pcb-stackup
  2. $ cd pcb-stackup && npm install
  3. $ npm run example

The example script builds a render of the Arduino Uno PCB. Arduino Uno design files copyright by Arduino and shared under the terms of a Creative Commons Attribution Share-Alike license (https://www.arduino.cc/en/Main/FAQ).

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.

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

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

var layers = fileNames.map(function (path) {
  return {gerber: fs.createReadStream(path), filename: path}
})

pcbStackup(layers, function (error, stackup) {
  if (error) {
    throw error
  }

  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}.

developing and contributing

Clone and then $ npm install. Please accompany all PRs with applicable tests. Please test your code in browsers, as Travis CI cannot run browser tests for PRs.

unit testing

This module uses Mocha and Chai for unit testing, Istanbul for coverage, and ESLint for linting.

  • $ npm test - run the tests, calculate coverage, and lint
  • $ npm run test:watch - run the tests on code changes (does not lint nor cover)
  • $ npm run lint - lint the code (will be run as a pre-commit script)

integration testing

The integration tests run the example code on a variety of gerber files to ensure proper interfacing with gerber-to-svg and proper rendering of different stackups.

  1. $ npm run test:integration
  2. Open http://localhost:8001 in a browser

browser testing

Browser tests are run with Zuul and Sauce Labs.

  • $ npm run test:browser - run the unit tests in a local browser
  • $ npm run test:sauce - run the units tests in several browsers using Open Sauce (Sauce Labs account and local .zuulrc required)

pcb-stackup's People

Contributors

kasbah avatar mcous avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.