Skip to content

Python Design API

Generated from py/python/dry/__init__.py using Python AST extraction.

Design

An L1 design: a chain of authoring ops. Builders return self for fluent use.

Method summary

MethodSignatureSampleSummary
geometrydef geometry(self, width: Number, height: Number) -> 'Design'Set the extrusion bead cross-section (mm).
extruderdef extruder(self, on: bool) -> 'Design'Turn the extruder on/off (off => subsequent moves are travels).
speeddef speed(self, print_speed: Number) -> 'Design'Set the print feedrate (mm/min).
pointdef point(self, x: Optional[Number] = None, y: Optional[Number] = None, z: Optional[Number] = None) -> 'Design'Move to a point; an omitted axis is inherited from the running position.
arcdef arc(self, cx: Number, cy: Number, x: Optional[Number] = None, y: Optional[Number] = None, z: Optional[Number] = None, clockwise: bool = False) -> 'Design'A circular arc about (cx, cy) to an end point; clockwise => G2, else G3.
splinedef spline(self, points: Sequence[Point]) -> 'Design'A Catmull-Rom spline from the running position through each (x, y, z) control point.
temperaturedef temperature(self, nozzle: Number) -> 'Design'Set the nozzle temperature channel (°C).
fandef fan(self, speed: Number) -> 'Design'Set the part-cooling fan channel (0..1).
flowdef flow(self, ratio: Number) -> 'Design'Set the flow multiplier channel (scales deposited volume; default 1.0).
tooldef tool(self, index: int) -> 'Design'Set the active tool channel.
orientdef orient(self, i: Number, j: Number, k: Number) -> 'Design'Set the toolframe orientation: the tool-direction vector (i, j, k).
dwelldef dwell(self, seconds: Number) -> 'Design'Pause in place for seconds (emits a G4 dwell).
manual_gcodedef manual_gcode(self, text: str) -> 'Design'Inject verbatim custom G-code.
depositdef deposit(self, volume: Number, speed: Number) -> 'Design'Stationary extrusion of a set volume (mm³) at feedrate (mm/min).
retractdef retract(self, distance: Optional[Number] = None, speed: Optional[Number] = None) -> 'Design'Retract filament.
unretractdef unretract(self, distance: Optional[Number] = None, speed: Optional[Number] = None) -> 'Design'Prime filament back after a retraction.
gcodedef gcode(self, printer: str = 'generic', relative_e: bool = True, travel_g1_e0: bool = False, five_axis: bool = False, rotary_axes: str = 'ab', kinematics: Optional[str] = None) -> List[str]Author a pathResolve + emit motion g-code (a list of lines).
simulatedef simulate(self, printer: str = 'generic') -> MetricsSimulateResolve + simulate; returns a metrics dict (time, distances, material, peak flow).
irdef ir(self, printer: str = 'generic') -> ToolpathLower to the Dry IRResolve to the L2 Dry IR; returns a dict ({version, segments}).
optimized_irdef optimized_ir(self, printer: str = 'generic') -> ToolpathOptimizeResolve + optimize; returns a dict ({version, segments}).
balanced_irdef balanced_ir(self, printer: str = 'generic', kinematics: Optional[Kinematics] = None) -> ToolpathOptimizeResolve + balanced (kinematics-aware) optimize; returns a dict ({version, segments}).
binarydef binary(self, printer: str = 'generic') -> bytesResolve + encode to binary DRY1 format; returns a bytes object.
verifydef verify(self, printer: str = 'generic', max_flow: Optional[Number] = None, min_temp: Optional[Number] = None, bounds: Optional[Bounds] = None, monotonic_z: bool = False, speed_range: Optional[Range] = None, max_retraction_distance: Optional[Number] = None, max_retraction_speed: Optional[Number] = None, max_travel_without_retract: Optional[Number] = None, first_layer_height_range: Optional[Range] = None, first_layer_speed_range: Optional[Range] = None, kinematics: Optional[Kinematics] = None) -> ReportVerifyResolve + verify against machine-safety contracts; returns a report dict with findings.

