Skip to main content

raygeo.ops.convert

EncodeOutput​

Non-Ops artifact produced by an Encode stage.

height_px​

height_px: Optional[int]

Texture height in pixels. Returns None unless this is the Texture variant.

machine_code_to_op​

machine_code_to_op: Optional[bytearray]

Mapping machine-code line index -> op_index (-1 = no op). Returns None unless this is the MachineCode variant.

Returned as a bytearray of i32 values (4 bytes per line) to avoid the per-element Python int overhead of a list. Decode with np.frombuffer(ba, dtype=np.int32).

op_to_machine_code​

op_to_machine_code: Optional[bytearray]

Mapping op_index -> (start_line, line_count) span. Returns None unless this is the MachineCode variant.

Returned as a bytearray of interleaved i32 pairs (start, count) (8 bytes per op) to avoid the per-element Python tuple/int overhead of a list-of-tuples. Decode with np.frombuffer(ba, dtype=np.int32).reshape(-1, 2).

payload​

payload: Optional[bytearray]

The device byte stream for binary machine languages (empty for text-only languages such as G-code). Returns None unless this is the MachineCode variant.

power_texture​

power_texture: Optional[list[int]]

Raw texture bytes (row-major uint8 power map). Returns None unless this is the Texture variant.

repr​

repr: Optional[str]

The vertex-array or scene debug repr. Returns None unless this is the VertexArrays or Scene variant.

text​

text: Optional[str]

The G-code text. Returns None unless this is the MachineCode variant.

variant​

variant: str

The variant's name: "MachineCode", "VertexArrays", or "Texture".

width_px​

width_px: Optional[int]

Texture width in pixels. Returns None unless this is the Texture variant.

MachineCode()​

@classmethod
MachineCode(
text: str,
op_to_machine_code: Any,
machine_code_to_op: Any,
payload: Optional[Any] = None,
) -> EncodeOutput
ParameterTypeDescription
textstr
op_to_machine_codeAny
machine_code_to_opAny
payloadOptional[Any] = None
ReturnsEncodeOutput

Encoder​

Python-visible wrapper around an encoder spec.

Construct as Encoder(spec) where spec is an encoder spec: one of the classes under raygeo.ops.convert (e.g. ~raygeo.ops.convert.VertexSpec), a machine-code spec (GcodeSpec, EpilogSpec, RuidaSpec). Callers that drive the Encoder trait hold an Encoder instance.

spec​

spec: Any

The wrapped Python-side spec object. Type-erased here; dispatched to a concrete Box<dyn Encoder> by [PyEncoder::into_core].

EpilogSpec​

Parameters for the Epilog print-job encoder.

context_json is a JSON-serialised EpilogContext: model family, job title, resolution, frequency, autofocus, bed size, speed reference, origin layout and the rotary flag.

context_json​

context_json: str

GcodeDialectSpec​

Typed Python wrapper around the Rust GcodeDialectSpec.

Constructed in Python with keyword arguments; the inner Rust struct is passed directly to the encoder without a serde round-trip.

GcodeSpec​

Parameters for the G-code encoder.

context_json​

context_json: str

dialect​

dialect: GcodeDialectSpec

GlueScript​

The Ruida job authoring and compilation model.

Call the authoring methods to build a job, then stage_gluescript() compiles it into rpascript. stage_gluescript(lines) also replays a persisted transcript.

gluescript​

gluescript: list[str]

The canonical transcript lines.

job_complete​

job_complete: bool

Whether end_job() finalized the job.

rpascript​

rpascript: list[str]

The compiled rpascript lines.

air_assist_off()​

air_assist_off() -> None

Disable air assist.

ParameterTypeDescription
ReturnsNone

air_assist_on()​

air_assist_on() -> None

Enable air assist.

ParameterTypeDescription
ReturnsNone

comment()​

comment(comments: Sequence[str]) -> None

Append comment lines to the job header.

ParameterTypeDescription
commentsSequence[str]
ReturnsNone

cut_speed()​

cut_speed(speed: float) -> None

Save the cut speed for the next cut.

ParameterTypeDescription
speedfloat
ReturnsNone

cut_x_to()​

cut_x_to(x: float) -> None

Cut to an absolute X position.

ParameterTypeDescription
xfloat
ReturnsNone

cut_xy_to()​

cut_xy_to(x: float, y: float) -> None

Cut to an absolute XY position.

ParameterTypeDescription
xfloat
yfloat
ReturnsNone

cut_y_to()​

cut_y_to(y: float) -> None

Cut to an absolute Y position.

ParameterTypeDescription
yfloat
ReturnsNone

declare_job()​

declare_job(
label: str,
ref_point: str = 'MACHINE',
abs_xy: Optional[Sequence[float]] = None,
columns: int = 1,
rows: int = 1,
xstep: float = 0.0,
ystep: float = 0.0,
) -> None

Declare a job.

ParameterTypeDescription
labelstr
ref_pointstr = 'MACHINE'
abs_xyOptional[Sequence[float]] = None
columnsint = 1
rowsint = 1
xstepfloat = 0.0
ystepfloat = 0.0
ReturnsNone

declare_layer()​

