Axidraw

class Axidraw(program: Program, val paperSizeInMm: Vector2, val drawBounds: Rectangle = program.drawer.bounds, fit: Vector2 = Vector2.ZERO)(source)

Class for working with Axidraw pen plotters. It communicates with the axicli command line program, which is installed automatically using Python. Provides an extensive GUI to configure the pen plotter, to save and load designs, preview them, layout designs using a Camera2D, plot, resume and more.

Parameters

fit

A Vector 2 specifying where inside drawBounds to draw the plot simulation. The default is Vector2.ZERO, which means centered. Use values between -1.0 and 1.0 for aligning to the left/top or to the right/bottom of drawBounds.

Constructors

Link copied to clipboard
constructor(program: Program, paperSizeInMm: Vector2, drawBounds: Rectangle = program.drawer.bounds, fit: Vector2 = Vector2.ZERO)

Properties

Link copied to clipboard
Link copied to clipboard

API URL to call once plotting is complete. If the string contains [filename] it will be replaced by the name of the file being plotted. This URL should be URL encoded (for instance, use %20 instead of a space).

Link copied to clipboard
Link copied to clipboard
val bounds: Rectangle

Returns the bounds of the drawable area so user code can draw things without leaving the paper.

Link copied to clipboard

An interactive camera you can use to position your design in the paper. Allows panning, scaling and rotating.

Link copied to clipboard
Link copied to clipboard
val drawBounds: Rectangle

A Rectangle specifying the window area where to draw the plot simulation. The default is drawer.bounds.

Link copied to clipboard
var margin: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the length of one millimeter in the drawing assuming the camera has not been zoomed in or out

Link copied to clipboard
Link copied to clipboard
val paperSizeInMm: Vector2

A Vector2 specifying the paper size in mm. For convenient a constant like PaperSize.A5.size can be used.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Becomes true when pressing the hardware pause button on the Axidraw, resets to false after a successful plot or by calling goHome or resume.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var svg: String

Read-only String variable to inspect the current design in SVG format for debugging purposes.

Link copied to clipboard

Functions

Link copied to clipboard

Pans the camera to center items found in the current design.

Link copied to clipboard
fun clear(): Unit?

Clears the current design wiping any shapes the user might have added.

Link copied to clipboard
fun display(drawer: Drawer)

Display the composition using drawer. Call this method from inside your extend {} block.

Link copied to clipboard

The core method that allows the user to append content to the design. Use any methods and properties available in CompositionDrawer, like contour(), segment(), fill, stroke, etc.

Link copied to clipboard

After hitting pause, use this to move the pen home

Link copied to clipboard
fun groupStrokeColors(): List<ColorRGBa>

Rebuilds the design putting shapes under groups based on stroke colors and inserts a pause after each group.

Link copied to clipboard
fun onLoad()

Show a file-selector dialog to load an SVG file, then loads the content of the selected SVG file.

Link copied to clipboard

Plot a design using the current settings

Link copied to clipboard
fun onSave()

Save current design as SVG

Link copied to clipboard

After hitting pause, use this to continue plotting

Link copied to clipboard
fun setupAxidrawCli(reinstall: Boolean = false)

This method is called automatically when instantiating org.openrndr.extra.axidraw.Axidraw to set up the axicli program. Call it with true as an argument to manually reinstall axicli.`

Link copied to clipboard
fun setupVirtualEnv(reinstall: Boolean = false)

This method is called automatically when instantiating org.openrndr.extra.axidraw.Axidraw to set up a Python virtual environment. Call it with true as an argument to manually reinstall the virtual environment.

Link copied to clipboard

Display Axidraw system info

Link copied to clipboard

Toggle the pen up/down state by powering the pen plotter servo. Useful for calibrating the pen height. Cover the paper with a plastic sheet before running this command to avoid accidentally leaving ink on the paper.

Link copied to clipboard

Display Axidraw software version