geometry

py
def geometry(self, width: Number, height: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
widthNumberYes
heightNumberYes

Returns: 'Design'

Set the extrusion bead cross-section (mm).

extruder

py
def extruder(self, on: bool) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
onboolYes

Returns: 'Design'

Turn the extruder on/off (off => subsequent moves are travels).

speed

py
def speed(self, print_speed: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
print_speedNumberYes

Returns: 'Design'

Set the print feedrate (mm/min).

point

py
def point(self, x: Optional[Number] = None, y: Optional[Number] = None, z: Optional[Number] = None) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
xOptional[Number]NoneNo
yOptional[Number]NoneNo
zOptional[Number]NoneNo

Returns: 'Design'

Move to a point; an omitted axis is inherited from the running position.

arc

py
def arc(self, cx: Number, cy: Number, x: Optional[Number] = None, y: Optional[Number] = None, z: Optional[Number] = None, clockwise: bool = False) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
cxNumberYes
cyNumberYes
xOptional[Number]NoneNo
yOptional[Number]NoneNo
zOptional[Number]NoneNo
clockwiseboolFalseNo

Returns: 'Design'

A circular arc about (cx, cy) to an end point; clockwise => G2, else G3.

spline

py
def spline(self, points: Sequence[Point]) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
pointsSequence[Point]Yes

Returns: 'Design'

A Catmull-Rom spline from the running position through each (x, y, z) control point.

temperature

py
def temperature(self, nozzle: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
nozzleNumberYes

Returns: 'Design'

Set the nozzle temperature channel (°C).

fan

py
def fan(self, speed: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
speedNumberYes

Returns: 'Design'

Set the part-cooling fan channel (0..1).

flow

py
def flow(self, ratio: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
ratioNumberYes

Returns: 'Design'

Set the flow multiplier channel (scales deposited volume; default 1.0).

tool

py
def tool(self, index: int) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
indexintYes

Returns: 'Design'

Set the active tool channel.

orient

py
def orient(self, i: Number, j: Number, k: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
iNumberYes
jNumberYes
kNumberYes

Returns: 'Design'

Set the toolframe orientation: the tool-direction vector (i, j, k). Identity is +Z.

dwell

py
def dwell(self, seconds: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
secondsNumberYes

Returns: 'Design'

Pause in place for seconds (emits a G4 dwell).

manual_gcode

py
def manual_gcode(self, text: str) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
textstrYes

Returns: 'Design'

Inject verbatim custom G-code.

deposit

py
def deposit(self, volume: Number, speed: Number) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
volumeNumberYes
speedNumberYes

Returns: 'Design'

Stationary extrusion of a set volume (mm³) at feedrate (mm/min).

retract

py
def retract(self, distance: Optional[Number] = None, speed: Optional[Number] = None) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
distanceOptional[Number]NoneNo
speedOptional[Number]NoneNo

Returns: 'Design'

Retract filament.

unretract

py
def unretract(self, distance: Optional[Number] = None, speed: Optional[Number] = None) -> 'Design'

Parameters

ParameterAnnotationDefaultRequired
distanceOptional[Number]NoneNo
speedOptional[Number]NoneNo

Returns: 'Design'

Prime filament back after a retraction.

gcode

py
def gcode(self, printer: str = 'generic', relative_e: bool = True, travel_g1_e0: bool = False, five_axis: bool = False, rotary_axes: str = 'ab', kinematics: Optional[str] = None) -> List[str]

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No
relative_eboolTrueNo
travel_g1_e0boolFalseNo
five_axisboolFalseNo
rotary_axesstr'ab'No
kinematicsOptional[str]NoneNo

Returns: List[str]

Resolve + emit motion g-code (a list of lines).

rotary_axes is the rotary-axes selector — the ab/ac/bc STRING choosing which two rotary axes carry the toolframe orientation in 5-axis emit (five_axis=True). NOTE: this is NOT the machine motion-limits object (see balanced_ir / verify's kinematics for that). kinematics is a deprecated alias for rotary_axes, kept for backward compatibility; when provided (not None) it takes precedence.

simulate

py
def simulate(self, printer: str = 'generic') -> Metrics

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No

Returns: Metrics

Resolve + simulate; returns a metrics dict (time, distances, material, peak flow).

ir

py
def ir(self, printer: str = 'generic') -> Toolpath

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No

Returns: Toolpath

Resolve to the L2 Dry IR; returns a dict ({version, segments}).

optimized_ir

py
def optimized_ir(self, printer: str = 'generic') -> Toolpath

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No

Returns: Toolpath

Resolve + optimize; returns a dict ({version, segments}).

balanced_ir

py
def balanced_ir(self, printer: str = 'generic', kinematics: Optional[Kinematics] = None) -> Toolpath

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No
kinematicsOptional[Kinematics]NoneNo

Returns: Toolpath

Resolve + balanced (kinematics-aware) optimize; returns a dict ({version, segments}).

kinematics is a dict with optional keys max_acceleration_mm_s2 (mm/s²) and max_junction_velocity_mm_s (mm/s). When supplied, the engine applies arc centripetal speed clamping and junction-velocity capping in addition to the standard optimizations (balanced_pipeline). When None (default), falls back to safe_pipeline.

binary

py
def binary(self, printer: str = 'generic') -> bytes

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No

Returns: bytes

Resolve + encode to binary DRY1 format; returns a bytes object.

verify

py
def verify(self, printer: str = 'generic', max_flow: Optional[Number] = None, min_temp: Optional[Number] = None, bounds: Optional[Bounds] = None, monotonic_z: bool = False, speed_range: Optional[Range] = None, max_retraction_distance: Optional[Number] = None, max_retraction_speed: Optional[Number] = None, max_travel_without_retract: Optional[Number] = None, first_layer_height_range: Optional[Range] = None, first_layer_speed_range: Optional[Range] = None, kinematics: Optional[Kinematics] = None) -> Report

Parameters

ParameterAnnotationDefaultRequired
printerstr'generic'No
max_flowOptional[Number]NoneNo
min_tempOptional[Number]NoneNo
boundsOptional[Bounds]NoneNo
monotonic_zboolFalseNo
speed_rangeOptional[Range]NoneNo
max_retraction_distanceOptional[Number]NoneNo
max_retraction_speedOptional[Number]NoneNo
max_travel_without_retractOptional[Number]NoneNo
first_layer_height_rangeOptional[Range]NoneNo
first_layer_speed_rangeOptional[Range]NoneNo
kinematicsOptional[Kinematics]NoneNo

Returns: Report

Resolve + verify against machine-safety contracts; returns a report dict with findings.

Structured limits cross to the engine as native typed contracts (no CSV round-trip):

  • bounds — build volume as [[x0, x1], [y0, y1], [z0, z1]] (mm). The legacy CSV string "x0,x1,y0,y1,z0,z1" is still accepted and parsed here for backward compatibility.
  • speed_range — extruding feedrate [min, max] (mm/min); the legacy "min,max" CSV string is still accepted.
  • max_flow (mm³/s), min_temp (°C), monotonic_z (bool).
  • max_retraction_distance (mm), max_retraction_speed (mm/min), max_travel_without_retract (mm) — retraction / stringing limits.
  • first_layer_height_range, first_layer_speed_range — first-layer adhesion limits, each [min, max] (or a "min,max" CSV string).
  • kinematics — dict with optional max_acceleration_mm_s2 (mm/s²) and/or max_junction_velocity_mm_s (mm/s). When supplied, enables the peak-acceleration and junction-velocity verify rules; None disables them.