Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristoph Schöning <schoning.christoph@gmail.com>2021-10-26 16:08:10 +0300
committersupermerill <merill@free.fr>2021-12-22 20:12:08 +0300
commita0f8d5023a622d77f3805ea26fa4771ed31846e9 (patch)
treed31fc6963defa88dc11be04bb313c05d2e959f18 /src
parent0732d7106a1696961d96a9bf5346ee9e7eb6a626 (diff)
add init_z_rotate option
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/Preset.cpp2
-rw-r--r--src/libslic3r/PrintConfig.cpp10
-rw-r--r--src/libslic3r/PrintConfig.hpp4
-rw-r--r--src/slic3r/GUI/Plater.cpp32
4 files changed, 35 insertions, 13 deletions
diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp
index f230f9fe5..ed3a999b9 100644
--- a/src/libslic3r/Preset.cpp
+++ b/src/libslic3r/Preset.cpp
@@ -743,7 +743,7 @@ const std::vector<std::string>& Preset::printer_options()
if (s_opts.empty()) {
s_opts = {
"printer_technology",
- "bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset",
+ "bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset", "init_z_rotate",
"fan_kickstart",
"fan_speedup_overhangs",
"fan_speedup_time",
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index 7a0903bf0..854be0d4f 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -5020,6 +5020,16 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.005));
+ def = this->add("init_z_rotate", coFloat);
+ def->label = L("Preferred orientation");
+ def->category = OptionCategory::general;
+ def->tooltip = L("Rotate stl around z axes while adding them to the bed.");
+ def->sidetext = L("°");
+ def->min = -360;
+ def->max = 360;
+ def->mode = comAdvanced;
+ def->set_default_value(new ConfigOptionFloat(0.0));
+
// Declare retract values for filament profile, overriding the printer's extruder profile.
for (const char *opt_key : {
// floats
diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp
index c2416d66c..49767cabc 100644
--- a/src/libslic3r/PrintConfig.hpp
+++ b/src/libslic3r/PrintConfig.hpp
@@ -1428,6 +1428,7 @@ public:
ConfigOptionFloats wiping_volumes_matrix;
ConfigOptionFloats wiping_volumes_extruders;
ConfigOptionFloat z_offset;
+ ConfigOptionFloat init_z_rotate;
protected:
PrintConfig(int) : MachineEnvelopeConfig(1), GCodeConfig(1) {}
@@ -1548,6 +1549,7 @@ protected:
OPT_PTR(wiping_volumes_matrix);
OPT_PTR(wiping_volumes_extruders);
OPT_PTR(z_offset);
+ OPT_PTR(init_z_rotate);
}
};
@@ -1834,6 +1836,7 @@ public:
ConfigOptionBool thumbnails_custom_color;
ConfigOptionBool thumbnails_with_bed;
ConfigOptionBool thumbnails_with_support;
+ ConfigOptionFloat z_rotate;
protected:
void initialize(StaticCacheBase &cache, const char *base_ptr)
{
@@ -1865,6 +1868,7 @@ protected:
OPT_PTR(thumbnails_custom_color);
OPT_PTR(thumbnails_with_bed);
OPT_PTR(thumbnails_with_support);
+ OPT_PTR(z_rotate);
}
};
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index f00244f50..256779c4f 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -2012,24 +2012,29 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
, config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({
// These keys are used by (at least) printconfig::min_object_distance
"bed_shape", "bed_custom_texture", "bed_custom_model",
+ "brim_width",
"complete_objects",
"complete_objects_sort",
"complete_objects_one_skirt",
- "complete_objects_one_brim",
- "duplicate_distance", "extruder_clearance_radius",
- "skirt_extrusion_width",
+ "complete_objects_one_brim",
+ "duplicate_distance",
+ "draft_shield",
+ "extruder_clearance_radius",
"first_layer_extrusion_width",
+ "init_z_rotate",
+ "max_print_height",
"perimeter_extrusion_width",
"extrusion_width",
- "skirts", "skirt_brim", "skirt_distance", "skirt_distance_from_brim", "skirt_height", "draft_shield",
- "brim_width", "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material",
- "wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle",
- "wipe_tower_brim",
- "extruder_colour", "filament_colour", "max_print_height", "printer_model", "printer_technology",
+ "skirts", "skirt_brim", "skirt_distance", "skirt_distance_from_brim",
+ "skirt_extrusion_width", "skirt_height",
+ "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material",
+ "wipe_tower", "wipe_tower_brim", "wipe_tower_rotation_angle", "wipe_tower_width", "wipe_tower_x", "wipe_tower_y",
+ "extruder_colour", "filament_colour",
+ "printer_model", "printer_technology",
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
"layer_height", "first_layer_height", "min_layer_height", "max_layer_height",
- "brim_width", "perimeters", "perimeter_extruder", "fill_density", "infill_extruder", "top_solid_layers",
- "support_material", "support_material_extruder", "support_material_interface_extruder", "support_material_contact_distance", "raft_layers",
+ "brim_width", "perimeters", "perimeter_extruder", "fill_density", "infill_extruder", "raft_layers",
+ "support_material", "support_material_extruder", "support_material_interface_extruder", "support_material_contact_distance", "top_solid_layers",
"z_step"
}))
, sidebar(new Sidebar(q))
@@ -2486,9 +2491,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
else {
model = Slic3r::Model::read_from_file(path.string(), nullptr, nullptr, only_if(load_config, Model::LoadAttribute::CheckVersion));
- for (auto obj : model.objects)
- if (obj->name.empty())
+ for (auto obj : model.objects) {
+ if (obj->name.empty()) {
obj->name = fs::path(obj->input_file).filename().string();
+ }
+ obj->rotate(Geometry::deg2rad(config->opt_float("init_z_rotate")), Axis::Z);
+ }
}
} catch (const ConfigurationError &e) {
std::string message = GUI::format(_L("Failed loading file \"%1%\" due to an invalid configuration."), filename.string()) + "\n\n" + e.what();