Reference
All methods available on the fab object.
Setup
Structure
draw() A p5.js function that's repeatedly called while the sketch runs. fabDraw() A function called once to generate G-code commands. pop() Ends a command group that contains its own printing state. push() Begins a command group that contains its own printing state. setup() A p5.js function that's called once when the sketch begins running.
Motion
move() Move relative to the current position without extruding. moveTo() Move to an absolute XYZ position without extruding. moveToX() Move to an absolute X position without extruding. moveToY() Move to an absolute Y position without extruding. moveToZ() Move to an absolute Z position without extruding. moveX() Move a relative distance in X without extruding. moveY() Move a relative distance in Y without extruding. moveZ() Move a relative distance in Z without extruding. pickupTool() Select a tool by index (for multi-tool machines like Jubilee). retractTo() Move to an absolute XYZ position with filament retraction, and re-prime upon arrival. translate() Offset the coordinate origin for all subsequent moves by `(dx, dy, dz)`. travel() Travel a relative XYZ distance with filament retraction, z-hop, and re-prime. travelTo() Travel to an absolute XYZ position with filament retraction, z-hop, and re-prime. x() Current planned X position in mm. y() Current planned Y position in mm. z() Current planned Z position in mm.
Extrusion
circle() Extrude a circle with diameter `d` centered at (x, y) at the given Z height. extrude() Move a relative distance in XYZ while extruding filament. extrudeTo() Move to an absolute XYZ position while extruding. extrudeToX() Move to an absolute X position while extruding. extrudeToXY() Move to an absolute XY position while extruding. extrudeToY() Move to an absolute Y position while extruding. extrudeToZ() Move to an absolute Z position while extruding. extrudeX() Move a relative distance in X while extruding. extrudeXY() Move a relative distance in X and Y while extruding. extrudeY() Move a relative distance in Y while extruding. extrudeZ() Move a relative distance in Z while extruding. introLine() Print a priming line along the left edge of the bed to prepare the extruder. makeE() Calculate the extrusion amount needed to move to an absolute XYZ position. moveE() Move the extruder a relative distance in E.
Print control
autoHome() Home all axes and reset the extruder position. extrusionMultiplier() Set the extrusion multiplier applied to all subsequent auto-calculated extrusion amounts. fanOff() Turn the part cooling fan off. fanOn() Turn the part cooling fan on. pausePrint() Pause the print for a given duration, in seconds. presentPart() Move the hotend away from the part. printAcceleration() Set the acceleration used for print moves. printSpeed() Set the default feedrate for extrusion moves. retractAmount() Set the filament retraction distance to be used by all relevant commands (e.g., `travelTo()`, `travel()`, `retractTo()`). setBedTemp() Set the bed temperature and wait for it to be reached before continuing. setNozzleTemp() Set the nozzle temperature and wait for it to be reached before continuing. setTemps() Set both the nozzle and bed temperatures and wait for both to be reached before continuing. speed() Set both the print and travel speed defaults simultaneously. stopPrint() Stop the print and clear the command queue. travelAcceleration() Set the acceleration used for travel moves. travelSpeed() Set the default feedrate for moves without extrusion. zHopHeight() Set the z-hop height to be used by relevant commands (e.g., `travelTo()`, `travel()`).
Configuration
centerX() The X center of the build plate in mm (`maxX / 2`). centerY() The Y center of the build plate in mm (`maxY / 2`). filamentDiameter() The diameter of the filament being used in mm. maxAccelerationE() Set the maximum acceleration for the extruder axis. maxAccelerationX() Set the maximum acceleration for the X axis. maxAccelerationY() Set the maximum acceleration for the Y axis. maxAccelerationZ() Set the maximum acceleration for the Z axis. maxSpeedE() Set the maximum feedrate for the extruder axis. maxSpeedX() Set the maximum feedrate for the X axis. maxSpeedY() Set the maximum feedrate for the Y axis. maxSpeedZ() Set the maximum feedrate for the Z axis. maxX() The maximum X dimension of the printer in mm. maxY() The maximum Y dimension of the printer in mm. maxZ() The maximum Z dimension of the printer in mm. nozzleDiameter() The printer's nozzle diameter in mm. setMaxAcceleration() Set the maximum acceleration for each axis.
Utilities
addComment() Append a comment to the last command in the queue. commands() The GCode commands generated by the most recent `fabDraw()` call, as structured objects. gcode() All generated G-code as a single newline-separated string. isPrinting() Returns `true` if the printer is actively printing and `false` if not. render() Render a 3D preview of the planned toolpaths.