Skip to content

Latest commit

 

History

History
167 lines (160 loc) · 6.24 KB

README.md

File metadata and controls

167 lines (160 loc) · 6.24 KB

Gerber Renderer

Python library for rendering RS274X gerber PCB files as svgs or pdfs.

Table of contents

Installation

The easiest way to install pandas is to install it via pip from PyPI.

Officially Python 3.6 and above.

Installing from PyPI

pip install gerber-renderer

Dependencies

Package

Minimum supported version

svgwrite

1.4

svglib

1.0

reportlab

3.5

Usage

Gerber Renderer is a Python library for rendering RS274X gerber PCB files as svgs or pdfs.

Importing

from gerber_renderer import Gerber

Functions

Initialize

board = Gerber.Board(file=file_path, max_height=XXX, verbose=True)

file: string representing the relative path to the root folder containing the gerber files
max_height: integer representing the maximum height (in pixels) of the rendered svg (default=500px)
verbose: outputs info about the current progress to the terminal (default=False)

Render SVG

board.render(output=output_path)

output: string representing the relative path to the root folder to save the svg files to

Render PDF

board.render_pdf(output=output_path, layer='top_copper', color='white', scale_compensation=0.0, full_page=True, mirrored=True, offset=(0, 0))

output: string representing the relative path to the root folder to save the svg files to
layer: string representing the layer to be rendered on the pdf (default='top_copper') [options: copper, mask, silk]
color: string representing the color of the PDF (default='white') [white renders negative of layer for exposing]
scale_compensation: float representing the percent change in size [+0.05 = 5% bigger] (default=0.0) [needed for some printers]
full_page: boolean, when True a full A4 sized PDF is rendered (default=False)
mirrored: boolean, when True the output PDF will be mirrored (default=False)
offset: tuple of floats (X,Y). The rendered PDF will be offset by (X,Y) pixels (default=(0,0))

Examples

Render SVG

from gerber_renderer import Gerber

board = Gerber.Board('./tests/gerber.zip', verbose=True)
board.render('./tests/output')

Output

Render PDF

from gerber_renderer import Gerber

board = Gerber.Board('./tests/gerber.zip', verbose=True)
board.render_pdf('./tests/output', 'top_copper', 'white', full_page=True)

Output

Result