Git Product home page Git Product logo

jspcb's Introduction

jspcb

Javascript library for parsing PCB file formats having rich metadata. Compatible with nodejs, jspcb can be used on the server or in the browser client in the context of automated pick-and-place (PnP). Supported PCB file formats:

  • Eagle BRD (XML)
  • Gerber files (Altium/Protel extension semantics)
  • Gerber files (generated by SparkFun sfe-gerb274x.cam for Eagle BRD)

See the wiki

Install

To install jspcb command line wrapper and dependencies:

npm install -g jspcb

NOTE: The above requires that your user be able to write to /usr/local.

Command line

Generate SVG file from Eagle BRD

Convert XML Eagle BRD file such as the AdaFruit PCB ruler into its SVG equivalent

jspcb --eagle eagle/ruler.brd --svg /tmp/ruler.svg

Generate CSV file with SMD pads

To generate a CSV file of the SMD pads:

jspcb --eagle eagle/ruler.brd --csv-smdpads /tmp/pads.csv

Generate PCB matching template

Generate a FireSight and/or OpenCV PNG matching template from Gerber files using a jspcb JSON configuration file:

jspcb --json json/gerber-template.json

Node.js usage

Local scripts

The jspcb command line is just a wrapper around PcbTransform, which does the actual transformation. You can call PcbTransform directly with custom options. Here is a local script to print out the bounding rectangle of a PCB:

const jspcb = require("jspcb");
var options = {
    eagle: { path: "eagle/ruler.brd", },
};
var pcbTrans = new jspcb.PcbTransform(options);
console.log(pcbTrans.viewBounds());

The script does the same thing as:

jspcb --eagle eagle/ruler.brd --show-bounds

NOTE: The above script won't work in the Github jspcb folder itself unless you set your environment NODE_PATH property to the global or local node_modules that has your jspcb installation. E.g.:

export NODE_PATH=node_modules

Web server

Do not use jspcb as a library from within a Node.js web applications. Node.js is single threaded, and you will block your entire web application when reading in PCB files. Instead, spawn a child process to perform your transformation. Spawning a child process will allow Node.js to run unencumbered--your web application will look for and consume the asynchronously generated JSON file(s) as they appear.

jspcb's People

Contributors

firepick1 avatar

Watchers

James Cloos 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.