Convert strings to gcode commands.
Project description
TextToGcode
A python library you can utilize to create custom gcode commands from a string. Intended to be used to engrave or draw text with cnc machines.
Installation
install with pip install TextToGcode
or download the file from the github if you want to use via the command line
Command Line Usage
navigate to the location of TextToGcode.py and run it with
python3 TextToGcode.py "TEXT" SIZE ROTATION MODE FEEDRATE "ON COMMAND" "OFF COMMAND" "FAST COMMAND" "SLOW COMMAND"
the important part is that all multi word arguments are surrounded with quotation marks as seen above
Library Usage
import into your project with from ttgLib.TextToGcode import ttg
Then you can call the ToGcode function with your arguments to output or return your gcode as a file or list:
ttg(TEXT, SIZE, ROTATION, MODE, FEEDRATE).toGcode("ON COMMAND", "OFF COMMAND", "FAST COMMAND", "SLOW COMMAND")
Explanation of arguments:
Text: a string for the text you want to be transformed to gcode, accepted characters are a-z, 0-9
Size: integer that represents the scale of the text in mm
Rotation: integer in degrees of the rotation of the text
Mode: a string specifying the mode of return.
- Return: returns a string of gcode commands
- File: generates an
output.gcode
file in the same directory - visualize: returns a raw list of tuples (if you want to plot them using matplotlib to visualize your path)
Feedrate: integer used to specify the feed rate for the gcode operations
On Off Fast Slow Commands: string commands for certain gcode operations. ex:
- ON: "M03 S500"
- OFF: "M05 S0"
- FAST: "G0"
- SLOW: "G1"
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
Built Distribution
Hashes for TextToGcode-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae3027bb25ef602a9e2db43692c3d6bd3be7bf9d592e43f4483a794c0d9abd6a |
|
MD5 | 92ca440fde2c54147fe691ad212c3ae3 |
|
BLAKE2b-256 | 47b3ddf4147a7fc69cc4c52a6beb9045df7997a8e73c7b5905f46ebaae98b600 |