A simple REPL console for AxiDraw plotters.
I've found that running AxiDraw commands from the command line is slow and (to me) awkward because of the way modes and commands are structured.
So I wrote this wrapper using the Python API, which gives a simple command-line interface to an AxiDraw plotter.
A typical session might look like this:
$ interaxi.py
config file '/home/chris/.config/interaxi/axidraw_conf.py' loaded
new options: {'accel': 75, 'auto_rotate': True, 'const_speed': False, 'copies': 1, 'digest': 0, 'dist': 1.0, 'hiding': False, 'ids': [], 'layer': None, 'manual_cmd': enable_xy, 'margin': 0.4, 'min_gap': 0.35 mm, 'mode': manual, 'model': 2, 'no_rotate': False, 'page_delay': 15, 'paper': A4L, 'pen_delay_down': 0, 'pen_delay_up': 0, 'pen_pos_down': 30, 'pen_pos_up': 60, 'pen_rate_lower': 50, 'pen_rate_raise': 75, 'penlift': 1, 'port': None, 'port_config': 0, 'preview': False, 'random_start': False, 'rendering': 3, 'reordering': 2, 'report_lifts': True, 'report_time': True, 'resolution': 1, 'resume_type': plot, 'selected_nodes': [], 'setup_type': align, 'speed_pendown': 25, 'speed_penup': 75, 'submode': none, 'units': mm, 'webhook': False, 'webhook_url': None, }
Head can now be moved manually.
Is the head at the origin (0,0)? y/n: y
> reorder 2
reordering 2
> model 2
model 2
Plot size is 430.02 by 296.93 mm
> plot circ.svg
plotting file 'circ.svg'
Plot paused by button press.
(Paused after: 49.055 mm of pen-down travel.)
Use the resume feature to continue.
Elapsed time: 1.811 Seconds
Length of path drawn: 0.05 m
Total distance moved: 0.10 m
Number of pen lifts: 1
Type 'r' to resume or 'c' to cancel: r
resuming file '/tmp/tmplf93tfpt.svg' layer None
Elapsed time: 3.711 Seconds
Length of path drawn: 0.19 m
Total distance moved: 0.24 m
Number of pen lifts: 1
> q
done
$
Run interaxi.py
or python interaxi.py
, and then
follow the prompts and enter commands to control the plotter.
By default, interaxi.py reads its initial configuration from <homedir>/.config/interaxi/axidraw_conf.py
.
An alternative configuration file can be given on the command line, e.g.
interaxi.py special_conf.py
Configurations can also be loaded from within interaxi using the config
or options
commands.
Some commands have synonyms to be consistent with the original axicli commands. For example x
and walk_x
do the same thing.
All commands are changed to lower case before processing (except for file names).
Yes/No options turn a setting on or off. They can be specified with any of 'yes'/'no', 'true'/'false', 'on'/'off', or '1','0' (or abbreviations of those words).
Set the acceleration to a value from 1 to 100.
Run the align command, which disengages the plotter's motors and allows the head to be manually moved -- usually to the origin.
interaxi
asks if you have moved the head to the origin, so that it can then keep track of movements and prevent the
head from moving out of range.
Turn auto-rotate on or off. If on, the plot may be rotated to make sure that it fits on the plotting area.
Change the current directory to the one specified. On its own, cd
displays the name of the current working directory.
Turn constant speed plotting on or off.
Specify the number of copies to plot.
Move the pen down and then up.
Set the delay in milliseconds between the pen being lowered, and movement starting.
Set the delay in seconds between copies.
Set the delay in milliseconds between movement stopping and the pen being raised.
Move the pen down.
Display the firmware version.
Display a brief reminder of the available commands.
Turn the AxiDraw's hidden line removal feature on or off.
Move the pen to the current home position (as defined by the last time the motors were enabled,
either with on
, align
, or sethome
.
List the plottable (.svg) files in the current directory.
Set the AxiDraw model number: 1 AxiDraw V2, V3, or SE/A4 2 AxiDraw V3/A3 or SE/A3 3 AxiDraw V3 XLX 4 AxiDraw MiniKit 5 AxiDraw SE/A1 6 AxiDraw SE/A2 7 AxiDraw V3/B6
Turn the x/y stepper motors off.
Turn the x/y stepper motors on.
Load the options (aka configuration) from the AxiDraw configuration file specified. If no filename is given, display the current options.
The plot (or preview) command will create an output file if you specify a file name. none - do not create an output file auto - generate the output file name automatically (currently by adding '.svg' to the input file name). - use the given file name. WARNING: If the specified file already exists, it will be overwritten.
Run the plot from the given filename. If a layer number (1-1000) is given, plot only that layer.
Don't put quotation marks "
or '
around the file name, even if it contains spaces.
Examples: plot file1.svg
plot file1.svg 3
file with spaces.svg
file layer two.svg 2
Set the down position of the pen (as a percentage of the total travel of the servo).
Display the current head position (if known).
Set the up position of the pen (as a percentage of the total travel of the servo).
Run the plot in preview mode -- the pen will not move, but the estimated time will be reported. This will also create an output file if you have set an output file name.
Leave interaxi
. The current configuration will not be saved automatically.
Turn the random start feature on or off.
Set the speed that the pen moves down as a percentage of the maximum.
Set the speed that the pen moves up as a percentage of the maximum.
Start pen registration -- see below.
When previewing with an output filename set, a preview of what would have been plotted can be created. 0 - Do not render previews 1 - Render pen-down movement only 2 - Render pen-up movement only 3 - Render all movement, both pen-up and pen-down [DEFAULT] The render option changes the content of the output SVG file, so it has no effect unless an output file name has been specified.
0 - Least; Only connect adjoining paths. [DEFAULT]
1 - Basic; Also reorder paths for speed
2 - Full; Also allow path reversal
3 - [Deprecated; currently gives same behavior as 2.]
4 - None; Strictly preserve file order
Turn plot reporting on or off.
Save the current configuration (aka options) to the specified file. If no file name is given,
use the default name (~/.config/interaxi/axidraw_config.py
).
Set the plotting speed when the pen is down, as a percentage of the maximum.
Set the plotting speed when the pen is up, as a percentage of the maximum.
Display system information.
Toggle the pen up or down.
Set the units for future commands to either millimetres or inches.
Move the pen up.
Display the Python API software version.
See home
.
Move (in the current units) horizontally, relative to the current position. Positive values move to the right, negative ones to the left. WARNING re limits.
Move (in the current units) vertically, relative to the current position. Positive values move down, negative ones up. WARNING re limits.
The register
command starts interactive control of the pen position. Use the arrow keys to move the head by small amounts
to help with registering layers (i.e. plots with different pens) onto each other.
While registering, use these keys:
<up arrow> - move the pen in the negative Y direction
<down arrow> - move the pen in the positive Y direction
<left arrow> - move the pen in the negative X direction
<right arrow> - move the pen in the positive X direction
u - raise the pen
d - lower the pen
f - fine movements (0.1mm or 0.005in)
m - fine movements (1mm or 0.05in)
c - fine movements (10mm or 0.5in)
r - return to the home position
q - quit -- complete the registration
- Python 3.5 or later
- It needs a better name.
- The documentation is incomplete.
- Lots of others, probably.