pygerber package¶
Subpackages¶
- pygerber.parser package
- pygerber.renderer package
- pygerber.tokens package
- Submodules
- pygerber.tokens.add module
- pygerber.tokens.am module
- pygerber.tokens.comment module
- pygerber.tokens.control module
- pygerber.tokens.dispatcher_meta module
- pygerber.tokens.dnn module
- pygerber.tokens.fs module
- pygerber.tokens.gnn module
- pygerber.tokens.load module
- pygerber.tokens.token module
- Module contents
- pygerber.validators package
Submodules¶
pygerber.API2D module¶
- pygerber.API2D.render_file(file_path: str, *, dpi: int = 600, colors: pygerber.parser.pillow.parser.ColorSet = ColorSet(dark=(66, 166, 66, 255), clear=(16, 66, 36, 255), background=(0, 0, 0, 0)), ignore_deprecated: bool = True, image_padding: int = 0) PIL.Image.Image [source]¶
Loads, parses and renders file from given path and returns its render as PIL.Image.Image.
- Parameters
file_path (str) – Path to gerber file to render.
dpi (int, optional) – Output image DPI, defaults to 600
colors (ColorSet, optional) – Color specification, defaults to DEFAULT_COLOR_SET_GREEN
ignore_deprecated (bool, optional) – If false causes parser to stop when deprecated syntax is met, defaults to True
image_padding (int, optional) – Additional image padding, defaults to 0
- Returns
Output image.
- Return type
Image.Image
- pygerber.API2D.render_file_and_save(file_path: str, save_path: str, *, dpi: int = 600, colors: pygerber.parser.pillow.parser.ColorSet = ColorSet(dark=(66, 166, 66, 255), clear=(16, 66, 36, 255), background=(0, 0, 0, 0)), ignore_deprecated: bool = True, image_padding: int = 0)[source]¶
Loads, parses, renders file from file_path and saves it in save_path.
- Parameters
file_path (str) – Path to gerber file.
save_path (str) – Path to save render.
dpi (int, optional) – DPI of output image, defaults to 600
colors (ColorSet, optional) – Color set to use, defaults to DEFAULT_COLOR_SET_GREEN
ignore_deprecated (bool, optional) – If true, causes parser to not stop when deprecated syntax is found, defaults to True
image_padding (int, optional) – Additional pixel padding for image, defaults to 0
- pygerber.API2D.render_from_json(file_path: str) PIL.Image.Image [source]¶
Render 2D image from specfile written in json.
- Parameters
file_path (str) – json specfile path.
- Returns
rendered and merged image.
- Return type
Image.Image
- pygerber.API2D.render_from_spec(spec: Dict[str, Any]) PIL.Image.Image [source]¶
Render 2D image from specfile alike dictionary.
- Parameters
spec (Dict) – specfile parameters dictionary.
- Returns
rendered and merged image.
- Return type
Image.Image
pygerber.API3D module¶
pygerber.cli module¶
pygerber.constants module¶
pygerber.coparser module¶
pygerber.drawing_state module¶
- class pygerber.drawing_state.DrawingState[source]¶
Bases:
object
- coparser: pygerber.coparser.CoParser¶
- interpolation: pygerber.constants.Interpolation¶
- is_regionmode: bool¶
- mirroring: str¶
- polarity: str¶
- rotation: float¶
- scale: float¶
- unit: pygerber.constants.Unit¶
pygerber.exceptions module¶
pygerber.mathclasses module¶
- class pygerber.mathclasses.BoundingBox(x0: 'float', y0: 'float', x1: 'float', y1: 'float') 'None' [source]¶
Bases:
object
- contains(other: pygerber.mathclasses.BoundingBox) bool [source]¶
- include_point(point: pygerber.mathclasses.Vector2D) pygerber.mathclasses.BoundingBox [source]¶
- left: float¶
- lower: float¶
- padded(delta) pygerber.mathclasses.BoundingBox [source]¶
- right: float¶
- transform(vector: pygerber.mathclasses.Vector2D) pygerber.mathclasses.BoundingBox [source]¶
- upper: float¶
- class pygerber.mathclasses.Vector2D(x: 'float', y: 'float')[source]¶
Bases:
object
- dot(other: pygerber.mathclasses.Vector2D) float [source]¶
- x: float¶
- y: float¶
- pygerber.mathclasses.angle_from_zero(vector: pygerber.mathclasses.Vector2D) float [source]¶