Compilers#

class pyvcad_compilers.CompilerBase#
__init__(*args, **kwargs)#
cancel(self: pyvcad_compilers.pyvcad_compilers.CompilerBase) None#

Cancels the compilation.

compile(self: pyvcad_compilers.pyvcad_compilers.CompilerBase) None#

Compiles the project.

set_progress_callback(self: pyvcad_compilers.pyvcad_compilers.CompilerBase, arg0: collections.abc.Callable[[SupportsFloat], None]) None#

Sets the progress callback function.

Parameters:

progress_callback (function) – The progress callback function.

supported_attributes(self: pyvcad_compilers.pyvcad_compilers.CompilerBase) list[str]#

Returns the list of attribute names this compiler supports.

class pyvcad_compilers.MaterialInkjetCompiler#
__init__(self: pyvcad_compilers.pyvcad_compilers.MaterialInkjetCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, output_directory: str, file_prefix: str, material_defs: pyvcad.pyvcad.MaterialDefs, liquid_keep_out_distance: SupportsFloat = 0.0) None#

Constructor. Creates a MaterialInkjetCompiler object.

Parameters:
  • root (Node) – The root node of the tree.

  • voxel_size (vec3) – The size of the voxel (can be asymmetric).

  • output_directory (str) – The output directory.

  • file_prefix (str) – The file prefix that will be prepended with the slice index.

  • material_defs (MaterialDefs) – The material definitions.

  • liquid_keep_out_distance (float, optional) – The liquid keep out distance. Defaults to 0.0.

material_voxel_counts(self: pyvcad_compilers.pyvcad_compilers.MaterialInkjetCompiler) dict[int, int]#

Returns a dictionary mapping material IDs to voxel counts.

resolution(self: pyvcad_compilers.pyvcad_compilers.MaterialInkjetCompiler) tuple[int, int, int]#

Returns the resolution of the compiled model as a tuple (x_resolution, y_resolution, z_resolution).

set_fallback_material_id(self: pyvcad_compilers.pyvcad_compilers.MaterialInkjetCompiler, material_id: SupportsInt) None#

Set the fallback material ID for voxels where VOLUME_FRACTIONS is undefined. Only applies when strict mode is off. The default fallback is material ID 0 (void).

Parameters:

material_id (int) – The fallback material ID.

set_strict_mode(self: pyvcad_compilers.pyvcad_compilers.MaterialInkjetCompiler, strict: bool) None#

Enable or disable strict mode.

When strict mode is on, the compiler raises RuntimeError if any inside voxel is missing the VOLUME_FRACTIONS attribute. When off (the default), the fallback material is used for undefined regions.

Parameters:

strict (bool) – True to enable strict mode.

class pyvcad_compilers.ColorInkjetCompiler#
__init__(self: pyvcad_compilers.pyvcad_compilers.ColorInkjetCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, output_directory: str, file_prefix: str, icc_profile: str = 'default') None#

Constructor. Creates a ColorInkjetCompiler object.

Parameters:
  • root (Node) – The root node of the tree.

  • voxel_size (vec3) – The size of the voxel (can be asymmetric).

  • output_directory (str) – The output directory.

  • file_prefix (str) – The file prefix that will be prepended with the slice index.

  • icc_profile (str, optional) – The ICC profile name. Defaults to ‘default’.

resolution(self: pyvcad_compilers.pyvcad_compilers.ColorInkjetCompiler) tuple[int, int, int]#

Returns the resolution of the compiled model as a tuple (x_resolution, y_resolution, z_resolution).

set_fallback_color(self: pyvcad_compilers.pyvcad_compilers.ColorInkjetCompiler, color: pyvcad.pyvcad.Vec4) None#

Set the fallback sRGBA color for voxels where COLOR_RGBA is undefined. Each component is in [0, 1]. Only applies when strict mode is off. The default fallback is fully transparent (0,0,0,0).

Parameters:

color (Vec4) – The fallback sRGBA color.

set_strict_mode(self: pyvcad_compilers.pyvcad_compilers.ColorInkjetCompiler, strict: bool) None#

Enable or disable strict mode.

When strict mode is on, the compiler raises RuntimeError if any inside voxel is missing the COLOR_RGBA attribute. When off (the default), the fallback color is used for undefined regions.

Parameters:

strict (bool) – True to enable strict mode.

class pyvcad_compilers.VatCompiler#
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pyvcad_compilers.pyvcad_compilers.VatCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, output_directory: str, file_prefix: str) -> None

Constructor. Creates a VatCompiler that samples the model bounding box.

Parameters:
  • root (Node) – The root node of the tree.

  • voxel_size (vec3) – The voxel size in mm.

  • output_directory (str) – The output directory.

  • file_prefix (str) – The file prefix prepended to each bitmap slice name.

  1. __init__(self: pyvcad_compilers.pyvcad_compilers.VatCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, printer_volume: pyvcad.pyvcad.Vec3, output_directory: str, file_prefix: str) -> None

Constructor. Creates a VatCompiler that uses a fixed printer-volume XY domain.

Parameters:
  • root (Node) – The root node of the tree.

  • voxel_size (vec3) – The voxel size in mm.

  • printer_volume (vec3) – The printer build volume in mm.

  • output_directory (str) – The output directory.

  • file_prefix (str) – The file prefix prepended to each bitmap slice name.

resolution(self: pyvcad_compilers.pyvcad_compilers.VatCompiler) tuple[int, int, int]#

Returns the compiled resolution as (x_resolution, y_resolution, z_layer_count).

set_fallback_intensity(self: pyvcad_compilers.pyvcad_compilers.VatCompiler, intensity: SupportsFloat) None#

Set the fallback intensity for voxels where INTENSITY is undefined.

The value is clamped into [0, 1]. Only applies when strict mode is off. The default fallback intensity is 1.0.

Parameters:

intensity (float) – The fallback exposure intensity.

set_strict_mode(self: pyvcad_compilers.pyvcad_compilers.VatCompiler, strict: bool) None#

Enable or disable strict mode.

When strict mode is on, the compiler raises RuntimeError if any inside voxel is missing the INTENSITY attribute. When off (the default), missing values use the fallback intensity.

Parameters:

strict (bool) – True to enable strict mode.

class pyvcad_compilers.SlicerProjectCompiler#
__init__(self: pyvcad_compilers.pyvcad_compilers.SlicerProjectCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, output_file_path: str, num_regions: SupportsInt = 10, printer_profile_path: str = '', filament_profile_path: str = '') None#

Constructor. Creates a SlicerProjectCompiler object.

Parameters:
  • root (Node) – The root node of the prepared tree.

  • voxel_size (vec3) – The sampling resolution.

  • output_file_path (str) – The output file path for the .3mf project.

  • num_regions (int) – The number of sub-ranges per attribute dimension. Defaults to 10.

  • printer_profile_path (str) – Path to PrusaSlicer printer profile (.ini). Required only when virtual extrusion attributes (e.g. temperature) are present. Defaults to “”.

  • filament_profile_path (str) – Path to PrusaSlicer filament profile (.ini). Required only when virtual extrusion attributes are present. Defaults to “”.