Skip to content

Commit

Permalink
added bottom layers option to GOO exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
amini-allight committed Oct 28, 2024
1 parent c0b70c8 commit fc087c9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/libslic3r/Format/GOO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ static float constrained_map(float value, float min, float max, float out_min, f
return out_min * (1 - t) + out_max * t;
}

static float generate_layer_exposure_time(
int current_layer, int bottom_layers, int faded_layers,
float initial_exposure_time, float exposure_time
) {
if (current_layer <= bottom_layers) {
return initial_exposure_time;
} else {
return constrained_map(
current_layer - bottom_layers, 1, faded_layers + 1,
initial_exposure_time, exposure_time
);
}
}

static void write_thumbnail(
size_t width, size_t height, const ThumbnailsList &thumbnails, uint16_t *buffer
) {
Expand Down Expand Up @@ -375,8 +389,8 @@ void GOOWriter::export_print(
l_def.position_mm = hton<float>(
mat.initial_layer_height.getFloat() + layer_height * (current_layer - 1)
);
l_def.exposure_time_s = hton(constrained_map(
current_layer, 1, obj_stats.faded_layers + 1, //
l_def.exposure_time_s = hton(generate_layer_exposure_time(
current_layer, obj_stats.bottom_layers, obj_stats.faded_layers,
mat.initial_exposure_time, mat.exposure_time
));
l_def.off_time_s = 0;
Expand Down Expand Up @@ -431,4 +445,4 @@ ConfigSubstitutions GOOReader::read(
return {};
}

} // namespace Slic3r
} // namespace Slic3r
1 change: 1 addition & 0 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ static std::vector<std::string> s_Preset_printer_options {
static std::vector<std::string> s_Preset_sla_print_options {
"layer_height",
"faded_layers",
"bottom_layers",
"supports_enable",
"support_tree_type",

Expand Down
8 changes: 8 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4183,6 +4183,14 @@ void PrintConfigDef::init_sla_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInt(10));

def = this->add("bottom_layers", coInt);
def->label = L("Bottom Layers");
def->tooltip = L("Number of layers the initial exposure time is repeated for.");
def->min = 1;
def->max = 20;
def->mode = comExpert;
def->set_default_value(new ConfigOptionInt(10));

def = this->add("min_exposure_time", coFloat);
def->label = L("Minimum exposure time");
def->tooltip = L("Minimum exposure time");
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,8 @@ PRINT_CONFIG_CLASS_DEFINE(

//Number of the layers needed for the exposure time fade [3;20]
((ConfigOptionInt, faded_layers))/*= 10*/
//Number of layers the initial exposure time is repeated for [1;20]
((ConfigOptionInt, bottom_layers))/*= 10*/

((ConfigOptionFloat, slice_closing_radius))
((ConfigOptionEnum<SlicingMode>, slicing_mode))
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5878,6 +5878,7 @@ void TabSLAPrint::build()
auto optgroup = page->new_optgroup(L("Layers"));
optgroup->append_single_option_line("layer_height");
optgroup->append_single_option_line("faded_layers");
optgroup->append_single_option_line("bottom_layers");

page = add_options_page(L("Supports"), "support"/*"sla_supports"*/);

Expand Down

0 comments on commit fc087c9

Please sign in to comment.