Skip to main content

G-code generation algorithms for GRBL diode lasers from different sources; raster Line-to-Line (LaserGRBL-faithful) available today

Project description

PyGrbl_Build 0.0.1

PyPI

A collection of algorithms to generate G-code for GRBL diode lasers from different sources. Two algorithms today:

  • Line-to-Line (l2l_gcode) — raster engraving from an image, with LaserGRBL fidelity.
  • SVG vector (svg_gcode) — vector tracing from an SVG (paths, basic shapes, groups, transforms), a faithful port of LaserGRBL's SVG import. Pure Python, no extra dependency.

Part of the pygrbl family, a set of libraries to manage GRBL. Companion to pygrbl_streamer

Speed

This is the whole point. A full 300 mm @ 10 lines/mm raster job — nearly 4.7 million lines of G-code — comes out in ~0.34 s. LaserGRBL can take around 2 minutes to produce the same job: that's roughly a 350× speedup, and byte-for-byte the same output.

Install

pip install pygrbl_build

The only requirements are Pillow and a C compiler. Pillow is the single Python dependency (image loading and resizing); the C compiler is needed at install time because the raster engine ships as a C extension. Nothing else — no numpy, no runtime toolchain.

Usage

Each algorithm pairs a *_gcode generator with its own *Profile config, so adding one never touches the others.

Raster Line-to-Line (l2l_gcode + L2LProfile):

from pygrbl_build import L2LProfile, l2l_gcode, write_gcode

profile = L2LProfile(width_mm=300.0, lines_per_mm=10.0, feed=3000, s_max=100)
write_gcode(l2l_gcode("shield.png", profile), "shield.nc")

SVG vector (svg_gcode + SvgProfile):

from pygrbl_build import SvgProfile, svg_gcode, write_gcode

profile = SvgProfile(feed=1000, s_max=255)
write_gcode(svg_gcode("logo.svg", profile), "logo.nc")

SvgProfile's defaults reproduce LaserGRBL's own SVG-import defaults, so the output matches the desktop app for the same drawing. text and image elements are skipped — convert text to paths in your editor first.

write_gcode writes the path verbatim, so you choose the extension (.nc, .gcode, .g, ...). It's just a convenience: every *_gcode generator is a lazy iterator of lines, so anything beyond writing a plain file (compression, network shipping, streaming to the machine) is the upper layer's job — consume the iterator with whatever sink you need.

Public API: L2LProfile, l2l_gcode, SvgProfile, svg_gcode, write_gcode. See the docstrings.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygrbl_build-0.0.1.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygrbl_build-0.0.1-cp313-cp313-win_amd64.whl (32.8 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file pygrbl_build-0.0.1.tar.gz.

File metadata

  • Download URL: pygrbl_build-0.0.1.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pygrbl_build-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3343638299e96139c1897ea8435f3cc3f76a14e06f9c330ddfbaf95de1204060
MD5 1250ea3377993c1357fef04d42d57199
BLAKE2b-256 7aa95af1e28f0d3c9dc5339d399f374bc5e83c2afb6a1cdbf3a6c48026d062d4

See more details on using hashes here.

File details

Details for the file pygrbl_build-0.0.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pygrbl_build-0.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4b134eb5d6bd311e05035065cc0f57919d207271afbe420915637d59391b1f50
MD5 16800fd93dc1a6292c8ea785608f2da7
BLAKE2b-256 40a569cf6260dfbefeb630f9094f545c3fc4719076068c06e08e18ba89eb6483

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page