declare_layer(
label: str,
color: str,
mode: str = 'VECTOR',
overscan: str = 'NONE',
speed: float = 100.0,
frequency: float = 20.0,
min_power_1: float = 8.0,
max_power_1: float = 70.0,
) -> None

Declare a layer.

ParameterTypeDescription
labelstr
colorstr
modestr = 'VECTOR'
overscanstr = 'NONE'
speedfloat = 100.0
frequencyfloat = 20.0
min_power_1float = 8.0
max_power_1float = 70.0
ReturnsNone

end_job()​

end_job() -> None

Finalize the job.

ParameterTypeDescription
ReturnsNone

frequency()​

frequency(frequency: float) -> None

Save the layer frequency for the next flush.

ParameterTypeDescription
frequencyfloat
ReturnsNone

move_speed()​

move_speed(speed: float) -> None

Record a move speed (comment-only).

ParameterTypeDescription
speedfloat
ReturnsNone

move_x_to()​

move_x_to(x: float) -> None

Move to an absolute X position.

ParameterTypeDescription
xfloat
ReturnsNone

move_xy_to()​

move_xy_to(x: float, y: float) -> None

Move to an absolute XY position.

ParameterTypeDescription
xfloat
yfloat
ReturnsNone

move_y_to()​

move_y_to(y: float) -> None

Move to an absolute Y position.

ParameterTypeDescription
yfloat
ReturnsNone

new_gluescript()​

new_gluescript() -> None

Reset all per-job state.

ParameterTypeDescription
ReturnsNone

power()​

power(percent: Optional[float]) -> None

Set immediate power for an IMAGE/DEPTHMAP layer.

ParameterTypeDescription
percentOptional[float]
ReturnsNone

power_range()​

power_range(min_power: Optional[float], max_power: Optional[float]) -> None

Save a power ramp range for the next cut.

ParameterTypeDescription
min_powerOptional[float]
max_powerOptional[float]
ReturnsNone

pwm()​

pwm(duration: float) -> None

Record the pulse width (comment-only).

ParameterTypeDescription
durationfloat
ReturnsNone

select_laser()​

select_laser(laser: int) -> None

Select a laser head.

ParameterTypeDescription
laserint
ReturnsNone

set_max_cut_speed()​

set_max_cut_speed(speed: float) -> None

Set the maximum cut speed used by power scaling.

ParameterTypeDescription
speedfloat
ReturnsNone

set_mode()​

set_mode(mode: str) -> None

Switch the layer mode mid-stream.

ParameterTypeDescription
modestr
ReturnsNone

set_overscan()​

set_overscan(overscan: str) -> None

Set the overscan for the current layer.

ParameterTypeDescription
overscanstr
ReturnsNone

set_power_floor()​

set_power_floor(floor: float) -> None

Set the laser's minimum firing power.

ParameterTypeDescription
floorfloat
ReturnsNone

set_power_scaling_enabled()​

set_power_scaling_enabled(enabled: bool) -> None

Enable or disable effective-min power scaling.

ParameterTypeDescription
enabledbool
ReturnsNone

stage_gluescript()​

stage_gluescript(
gluescript: Optional[Sequence[str]] = None,
require_complete: bool = True,
) -> str

Compile the job, or replay a transcript and compile it.

ParameterTypeDescription
gluescriptOptional[Sequence[str]] = None
require_completebool = True
Returnsstr

LayerConfig​

Per-layer rendering configuration for the scene encoder.

axis_position​

axis_position: float

reverse​

reverse: bool

rotary_diameter​

rotary_diameter: float

rotary_enabled​

rotary_enabled: bool

PythonEncoder​

Python-side constructor for [PythonEncoder].

Wraps a Python callable (ops: Ops) -> EncodeOutput so it can be driven through the Rust EncoderCompute stage. The callable runs under the GIL on a rayon worker thread. Use this to route encoders that remain in Python through the same pipeline as native Rust encoders.

callable​

callable: Any

name​

name: str

RuidaSpec​

Typed Python wrapper around the Rust RuidaSpec.

context_json​

context_json: str

SceneSpec​

Parameters for the 3D scene encoder.

layer_configs​

layer_configs: list[tuple[str, LayerConfig]]

Stored as a list of (uid, config) pairs for hash-free equality.

world_to_visual​

world_to_visual: list[list[float]]

TextureSpec​

Parameters for the texture encoder.

height_px​

height_px: int

origin_mm​

origin_mm: tuple[float, float]

px_per_mm​

px_per_mm: tuple[float, float]

width_px​

width_px: int

VertexSpec​

Parameters for the vertex-array encoder.

ViewSpec​

Parameters for the view encoder.

cut_color​

cut_color: list[int]

cut_lut​

cut_lut: list[list[int]]

engrave_lut​

engrave_lut: list[list[int]]

max_dimension_px​

max_dimension_px: int

max_total_pixels​

max_total_pixels: int

pixels_per_mm​

pixels_per_mm: tuple[float, float]

render_bbox​

render_bbox: tuple[float, float, float, float]

show_travel_moves​

show_travel_moves: bool

travel_color​

travel_color: list[int]

zero_power_color​

zero_power_color: list[int]