forked from prusa3d/PrusaSlicer
-
Notifications
You must be signed in to change notification settings - Fork 0
Ch. 3 ‐ Adding new parameters to the GUI
Alex Petsiuk edited this page Aug 14, 2024
·
2 revisions
To add a few variables to the PrusaSlicer GUI you have to modify the following files:
- slic3r/GUI/Tab.cpp
- libslic3r/PrintConfig.hpp
- libslic3r/PrintConfig.cpp
- libslic3r/Preset.cpp
----cpp
Tab.cpp
page = add_options_page(L("Tool Clustering"), "atc_tool_clustering.png"); // ../PrusaSlicer/resources/icons
optgroup = page->new_optgroup(L("General parameters (experimental)"));
optgroup->append_single_option_line("atc_enable_tool_clustering");
PrintConfig.hpp
PRINT_CONFIG_CLASS_DEFINE(
PrintObjectConfig,
((ConfigOptionBool, atc_enable_tool_clustering))
PrintConfig.cpp
// enable ATC tool clustering: bool checkbox
def = this->add("atc_enable_tool_clustering", coBool);
def->label = L("Enable tool clustering");
def->tooltip = L("This feature will enable the experimental ATC color layer batching algorithm.");
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(true));
Preset.cpp
static std::vector<std::string> s_Preset_print_options {..., "atc_enable_tool_clustering", ... }
m_print_config.option<ConfigOptionBool>("atc_enable_tool_clustering")->value = true;
if (m_print_config.option<ConfigOptionBool>("atc_enable_tool_clustering")->value) {...}
OR
double critical_intersection = print.m_objects[0]->config().atc_critical_intersection_area; // 0.5