Skip to content

gcode module

HippoProgrammer edited this page Jun 13, 2024 · 3 revisions

gcode

A low-level module letting you write gcode from python.

Parsing functions

These functions take Python functions to write gcode.

class gcode.Parser

An object representing one .gcode file.

class method .setup(rel_pos=True, mm=True, home=[0,20,0])

Setup Parser object by setting position mode according to rel_pos, setting measurement mode according to mm and setting home coordinates to home[x,y,z].

class method .add_movement(x=0, y=0, z=0, speed=200)

Add a movement command to the gcode file, to move x in the x axis, y in the y axis, and z in the z axis, at _speed_mm/second.

class method .add_home()

Add a movement command to the gcode file, to move to the specified home location.

class method .add_fan(speed=255)

Add a fan command to the gcode file, to turn the fan on at speed power (max 255).

class method .change_pos(rel_pos=True)

Add a mode command to the gcode file, to change the relative / absolute position mode.

class method .change_mm(mm=True)

Add a mode command to the gcode file, to change the mm / inches measurement mode.

class method .change_home(home=[0,20,0])

Change the set home to home[x,y,z].

class method .parse(target=‘’)

Save or output the gcode file to target.

If target is ’stdout’, parse will return the gcode.

If target is ’’, parse will save the gcode to output.gcode.

Otherwise, parse will save the gcode to target.

class method .clear()

Clear the list of saved commands.

Overview

Installation

Installation from source
Installation from binary

Usage

Coming soon

Modules

gcode
chess Coming soon

Clone this wiki locally