Skip to content
Hackable Laser software for the K40 Stock-LIHUIYU laser boards.
Python
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
locale Locale messages update. Feb 21, 2020
test
.gitignore
.travis.yml Update .travis.yml Dec 22, 2019
About.py Documentation Tweaks Feb 6, 2020
Adjustments.py Final Checks Against Machine Feb 18, 2020
Alignment.py Device split from Backend Feb 2, 2020
BufferView.py 0.5.0 Feb 7, 2020
CH341DriverBase.py Paramode checks. Mar 5, 2020
CH341LibusbDriver.py ParaInit fail, raises ConnectionRefused Mar 5, 2020
CH341WindllDriver.py Paramode checks. Mar 5, 2020
CameraInteface.py Frame capture webcam error moved. Mar 11, 2020
ColorDefine.py Fixed some more backend stuff, gui as module. Feb 1, 2020
Controller.py <3.6, compatibility, -fstring Feb 15, 2020
DefaultModules.py Small grbl crash bug. Mar 9, 2020
DeviceManager.py Settings, and per device Properties Feb 2, 2020
EgvParser.py Dxf less crashy Feb 28, 2020
EngraveProperty.py JobsDialog Properties Feb 21, 2020
ImageProperty.py +PathProperty Feb 19, 2020
JobInfo.py Webcam snapshot, fisheye D and K but no entry Feb 29, 2020
JobSpooler.py Locale messages update. Feb 21, 2020
K40Controller.py Final Checks Against Machine Feb 18, 2020
Kernel.py Cursory GRBL Emulator. Feb 26, 2020
Keymap.py 0.5.0 Feb 7, 2020
LICENSE Initial commit Jul 20, 2019
LaserCommandConstants.py TransformEditor, +swap_xy Feb 25, 2020
LaserOperation.py Implemented @ command. Feb 24, 2020
LaserRender.py GC mostly finished. Mar 3, 2020
LaserServer.py Help with debugging. Feb 26, 2020
LaserSpeed.py Couple tweaks to LaserSpeed Mar 9, 2020
LhymicroInterpreter.py Couple tweaks to LaserSpeed Mar 9, 2020
MeerK40t.py Correct Modification for Make Raster Mar 6, 2020
Navigation.py Convex Hull, Simple Traces. Mar 3, 2020
OperationPreprocessor.py Correct Modification for Make Raster Mar 6, 2020
PathProperty.py +TextProperty Feb 21, 2020
Preferences.py TransformEditor, +swap_xy Feb 25, 2020
README.md Update README.md Mar 3, 2020
RasterPlotter.py Right-Left rastering. Feb 19, 2020
RasterProperty.py JobsDialog Properties Feb 21, 2020
RotarySettings.py
Settings.py
Shutdown.py Final Checks Against Machine Feb 18, 2020
TextProperty.py TransformEditor, +swap_xy Feb 25, 2020
UsbConnect.py Actualize Correction, Tree key, Config Feb 16, 2020
ZMatrix.py Svg Parse with Transforms. Sep 20, 2019
__init__.py Fixed svg.path bugs with tests. Oct 1, 2019
icons.py TransformEditor, +swap_xy Feb 25, 2020
install_run.bat Final Fixes Dec 26, 2019
requirements.txt Directly including svgelements Dec 27, 2019
svgelements.py Dxf corrections. Mar 7, 2020
wxMeerK40t.py Mass Elements Select Mar 11, 2020

README.md

MeerK40t

Laser software for the Stock-LIHUIYU laserboard.

MeerK40t (pronounced MeerKat) is a built-from-the-ground-up MIT licensed open-source laser cutting software. It's a replacement for LaserDrw, Corel Laser, and K40 Whisperer. With the dual driver support it can run aside any of these programs. It's written in python and has precompiled versions for Windows, Mac OSX, and Raspberry Pi. Available: https://github.com/meerk40t/meerk40t/releases

  • Dual drivers, use either the Whisperer method or LaserDrw method.
  • Grid/Guides, Zoom and Pan scene Navigation (use middle mouse button, mouse wheel).
  • PPI Power modulation (Yes, power modulation for the M2 Nano)
  • Multi-K40 support.
  • Drag-and-Drop support for SVGs/Images.
  • On-the-fly job Processing
  • Multi-language support.
  • Modular/Hackable Add-On and Kernel API.
  • Pixel perfect curve cutting.
  • Command Line Interface

Installing

Easy Windows

Download MeerK40t.exe https://github.com/meerk40t/meerk40t/releases

Run: MeerK40t.exe

MeerK40t is compiled as a portable application. It doesn't need to install or do anything.

Run Batch File to Python.

Download the source and run MeerK40t.py with python.

  • Download click: "Clone or Download".
  • Click "Download Zip"
  • Unzip on your desktop, this should be the meerk40t-master directory.
  • Find install_run.bat in the meerk40t-master directory and run it.

The batch file checks and installs requirements and runs MeerK40t.py

pip install -r requirements.txt
python MeerK40t.py
pause

The batch file avoids the command prompt.

Command Prompt Fallback

You need to use python and the requirements of wxPython pyusb and Pillow to run MeerK40t.py.

Windows Instructions:

You will need python:

