包详细信息

gerber-to-svg

tracespace1.2kMIT4.2.8

Render individual Gerber / NC drill files as SVGs

svg, gerber, excellon, drill

自述文件

gerber to svg

latest next david

Render individual Gerber / NC drill files as SVGs

gerber-to-svg is a library and CLI tool for converting Gerber and NC drill files (manufacturing files for printed circuit boards) into SVG files for the web.

Part of the tracespace collection of PCB visualization tools.

install

npm install --save gerber-to-svg
# or
yarn add gerber-to-svg

Or, use a script tag:

<script src="https://unpkg.com/gerber-to-svg@^4.0.0/dist/gerber-to-svg.min.js"></script>
<script>
  // global variable gerberToSvg now available
  var converter = gerberToSvg(input)
</script>

example

After you clone and set-up the repository as detailed in development setup, you can run gerber-to-svg's example script to render all the layers of an Arduino Uno PCB.

cd tracespace/packages/gerber-to-svg
yarn example

arduino uno sol

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

usage

var gerberToSvg = require('gerber-to-svg')
var converter = gerberToSvg(input, options, [callback])

See the API documentation for full details.

command line

If you would like to use gerber-to-svg from the command line, check out @tracespace/cli

background

Since Gerber is a vector image format, this library takes in a Gerber file and spits it out in a different vector format: SVG. This converter uses RS-274X and strives to be true to the latest format specification.

Everywhere that is "dark" or "exposed" in the Gerber (think a copper trace or a line on the silkscreen) will be currentColor in the SVG. You can set this with the color CSS property or the color attribute in the SVG node itself.

Everywhere that is "clear" (anywhere that was never drawn on or was drawn on but cleared later) will be transparent. This is accomplished though judicious use of SVG masks and groups.

The bounding box is carefully calculated as the file is being converted, so the width and height of the resulting SVG should be nearly (if not exactly) the real world size of the Gerber image. The SVG's viewBox is in 1000x Gerber units, so its min-x and min-y values can be used to align SVGs generated from different board layers.

Excellon / NC drill files do not have a completely clearly defined spec, so drill file parsing is lenient in its attempt to generate an image. It should auto-detect when a drill file has been entered. You may need to override parsing settings (see API.md) to get drill files to render properly if they do not adhere to certain assumptions. The library must make these assumptions because Excellon does not define commands for certain formatting decisions.

更新日志

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 gerber-to-svg

4.2.7 (2022-03-12)

Note: Version bump only for package gerber-to-svg

4.2.6 (2022-03-12)

Note: Version bump only for package gerber-to-svg

4.2.5 (2020-12-18)

Note: Version bump only for package gerber-to-svg

4.2.4 (2020-12-15)

Note: Version bump only for package gerber-to-svg

4.2.2 (2020-10-13)

Note: Version bump only for package gerber-to-svg

4.2.1 (2020-04-30)

Bug Fixes

  • deps: update devDependencies, React, and yargs (#315) (34ebb3e)

4.2.0 (2019-10-10)

Bug Fixes

4.1.1 (2019-06-05)

Bug Fixes

  • deps: update dependency readable-stream to ^3.4.0 (#264) (1936088)
  • deps: update type definitions (#245) (d227db3)

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)
  • deps: update dependency readable-stream to ^3.3.0 (#199) (594e947)

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 gerber-to-svg

4.0.0 (2019-03-09)

Note: Version bump only for package gerber-to-svg

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

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

  • 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)

Bug Fixes

  • gerber-to-svg: Wrap children of <mask> nodes in a <g> (#100) (b984e32), closes #98

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

Note: Version bump only for package gerber-to-svg

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 gerber-to-svg

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

Bug Fixes

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

Code Refactoring

BREAKING CHANGES

  • gerber-to-svg: Removed gerber-to-svg (gerber2svg) CLI

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

Note: Version bump only for package gerber-to-svg

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

Note: Version bump only for package gerber-to-svg

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

Note: Version bump only for package gerber-to-svg

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

Bug Fixes

  • gerber-to-svg: Fix append-ext check using old short-option (cde8cda)

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

Features

  • gerber-to-svg: Replace non-functional CLI options (5633375)

BREAKING CHANGES

  • gerber-to-svg: Short option for --append-ext was changed from -a to -e, short option for --optimize-paths was changed to from -z to -t to match documentation and because -z was already used by --zero