libvcad_compilers — compiler classes#
-
class CompilerBase#
- #include <compiler_base.h>
Subclassed by ColorInkjetCompiler, GCVFCompiler, MaterialInkjetCompiler, MyersonCompiler, SimulationCompiler, SlicerProjectCompiler, VatCompiler, VdbCompiler
Public Functions
-
void cancel()#
-
virtual void compile() = 0#
-
CompilerBase() = default#
-
void set_progress_callback(const std::function<void(double)> &progress_callback)#
-
virtual std::vector<std::string> supported_attributes() const = 0#
-
virtual ~CompilerBase() = default#
-
void cancel()#
-
class MaterialInkjetCompiler : public CompilerBase#
- #include <material_inkjet_compiler.h>
Public Functions
-
virtual void compile() override#
-
std::unordered_map<uint8_t, size_t> material_voxel_counts() const#
-
std::tuple<size_t, size_t, size_t> resolution() const#
-
void set_fallback_material_id(uint8_t material_id)#
Sets the fallback material ID used for voxels where VOLUME_FRACTIONS is undefined.
Only used when strict mode is off.
- Parameters:
material_id – The fallback material ID (default is 0, the void material).
-
void set_strict_mode(bool strict)#
Enables or disables strict mode.
When strict mode is on, the compiler throws a std::runtime_error if any inside voxel is missing the required VOLUME_FRACTIONS attribute. When off (default), the fallback material is used instead.
-
virtual std::vector<std::string> supported_attributes() const override#
Private Members
-
uint8_t m_fallback_material_id = 0#
-
std::string m_file_prefix#
-
double m_liquid_keep_out_distance#
-
std::shared_ptr<MaterialDefs> m_material_defs#
-
std::unordered_map<uint8_t, size_t> m_material_voxel_counts#
-
std::string m_output_directory#
-
bool m_strict_mode = false#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
-
virtual void compile() override#
-
class ColorInkjetCompiler : public CompilerBase#
- #include <color_inkjet_compiler.h>
Public Functions
-
virtual void compile() override#
-
std::tuple<size_t, size_t, size_t> resolution() const#
-
void set_fallback_color(glm::vec4 color)#
Sets the fallback RGBA color used for voxels where COLOR_RGBA is undefined.
Each component is in [0, 1]. Only used when strict mode is off.
- Parameters:
color – The fallback sRGBA color (default is fully transparent: 0,0,0,0).
-
void set_strict_mode(bool strict)#
Enables or disables strict mode.
When strict mode is on, the compiler throws a std::runtime_error if any inside voxel is missing the required COLOR_RGBA attribute. When off (default), the fallback color is used instead.
-
virtual std::vector<std::string> supported_attributes() const override#
Private Members
-
ColorPipelineOptions m_color_pipeline_options#
-
ColorInkjetExportMode m_export_mode = ColorInkjetExportMode::stochastic#
-
glm::vec4 m_fallback_color = glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)#
-
std::string m_file_prefix#
-
std::string m_icc_profile#
-
std::string m_output_directory#
-
bool m_strict_mode = false#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
-
virtual void compile() override#
-
class VatCompiler : public CompilerBase#
- #include <vat_compiler.h>
Generates grayscale BMP slice stacks for vat-photo style printers.
This compiler consumes the scalar INTENSITY attribute in [0, 1] and maps it directly to 8-bit grayscale output. It can either sample the model bounding box or a fixed printer-volume XY canvas with the model centered in XY.
Public Functions
-
virtual void compile() override#
-
std::tuple<size_t, size_t, size_t> resolution() const#
Returns the compiled slice resolution as (x, y, z_layers).
-
void set_fallback_intensity(double intensity)#
Sets the fallback intensity used when INTENSITY is undefined.
The stored value is clamped into [0, 1].
-
void set_strict_mode(bool strict)#
Enables or disables strict mode for missing INTENSITY samples.
-
virtual std::vector<std::string> supported_attributes() const override#
Samples only the model bounding box.
Samples a fixed printer-volume XY domain with centered XY placement.
Private Functions
-
double resolve_intensity(const glm::vec3 &voxel_pos, const std::optional<AttributeSamples> &samples) const#
-
glm::vec3 world_position(long x, long y, long z, const glm::vec3 &bbox_min, const glm::vec3 ¢er_offset) const#
Private Members
-
double m_fallback_intensity = 1.0#
-
std::string m_file_prefix#
-
std::string m_output_directory#
-
glm::vec3 m_printer_volume = glm::vec3(0.0f)#
-
bool m_strict_mode = false#
-
bool m_use_printer_volume = false#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
-
virtual void compile() override#
-
class SlicerProjectCompiler : public CompilerBase#
- #include <slicer_project_base.h>
Shared base for slicer project compilers.
This base owns the prepared OpenVCAD tree, output path, sampled voxel grid, and common helpers used by concrete slicer project dialects. Instantiate PrusaSlicerProjectCompiler or FullSpectrumSlicerProjectCompiler instead.
Subclassed by FullSpectrumSlicerProjectCompiler, PrusaSlicerProjectCompiler
Public Functions
-
virtual void compile() override = 0#
-
virtual std::vector<std::string> supported_attributes() const override = 0#
-
~SlicerProjectCompiler() override = default#
Protected Functions
-
std::string derive_object_name() const#
Derives an object name from the output file path.
-
void sample_tree()#
Samples the root tree and populates shared grid state.
-
virtual void compile() override = 0#
-
class PrusaSlicerProjectCompiler : public SlicerProjectCompiler#
- #include <slicer_project_prusa.h>
Compiles slicer attributes into a PrusaSlicer-compatible 3MF project.
Supports settings-mesh metadata, virtual-extrusion G-code, and PrusaSlicer ColorMix workflows in the Slic3r/Prusa project dialect.
Public Functions
-
virtual void compile() override#
-
virtual std::vector<std::string> supported_attributes() const override#
Private Functions
-
size_t add_extruder(int primary_value, const std::unordered_map<std::string, int> &companion_values)#
-
std::string build_color_mix_config_json(const std::vector<PrusaColorMixPaletteEntry> &palette) const#
-
std::string build_color_mix_project_config(const PrusaColorMixSettings &color_mix_settings) const#
-
PrusaColorMixSettings build_color_mix_settings(bool use_volume_fractions) const#
-
std::string build_project_config()#
-
void classify_attributes(const std::vector<std::string> &tree_attributes)#
-
void compile_color_mix(bool use_volume_fractions)#
-
std::unordered_map<std::string, std::pair<double, double>> compute_attribute_ranges()#
-
vtkSmartPointer<vtkImageData> compute_band_sdf_image(const std::unordered_map<std::string, std::pair<double, double>> &attribute_ranges_map)#
-
double compute_companion_average(const std::string &primary_attribute, double range_min, double range_max, const std::string &companion_attribute) const#
Private Members
-
std::vector<ExtruderEntry> m_extruders#
-
std::string m_filament_profile_path#
-
size_t m_num_regions#
-
std::string m_printer_profile_path#
-
std::vector<std::string> m_segmented_attributes#
-
PrusaSlicerProjectSettings m_settings#
-
std::vector<const SettingsMeshDescriptor*> m_settings_mesh_active#
-
bool m_uses_virtual_extrusion = false#
-
std::vector<const VirtualExtrusionDescriptor*> m_virtual_extrusion_active#
Private Static Functions
-
static std::string expand_gcode_template(const VirtualExtrusionDescriptor &descriptor, int primary_value, const std::unordered_map<std::string, int> &companion_values)#
-
struct ExtruderEntry#
-
virtual void compile() override#
-
struct PrusaSlicerProjectSettings#
- #include <slicer_project_prusa.h>
Options for PrusaSlicer settings-mesh, virtual-extrusion, and ColorMix export.
Public Members
-
std::vector<PrusaColorMixPhysicalFilament> color_mix_filaments#
-
PrusaColorMixRecipePreset color_mix_recipe_preset = PrusaColorMixRecipePreset::Expanded#
-
double direct_physical_delta_e = 1.0#
-
bool enable_color_mix = false#
-
std::string filament_profile_path#
-
std::string material_defs_path#
-
size_t max_palette_size = 32#
-
size_t max_recipe_components = 3#
-
int min_component_percent = 15#
-
size_t num_regions = 10#
-
std::string printer_profile_path#
-
double region_overlap_mm = 0.2#
-
size_t total_physical_extruders = 5#
-
std::vector<PrusaColorMixMaterialMapping> volume_fraction_materials#
-
std::vector<PrusaColorMixPhysicalFilament> color_mix_filaments#
-
class FullSpectrumSlicerProjectCompiler : public SlicerProjectCompiler#
- #include <slicer_project_full_spectrum.h>
Compiles COLOR_RGB or VOLUME_FRACTIONS into an Orca FullSpectrum project.
Writes the Bambu/Orca component-based 3MF dialect with physical and virtual FullSpectrum mixed-filament assignments.
Public Functions
-
virtual void compile() override#
-
virtual std::vector<std::string> supported_attributes() const override#
Private Functions
-
std::vector<FullSpectrumPaletteEntry> build_full_spectrum_palette() const#
-
std::string build_full_spectrum_project_config(const std::vector<FullSpectrumPaletteEntry> &palette) const#
-
std::vector<FullSpectrumMeshRegion> build_full_spectrum_regions(const std::vector<FullSpectrumPaletteEntry> &palette)#
-
std::vector<FullSpectrumPaletteEntry> build_full_spectrum_volume_fraction_palette() const#
-
vtkSmartPointer<vtkImageData> compute_full_spectrum_region_sdf_image(const std::vector<FullSpectrumPaletteEntry> &palette, size_t region_index) const#
-
void validate_full_spectrum_settings() const#
Private Members
-
FullSpectrumSlicerProjectSettings m_settings#
-
struct FullSpectrumMeshRegion#
-
struct FullSpectrumPaletteEntry#
-
virtual void compile() override#
-
struct FullSpectrumSlicerProjectFilament#
- #include <slicer_project_full_spectrum.h>
Physical filament slot description for Orca FullSpectrum export.
-
struct FullSpectrumSlicerProjectMaterialMapping#
- #include <slicer_project_full_spectrum.h>
Maps a VCAD volume-fraction material to a physical filament slot.
-
struct FullSpectrumSlicerProjectSettings#
- #include <slicer_project_full_spectrum.h>
Options for COLOR_RGB or VOLUME_FRACTIONS to Orca FullSpectrum project export.
Public Members
-
std::string base_project_settings_path#
-
double direct_physical_delta_e = 1.0#
-
std::string material_defs_path#
-
size_t max_palette_size = 32#
-
size_t max_recipe_components = 5#
-
int min_component_percent = 15#
-
std::string orca_default_filament_profile_path#
-
std::string orca_machine_profile_path#
-
std::string orca_process_profile_path#
-
std::vector<std::string> orca_profile_search_paths#
-
std::vector<FullSpectrumSlicerProjectFilament> physical_filaments#
-
double region_overlap_mm = 0.2#
-
std::vector<FullSpectrumSlicerProjectMaterialMapping> volume_fraction_materials#
-
std::string base_project_settings_path#