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).
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,
) -> EncodeOutput
| Parameter | Type | Description |
|---|---|---|
text | str | |
op_to_machine_code | Any | |
machine_code_to_op | Any | |
| Returns | EncodeOutput |
Encoder
Python-visible wrapper around an encoder spec.
Construct as Encoder(spec) where spec is an instance of one of the encoder spec classes under
raygeo.ops.convert (e.g. ~raygeo.ops.convert.GcodeSpec). 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].
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
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
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]