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.SlicerProjectCompiler
__init__(self: pyvcad_compilers.pyvcad_compilers.SlicerProjectCompiler, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, output_file_path: str, printer_profile_path: str, filament_profile_path: str, num_regions: SupportsInt = 10, ignored_attributes: collections.abc.Sequence[str] = []) None

Constructor. Creates a SlicerProjectCompiler object.

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

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

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

  • printer_profile_path (str) – The file path to the printer profile to use for generating the slicer project.

  • filament_profile_path (str) – The file path to the filament profile to use for generating the slicer project.

  • num_regions (int) – The number of regions to divide each attribute range into when generating the slicer project. Defaults to 10.

  • ignored_attributes (list[str]) – A list of attribute names to ignore when computing meshes and XML settings. Defaults to empty list.