You will need Meerk40t:

  • Download click: "Clone or Download".
  • Click "Download Zip"
  • Unzip on your desktop, this should be the meerk40t-master directory.
  • Press Windows + R (to load run).
  • Type "cmd"
    • This should be a dos prompt at C:\Users\(Name)> location.
  • Type "cd Desktop"
  • Type "cd meerk40t-master
  • Type "python MeerK40t.py"
    • At this point it could fail in a couple ways. It could lack: wxPython. pyusb. Pillow. See Troubleshooting:

Troubleshooting Install

Windows:

  • ModuleNotFoundError: No module named 'wx' means you need wxPython.
    • Type: pip install wxPython
  • ModuleNotFoundError: No module named 'usb' means you need pyusb.
    • Type: pip install pyusb
  • ModuleNotFoundError: No module named 'PIL' means you need Pillow.
    • Type: pip install Pillow

Linux:

  • ImportError: libpng12.so.0: cannot open shared object file: No such file or directory . libpng is not installed.
    • Type: sudo apt-get install libpng

GUI

The wxMeerK40t is the GUI and is written in wxPython. It's pretty easy to hack on and quite easy to improve. Linux and OSX need transformations to run the scene effectively and that requires wxPython 4.1+. ( https://wxpython.org/Phoenix/snapshot-builds/ )

Features

Pulse Modulation

The stock controller is not known for having power control, MeerK40t gives it power control. How is this possible? I use software to pulse the laser. See the Wiki for additional details: https://github.com/meerk40t/meerk40t/wiki/How-does-MeerK40t's-pulse-modulation-works%3F

This does not mean you should overpower your laser with the knob? NO. Leave that knob alone.

Most power modulation is done through hardware because most boards have the ability to process things and execute stuff. The Lhystudios (M2 Nano, etc) boards are different in that they are incredibly dumb. They execute very basic command directly on a micro-controller and do no planning or work directly on the device. This leaves everything to the software running the laser to constantly feed it new set of commands.

Driver

The MeerK40t driver interface uses either the LibUsb driver or the CH341DLL default windows driver.

Backend

The backend in MeerK40t is highly modular. Lending towards permitting replacing the backend or replacing a part of the backend.

There are three main parts for any backend system within MeerK40t, these are the Spooler, the Interpreter, and the Pipe.

Spooler

Jobs are spooled like a printer spooler, so that jobs are performed in sequence. You can add additional jobs to a spooler while it's still running the first job.

Interpreter

The main interpreter is the LhymicroInterpreter which converts LaserCommands into low level Lhymicro-GL code Any Interpreter is tasked with converting such commands usable sets of bytes.

Pipe

The system is agnostic with regard to where the data is going and should end up. Which the K40Controller is most used and default pipe. It doesn't have to be, and what to do with the code when we have it, is not a question with just one answer.

Geometry

SVG Paths.

The SVG library is a separate project based in svgelements which can be retrieved pip install svgelements. It is, in part, derived from code I wrote for mathandy/svgpathtools, which is a tools expansions of regebro/svg.path library. It's one of the most expansive and full implementations of SVG in python.

Curve Plotting

The LIHUIYU series of boards are connected to two stepper motors, these can step one step in either direction, or trigger both at the same time. So everything in the K40 are made of positions at 1000dpi. Every movement is a step either orthogonality or diagonally, this means there are no actual curves only a series of very tiny steps in 1 of 8 possible directions. This is where the Zingl Plotter comes in. The Beauty of Bresenham's Algorithm ( http://members.chello.at/easyfilter/bresenham.html ) author, Zingl came up with a series of algorithms based on Bresenham's insights, which natively allows these curve plotting operations to be performed directly with the native shapes themselves. This means that there is no need to deal with more primitive or subdivided elements. If we have a large curve or small curve it will always have perfect precision because we can natively use the curves themselves.

MeerK40t will draw pixel perfect curves (except for Arc which could be off). Which means if your design contains a Cubic Bezier curve, the program will draw it flawlessly.

These are never subdivided into good-enough small line segments, and the curves are executed on the fly. And since no linearization is needed, the project internally stores everything as the curves they are, giving you access to high-level manipulations, and low-level extremely fast plotting.

Parsers

The ability to drag and drop and display and modify job elements is critical to any good laser cutting application. Currently MeerK40t uses Pillow to load images. svgelements to load the SVG files. There an EgvParser from K40Tools to load EGV files. These loaders are registered in the kernel api and can be augmented with other formats quite easily. Requests for dealing with additional file formats can be easily addressed and integrated.

Rasterization

The project includes a RasterBuilder. It uses a highly debuggable methodology to build rasters. This gives MeerK40t the ability to overscan, perform bottom-to-top rasters, start from any corner, skip blank edge pixels, skip blank edge lines and makes the entire process extremely easy to troubleshoot or extend.

See notes on Rastering (https://github.com/meerk40t/meerk40t/wiki/Notes-on-Rastering) in the wiki.

Lhymicro-GL Interpreter

The Lhymicro-GL interpreter writes Lhymicro-GL code to be used in the stock firmware. This is done with the LhymicroInterpreter. It uses middle-level to low level on the fly writer, which tracks the local state of the device.

We can also adapt for edge conditions and alterations on the fly without any trouble. The interpreter tracks its current state and can perform the needed actions for state changes behind the scenes.

LaserCommands

The core language internally used in MeerK40t is a backend-agnostic coding, which conveys spoolable commands. If you wish to write an add-on for MeerK40t that sends commands to the laser, or a backend for a different laser device, you will want to use these.

See notes on LaserCommands: https://github.com/meerk40t/meerk40t/wiki/LaserCommands

You can’t perform that action at this time.