2.1.2 • Published 6 years ago

@stemn/whats-that-gerber v2.1.2

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

what's that gerber?

GitHub issues npm Travis David David devDependencies

Identify the probable PCB layer type of a Gerber or drill file by its filename.

usage

var whatsThatGerber = require('whats-that-gerber')

var filename = 'my-board-F_Cu.gbr'
var layerType = whatsThatGerber(filename)              // 'tcu'
var layerName = whatsThatGerber.getFullName(layerType) // 'top copper'

layer types and names

There are 12 available layer types. You can get an array of all types with:

var whatsThatGerber = require('whats-that-gerber')
var allLayerTypes = whatsThatGerber.getAllTypes() // ['drw', 'tcu', ...]
typefull name (en)
drwgerber drawing
tcutop copper
tsmtop soldermask
tsstop silkscreen
tsptop solderpaste
bcubottom copper
bsmbottom soldermask
bssbottom silkscreen
bspbottom solderpaste
icuinner copper
outboard outline
drldrill hits

checking if a layer type is valid

You can check if any given string is a valid layer type with:

var whatsThatGerber = require('whats-that-gerber')
var isValidType = whatsThatGerber.isValidType

var type1 = 'tsm'
var type2 = 'hello'

console.log(isValidType(type1)) // true
console.log(isValidType(type2)) // false

full name locales

The full name method takes a locale string as its second parameter, which defaults to 'en':

var fullName = whatsThatGerber.getFullName('tcu', 'en')

Currently, no other locales are supported (because I don't know any!); contributions are greatly appreciated. If the type or locale is unrecognized, the result will be an empty string. Locale additions will be considered patch-level upgrades.

supported cad programs

We should be able to identify files output by the following programs:

  • KiCad
  • Eagle
  • Altium
  • Orcad
  • gEDA PCB

contributing

  1. $ git clone tracespace/whats-that-gerber
  2. $ npm install
  3. $ npm test

If adding / modifying a filetype matcher, please remember to add / modify an example filename in test/filenames-by-cad.json.