Skip to content

Latest commit

 

History

History
 
 

core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@tracespace/core

npm

Use Gerber/drill files to create an SVG render of a finished PCB in Node.js or the browser. Part of the tracespace collection of PCB visualization tools.

This library contains the main logic for tracespace's render pipeline, built up of the following lower-level libraries:

usage

import fs from 'node:fs/promises'
import {read, plot, renderLayers, renderBoard, stringifySvg} from '@tracespace/core'

const files = [
  'top-copper.gbr',
  'top-solder-mask.gbr',
  'top-silk-screen.gbr',
  'bottom-copper.gbr',
  'bottom-solder-mask.gbr',
  'outline.gbr',
  'drill.xnc',
]

const readResult = await read(files)
const plotResult = plot(readResult)
const renderLayersResult = renderLayers(plotResult)
const renderBoardResult = renderBoard(renderLayersResult)

await Promise.all([
  fs.writeFile('top.svg', stringifySvg(renderBoardResult.top))
  fs.writeFile('bottom.svg', stringifySvg(renderBoardResult.bottom))
])