Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
gerber-to-svg
Advanced tools
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.
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>
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
npm run example
Arduino Uno design files used here under the terms of the Creative Commons Attribution Share-Alike license.
var gerberToSvg = require('gerber-to-svg')
var converter = gerberToSvg(input, options, [callback])
See the API documentation for full details.
If you would like to use gerber-to-svg
from the command line, check out @tracespace/cli
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.
FAQs
Render individual Gerber / NC drill files as SVGs
The npm package gerber-to-svg receives a total of 709 weekly downloads. As such, gerber-to-svg popularity was classified as not popular.
We found that gerber-to-svg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.