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', export_mode: pyvcad_compilers.pyvcad_compilers.ColorInkjetExportMode = <ColorInkjetExportMode.STOCHASTIC: 0>, color_pipeline_options: pyvcad_compilers.pyvcad_compilers.ColorPipelineOptions = <pyvcad_compilers.pyvcad_compilers.ColorPipelineOptions object at 0x108fec770>) 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’.

  • export_mode (ColorInkjetExportMode, optional) – The color-to-ink assignment mode.

  • color_pipeline_options (ColorPipelineOptions, optional) – Color correction pipeline step options.

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#

Abstract base class for slicer project compilers. Instantiate PrusaSlicerProjectCompiler or FullSpectrumSlicerProjectCompiler.

class pyvcad_compilers.PrusaSlicerProjectCompiler#
__init__(self: pyvcad_compilers.pyvcad_compilers.PrusaSlicerProjectCompiler, 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 = '', enable_color_mix: bool = False, color_mix_filaments: object = None, total_physical_extruders: SupportsInt = 5, color_mix_recipe_preset: str = 'expanded', max_palette_size: SupportsInt = 32, min_component_percent: SupportsInt = 15, max_recipe_components: SupportsInt = 3, direct_physical_delta_e: SupportsFloat = 1.0, region_overlap_mm: SupportsFloat = 0.2, volume_fraction_materials: dict = {}, material_defs_path: str = '') None#

Constructor. Creates a PrusaSlicer project compiler.

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 are present. Defaults to “”.

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

  • enable_color_mix (bool) – Enable Prusa ColorMix export explicitly. COLOR_RGB or VOLUME_FRACTIONS also select ColorMix automatically.

  • color_mix_filaments (list) – Optional list of dicts with color_hex and optional slot/nozzle_diameter_mm.

  • total_physical_extruders (int) – Total physical extruder slots in PrusaSlicer. Virtual ColorMix extruder IDs start after this count.

  • color_mix_recipe_preset (str) – Printable recipe set for COLOR_RGB ColorMix export. Use “expanded” or “conservative”.

  • max_palette_size (int) – Maximum generated ColorMix palette size.

  • min_component_percent (int) – Minimum component weight for mixed recipes.

  • max_recipe_components (int) – Maximum physical filaments per Prusa ColorMix recipe, up to 3.

  • direct_physical_delta_e (float) – Legacy compatibility setting; Prusa COLOR_RGB ColorMix selects physical and virtual recipes from one candidate set.

  • region_overlap_mm (float) – Small spatial overlap between generated ColorMix regions.

  • volume_fraction_materials (dict) – Optional material-name to physical slot mapping for VOLUME_FRACTIONS export.

  • material_defs_path (str) – Optional MaterialDefs JSON path. Empty uses bundled configs/default.json.

class pyvcad_compilers.FullSpectrumSlicerProjectCompiler#
__init__(self: pyvcad_compilers.pyvcad_compilers.FullSpectrumSlicerProjectCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, output_file_path: str, filaments: object = None, max_palette_size: SupportsInt = 32, min_component_percent: SupportsInt = 15, max_recipe_components: SupportsInt = 5, direct_physical_delta_e: SupportsFloat = 1.0, region_overlap_mm: SupportsFloat = 0.2, base_project_settings_path: str = '', orca_machine_profile_path: str = '', orca_process_profile_path: str = '', orca_default_filament_profile_path: str = '', orca_profile_search_paths: collections.abc.Sequence[str] = [], volume_fraction_materials: dict = {}, material_defs_path: str = '') None#

Constructor. Creates an Orca FullSpectrum project compiler.

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.

  • filaments (list) – Optional list of dicts with color_hex and optional slot, filament_settings_id, filament_id, filament_profile_path, nozzle_diameter_mm.

  • max_palette_size (int) – Maximum generated color palette size or volume-fraction region count.

  • min_component_percent (int) – Minimum component weight for mixed recipes.

  • max_recipe_components (int) – Maximum physical filaments per mixed recipe.

  • direct_physical_delta_e (float) – DeltaE threshold for direct physical-filament assignment.

  • region_overlap_mm (float) – Small spatial overlap between generated regions.

  • base_project_settings_path (str) – Optional Orca project settings JSON to overlay before FullSpectrum keys.

  • orca_machine_profile_path (str) – Optional Orca machine profile path or name.

  • orca_process_profile_path (str) – Optional Orca process profile path or name.

  • orca_default_filament_profile_path (str) – Optional default Orca filament profile path or name.

  • orca_profile_search_paths (list) – Additional directories searched for Orca JSON profiles.

  • volume_fraction_materials (dict) – Optional material-name to physical slot mapping for direct VOLUME_FRACTIONS export.

  • material_defs_path (str) – Optional MaterialDefs JSON path. Empty uses bundled configs/default.json.