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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsupermerill <merill@fr.fr>2019-01-24 17:19:52 +0300
committersupermerill <merill@fr.fr>2019-01-25 21:35:49 +0300
commit29d2d80202e017315cbeb1c4a671f5863955db5d (patch)
treee98b8731694d81c2856af1b305cf66734718dd87
parentbc5e2995117a273274798fcea6c885e724037494 (diff)
reforged support z distance:
- choice between "from filament, from plane, soluble - different settings for top & bottom.
-rw-r--r--src/libslic3r/Fill/FillRectilinear2.cpp8
-rw-r--r--src/libslic3r/PerimeterGenerator.cpp5
-rw-r--r--src/libslic3r/Print.cpp4
-rw-r--r--src/libslic3r/PrintConfig.cpp49
-rw-r--r--src/libslic3r/PrintConfig.hpp21
-rw-r--r--src/libslic3r/PrintObject.cpp8
-rw-r--r--src/libslic3r/Slicing.cpp8
-rw-r--r--src/libslic3r/SupportMaterial.cpp88
-rw-r--r--src/libslic3r/SupportMaterial.hpp20
-rw-r--r--src/slic3r/GUI/Field.cpp2
-rw-r--r--src/slic3r/GUI/GUI.cpp2
-rw-r--r--src/slic3r/GUI/OptionsGroup.cpp3
-rw-r--r--src/slic3r/GUI/Preset.cpp9
-rw-r--r--src/slic3r/GUI/Tab.cpp20
14 files changed, 169 insertions, 78 deletions
diff --git a/src/libslic3r/Fill/FillRectilinear2.cpp b/src/libslic3r/Fill/FillRectilinear2.cpp
index df4f9f42b..23a404098 100644
--- a/src/libslic3r/Fill/FillRectilinear2.cpp
+++ b/src/libslic3r/Fill/FillRectilinear2.cpp
@@ -288,9 +288,9 @@ public:
// for the infill pattern, don't cut the corners.
// default miterLimt = 3
//double mitterLimit = 10.;
- assert(aoffset1 < 0);
- assert(aoffset2 < 0);
- assert(aoffset2 < aoffset1);
+ //assert(aoffset1 < 0);
+ //assert(aoffset2 < 0);
+ //assert(aoffset2 < aoffset1);
bool sticks_removed = remove_sticks(polygons_src);
// if (sticks_removed) printf("Sticks removed!\n");
polygons_outer = offset(polygons_src, aoffset1,
@@ -881,7 +881,7 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
std::pair<float, Point> rotate_vector = this->_infill_direction(surface);
rotate_vector.first += angleBase;
- assert(params.density > 0.0001f && params.density <= 1.f);
+ assert(params.density > 0.0001f);
coord_t line_spacing = _line_spacing_for_density(params.density);
// On the polygons of poly_with_offset, the infill lines will be connected.
diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp
index 13652f86a..5302a3b5a 100644
--- a/src/libslic3r/PerimeterGenerator.cpp
+++ b/src/libslic3r/PerimeterGenerator.cpp
@@ -192,7 +192,6 @@ void PerimeterGenerator::process()
if (true) {
//only consider the part that can be bridged (really, by the bridge algorithm)
//first, separate into islands (ie, each ExPlolygon)
- int numploy = 0;
//only consider the bottom layer that intersect unsupported, to be sure it's only on our island.
ExPolygonCollection lower_island(diff_ex(last, unsupported, true));
BridgeDetector detector(unsupported,
@@ -570,7 +569,7 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops(
// detect overhanging/bridging perimeters
ExtrusionPaths paths;
if (this->config->overhangs && this->layer_id > 0
- && !(this->object_config->support_material && this->object_config->support_material_contact_distance.value == 0)) {
+ && !(this->object_config->support_material && this->object_config->support_material_contact_distance_type.value == zdNone)) {
// get non-overhang paths by intersecting this loop with the grown lower slices
extrusion_paths_append(
paths,
@@ -839,7 +838,7 @@ PerimeterGenerator::_extrude_and_cut_loop(const PerimeterGeneratorLoop &loop, co
// detect overhanging/bridging perimeters
if (this->config->overhangs && this->layer_id > 0
- && !(this->object_config->support_material && this->object_config->support_material_contact_distance.value == 0)) {
+ && !(this->object_config->support_material && this->object_config->support_material_contact_distance_type.value == zdNone)) {
ExtrusionPaths paths;
// get non-overhang paths by intersecting this loop with the grown lower slices
extrusion_paths_append(
diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp
index a4034981b..f89c316da 100644
--- a/src/libslic3r/Print.cpp
+++ b/src/libslic3r/Print.cpp
@@ -1258,7 +1258,9 @@ std::string Print::validate() const
return L("The Wipe Tower is only supported for multiple objects if they have equal layer heigths");
if (slicing_params.raft_layers() != slicing_params0.raft_layers())
return L("The Wipe Tower is only supported for multiple objects if they are printed over an equal number of raft layers");
- if (object->config().support_material_contact_distance != m_objects.front()->config().support_material_contact_distance)
+ if (object->config().support_material_contact_distance_type != m_objects.front()->config().support_material_contact_distance_type
+ || object->config().support_material_contact_distance_top != m_objects.front()->config().support_material_contact_distance_top
+ || object->config().support_material_contact_distance_bottom != m_objects.front()->config().support_material_contact_distance_bottom)
return L("The Wipe Tower is only supported for multiple objects if they are printed with the same support_material_contact_distance");
if (! equal_layering(slicing_params, slicing_params0))
return L("The Wipe Tower is only supported for multiple objects if they are sliced equally.");
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index 32d4ee101..490f10203 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -2189,16 +2189,51 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->default_value = new ConfigOptionBool(false);
- def = this->add("support_material_contact_distance", coFloat);
+ def = this->add("support_material_contact_distance_type", coEnum);
+ def->label = L("Type");
+ def->category = L("Support material");
+ def->tooltip = L("How to compute the vertical z-distance.\n"
+ "From filament: it use the nearest bit of the filament. When a bridge is extruded, it goes below the current plane.\n"
+ "From plane: it use the plane-z. Same than 'from filament' if no 'bridge' is extruded.\n"
+ "None: No z-offset. Useful for Soluble supports.\n");
+ def->cli = "support-material-contact-type=s";
+ def->enum_keys_map = &ConfigOptionEnum<SupportZDistanceType>::get_enum_values();
+ def->enum_values.push_back("filament");
+ def->enum_values.push_back("plane");
+ def->enum_values.push_back("none");
+ def->enum_labels.push_back("From filament");
+ def->enum_labels.push_back("From plane");
+ def->enum_labels.push_back("None");
+ def->mode = comAdvanced;
+ def->default_value = new ConfigOptionEnum<SupportZDistanceType>(zdFilament);
+
+ def = this->add("support_material_contact_distance_top", coFloat);
def->gui_type = "f_enum_open";
- def->label = L("Contact Z distance");
+ def->label = L("Top");
+ def->category = L("Support material");
+ def->tooltip = L("The vertical distance between support material interface and the object"
+ "(when the object is printed on top of the support). "
+ "Setting this to 0 will also prevent Slic3r from using bridge flow and speed "
+ "for the first object layer.");
+ def->sidetext = L("mm");
+ def->cli = "support-material-contact-distance-top=f";
+ // def->min = 0;
+ def->enum_values.push_back("0");
+ def->enum_values.push_back("0.2");
+ def->enum_labels.push_back((boost::format("0 (%1%)") % L("soluble")).str());
+ def->enum_labels.push_back((boost::format("0.2 (%1%)") % L("detachable")).str());
+ def->mode = comAdvanced;
+ def->default_value = new ConfigOptionFloat(0.2);
+
+ def = this->add("support_material_contact_distance_bottom", coFloat);
+ def->gui_type = "f_enum_open";
+ def->label = L("Bottom");
def->category = L("Support material");
- def->tooltip = L("The vertical distance between object and support material interface. "
- "Setting this to 0 will also prevent Slic3r from using bridge flow and speed "
- "for the first object layer.");
+ def->tooltip = L("The vertical distance between object and support material interface"
+ "(when the support is printed on top of the object).");
def->sidetext = L("mm");
- def->cli = "support-material-contact-distance=f";
-// def->min = 0;
+ def->cli = "support-material-contact-distance-bottom=f";
+ // def->min = 0;
def->enum_values.push_back("0");
def->enum_values.push_back("0.2");
def->enum_labels.push_back((boost::format("0 (%1%)") % L("soluble")).str());
diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp
index 607ca2596..c2fc9350d 100644
--- a/src/libslic3r/PrintConfig.hpp
+++ b/src/libslic3r/PrintConfig.hpp
@@ -61,6 +61,10 @@ enum DenseInfillAlgo {
dfaAutomatic, dfaAutoNotFull, dfaEnlarged,
};
+enum SupportZDistanceType {
+ zdFilament, zdPlane, zdNone,
+};
+
enum SLADisplayOrientation {
sladoLandscape,
sladoPortrait
@@ -174,6 +178,15 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<DenseInfillAlgo>:
return keys_map;
}
+template<> inline const t_config_enum_values& ConfigOptionEnum<SupportZDistanceType>::get_enum_values() {
+ static const t_config_enum_values keys_map = {
+ { "filament", zdFilament },
+ { "plane", zdPlane },
+ { "none", zdNone }
+ };
+ return keys_map;
+}
+
template<> inline const t_config_enum_values& ConfigOptionEnum<SLADisplayOrientation>::get_enum_values() {
static const t_config_enum_values keys_map = {
{ "landscape", sladoLandscape},
@@ -396,7 +409,9 @@ public:
// Direction of the support pattern (in XY plane).
ConfigOptionFloat support_material_angle;
ConfigOptionBool support_material_buildplate_only;
- ConfigOptionFloat support_material_contact_distance;
+ ConfigOptionEnum<SupportZDistanceType> support_material_contact_distance_type;
+ ConfigOptionFloat support_material_contact_distance_top;
+ ConfigOptionFloat support_material_contact_distance_bottom;
ConfigOptionInt support_material_enforce_layers;
ConfigOptionInt support_material_extruder;
ConfigOptionFloatOrPercent support_material_extrusion_width;
@@ -442,7 +457,9 @@ protected:
OPT_PTR(support_material_auto);
OPT_PTR(support_material_angle);
OPT_PTR(support_material_buildplate_only);
- OPT_PTR(support_material_contact_distance);
+ OPT_PTR(support_material_contact_distance_type);
+ OPT_PTR(support_material_contact_distance_top);
+ OPT_PTR(support_material_contact_distance_bottom);
OPT_PTR(support_material_enforce_layers);
OPT_PTR(support_material_interface_contact_loops);
OPT_PTR(support_material_extruder);
diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp
index aeee8750c..8bf7475eb 100644
--- a/src/libslic3r/PrintObject.cpp
+++ b/src/libslic3r/PrintObject.cpp
@@ -481,7 +481,9 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
else if (
opt_key == "clip_multipart_objects"
|| opt_key == "elefant_foot_compensation"
- || opt_key == "support_material_contact_distance"
+ || opt_key == "support_material_contact_distance_type"
+ || opt_key == "support_material_contact_distance_top"
+ || opt_key == "support_material_contact_distance_bottom"
|| opt_key == "xy_size_compensation"
|| opt_key == "external_infill_margin"
|| opt_key == "bridged_infill_margin"
@@ -912,12 +914,12 @@ void PrintObject::detect_surfaces_type()
[this, idx_region, interface_shells, &surfaces_new](const tbb::blocked_range<size_t>& range) {
// If we have raft layers, consider bottom layer as a bridge just like any other bottom surface lying on the void.
SurfaceType surface_type_bottom_1st =
- (m_config.raft_layers.value > 0 && m_config.support_material_contact_distance.value > 0) ?
+ (m_config.raft_layers.value > 0 && m_config.support_material_contact_distance_type.value != zdNone) ?
stBottomBridge : stBottom;
// If we have soluble support material, don't bridge. The overhang will be squished against a soluble layer separating
// the support from the print.
SurfaceType surface_type_bottom_other =
- (m_config.support_material.value && m_config.support_material_contact_distance.value == 0) ?
+ (m_config.support_material.value && m_config.support_material_contact_distance_type.value == zdNone) ?
stBottom : stBottomBridge;
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
m_print->throw_if_canceled();
diff --git a/src/libslic3r/Slicing.cpp b/src/libslic3r/Slicing.cpp
index 14467893e..f0647736a 100644
--- a/src/libslic3r/Slicing.cpp
+++ b/src/libslic3r/Slicing.cpp
@@ -57,7 +57,7 @@ SlicingParameters SlicingParameters::create_from_config(
// In that case all the nozzles have to be of the same diameter.
coordf_t support_material_extruder_dmr = print_config.nozzle_diameter.get_at(object_config.support_material_extruder.value - 1);
coordf_t support_material_interface_extruder_dmr = print_config.nozzle_diameter.get_at(object_config.support_material_interface_extruder.value - 1);
- bool soluble_interface = object_config.support_material_contact_distance.value == 0.;
+ bool soluble_interface = object_config.support_material_contact_distance_type.value == zdNone;
SlicingParameters params;
params.layer_height = object_config.layer_height.value;
@@ -95,9 +95,9 @@ SlicingParameters SlicingParameters::create_from_config(
params.max_layer_height = std::max(params.max_layer_height, params.layer_height);
if (! soluble_interface) {
- params.gap_raft_object = object_config.support_material_contact_distance.value;
- params.gap_object_support = object_config.support_material_contact_distance.value;
- params.gap_support_object = object_config.support_material_contact_distance.value;
+ params.gap_raft_object = object_config.support_material_contact_distance_top.value;
+ params.gap_object_support = object_config.support_material_contact_distance_bottom.value;
+ params.gap_support_object = object_config.support_material_contact_distance_top.value;
}
if (params.base_raft_layers > 0) {
diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp
index 60fb0f71a..f208a2ed4 100644
--- a/src/libslic3r/SupportMaterial.cpp
+++ b/src/libslic3r/SupportMaterial.cpp
@@ -284,8 +284,8 @@ void PrintObjectSupportMaterial::generate(PrintObject &object)
// this->trim_support_layers_by_object(object, top_contacts, m_slicing_params.soluble_interface ? 0. : m_support_layer_height_min, 0., m_gap_xy);
this->trim_support_layers_by_object(object, top_contacts,
- m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value,
- m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value, m_gap_xy);
+ m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance_top.value,
+ m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance_bottom.value, m_gap_xy);
#ifdef SLIC3R_DEBUG
for (const MyLayer *layer : top_contacts)
@@ -1207,7 +1207,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
new_layer.height = object.layers()[layer_id - 1]->height;
new_layer.bottom_z = (layer_id == 1) ? m_slicing_params.object_print_z_min : object.layers()[layer_id - 2]->print_z;
} else {
- new_layer.print_z = layer.print_z - layer.height - m_object_config->support_material_contact_distance;
+ new_layer.print_z = layer.print_z - layer.height - m_object_config->support_material_contact_distance_top;
new_layer.bottom_z = new_layer.print_z;
new_layer.height = 0.;
// Ignore this contact area if it's too low.
@@ -1230,11 +1230,14 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
// Contact layer will be printed with a normal flow, but
// it will support layers printed with a bridging flow.
if (SupportMaterialInternal::has_bridging_extrusions(layer)) {
- coordf_t bridging_height = 0.;
- for (const LayerRegion *region : layer.regions())
- bridging_height += region->region()->bridging_height_avg(*m_print_config);
- bridging_height /= coordf_t(layer.regions().size());
- coordf_t bridging_print_z = layer.print_z - bridging_height - m_object_config->support_material_contact_distance;
+ coordf_t bridging_height = layer.height;
+ if (m_object_config->support_material_contact_distance_type == zdFilament) {
+ bridging_height = 0.;
+ for (const LayerRegion *region : layer.regions())
+ bridging_height += region->region()->bridging_height_avg(*m_print_config);
+ bridging_height /= coordf_t(layer.regions().size());
+ }
+ coordf_t bridging_print_z = layer.print_z - bridging_height - m_object_config->support_material_contact_distance_top;
if (bridging_print_z >= m_slicing_params.first_print_layer_height - EPSILON) {
// Not below the first layer height means this layer is printable.
if (new_layer.print_z < m_slicing_params.first_print_layer_height + EPSILON) {
@@ -1491,7 +1494,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
// top shapes so this can be done here
//FIXME calculate layer height based on the actual thickness of the layer:
// If the layer is extruded with no bridging flow, support just the normal extrusions.
- layer_new.height = m_slicing_params.soluble_interface ?
+ layer_new.height = m_slicing_params.soluble_interface ?
// Align the interface layer with the object's layer height.
object.layers()[layer_id + 1]->height :
// Place a bridge flow interface layer over the top surface.
@@ -1499,8 +1502,9 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
// According to Jindrich the bottom surfaces work well.
//FIXME test the bridging flow instead?
m_support_material_interface_flow.nozzle_diameter;
+ layer_new.height_block = ((m_object_config->support_material_contact_distance_type == zdPlane) ? object.layers()[layer_id + 1]->height : layer_new.height);
layer_new.print_z = m_slicing_params.soluble_interface ? object.layers()[layer_id + 1]->print_z :
- layer.print_z + layer_new.height + m_object_config->support_material_contact_distance.value;
+ (layer.print_z + layer_new.height_block + m_object_config->support_material_contact_distance_bottom.value);
layer_new.bottom_z = layer.print_z;
layer_new.idx_object_layer_below = layer_id;
layer_new.bridging = ! m_slicing_params.soluble_interface;
@@ -1534,6 +1538,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
}
}
}
+
#ifdef SLIC3R_DEBUG
Slic3r::SVG::export_expolygons(
debug_out_path("support-bottom-contacts-%d-%lf.svg", iRun, layer_new.print_z),
@@ -1637,8 +1642,8 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
std::reverse(bottom_contacts.begin(), bottom_contacts.end());
// trim_support_layers_by_object(object, bottom_contacts, 0., 0., m_gap_xy);
trim_support_layers_by_object(object, bottom_contacts,
- m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value,
- m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value, m_gap_xy);
+ m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance_top.value,
+ m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance_bottom.value, m_gap_xy);
} // ! top_contacts.empty()
@@ -1801,9 +1806,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int
assert(extr2->print_z >= m_slicing_params.first_print_layer_height + m_support_layer_height_min - EPSILON);
if (intermediate_layers.empty() || intermediate_layers.back()->print_z < m_slicing_params.first_print_layer_height) {
MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
- layer_new.bottom_z = 0.;
- layer_new.print_z = m_slicing_params.first_print_layer_height;
- layer_new.height = m_slicing_params.first_print_layer_height;
+ layer_new.bottom_z = 0.;
+ layer_new.print_z = m_slicing_params.first_print_layer_height;
+ layer_new.height = m_slicing_params.first_print_layer_height;
+ layer_new.height_block = layer_new.height;
intermediate_layers.push_back(&layer_new);
}
continue;
@@ -1823,9 +1829,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int
assert(extr2z >= m_slicing_params.first_print_layer_height + EPSILON);
// Generate a new intermediate layer.
MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
- layer_new.bottom_z = 0.;
- layer_new.print_z = extr1z = m_slicing_params.first_print_layer_height;
- layer_new.height = extr1z;
+ layer_new.bottom_z = 0.;
+ layer_new.print_z = extr1z = m_slicing_params.first_print_layer_height;
+ layer_new.height = extr1z;
+ layer_new.height_block = layer_new.height;
intermediate_layers.push_back(&layer_new);
// Continue printing the other layers up to extr2z.
}
@@ -1842,18 +1849,20 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int
++ idx_layer_object;
if (idx_layer_object == 0 && extr1z == m_slicing_params.raft_interface_top_z) {
// Insert one base support layer below the object.
- MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
- layer_new.print_z = m_slicing_params.object_print_z_min;
- layer_new.bottom_z = m_slicing_params.raft_interface_top_z;
- layer_new.height = layer_new.print_z - layer_new.bottom_z;
+ MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
+ layer_new.print_z = m_slicing_params.object_print_z_min;
+ layer_new.bottom_z = m_slicing_params.raft_interface_top_z;
+ layer_new.height = layer_new.print_z - layer_new.bottom_z;
+ layer_new.height_block = layer_new.height;
intermediate_layers.push_back(&layer_new);
}
// Emit all intermediate support layers synchronized with object layers up to extr2z.
for (; idx_layer_object < object.layers().size() && object.layers()[idx_layer_object]->print_z < extr2z + EPSILON; ++ idx_layer_object) {
- MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
- layer_new.print_z = object.layers()[idx_layer_object]->print_z;
- layer_new.height = object.layers()[idx_layer_object]->height;
- layer_new.bottom_z = (idx_layer_object > 0) ? object.layers()[idx_layer_object - 1]->print_z : (layer_new.print_z - layer_new.height);
+ MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
+ layer_new.print_z = object.layers()[idx_layer_object]->print_z;
+ layer_new.height = object.layers()[idx_layer_object]->height;
+ layer_new.height_block = layer_new.height;
+ layer_new.bottom_z = (idx_layer_object > 0) ? object.layers()[idx_layer_object - 1]->print_z : (layer_new.print_z - layer_new.height);
assert(intermediate_layers.empty() || intermediate_layers.back()->print_z < layer_new.print_z + EPSILON);
intermediate_layers.push_back(&layer_new);
}
@@ -1868,10 +1877,11 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int
// between the 1st intermediate layer print_z and extr1->print_z is not too small.
assert(extr1->bottom_z + m_support_layer_height_min < extr1->print_z + EPSILON);
// Generate the first intermediate layer.
- MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
- layer_new.bottom_z = extr1->bottom_z;
- layer_new.print_z = extr1z = extr1->print_z;
- layer_new.height = extr1->height;
+ MyLayer &layer_new = layer_allocate(layer_storage, sltIntermediate);
+ layer_new.bottom_z = extr1->bottom_z;
+ layer_new.print_z = extr1z = extr1->print_z;
+ layer_new.height = extr1->height;
+ layer_new.height_block = layer_new.height;
intermediate_layers.push_back(&layer_new);
dist = extr2z - extr1z;
n_layers_extra = size_t(ceil(dist / m_slicing_params.max_suport_layer_height));
@@ -1898,12 +1908,14 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int
layer_new.bottom_z = (i == 0) ? extr1z : intermediate_layers.back()->print_z;
layer_new.print_z = extr2z_large_steps;
layer_new.height = layer_new.print_z - layer_new.bottom_z;
+ layer_new.height_block = layer_new.height;
}
else {
// Intermediate layer, not the last added.
layer_new.height = step;
layer_new.bottom_z = extr1z + i * step;
layer_new.print_z = layer_new.bottom_z + step;
+ layer_new.height_block = layer_new.height;
}
assert(intermediate_layers.empty() || intermediate_layers.back()->print_z <= layer_new.print_z);
intermediate_layers.push_back(&layer_new);
@@ -2059,8 +2071,8 @@ void PrintObjectSupportMaterial::generate_base_layers(
// trim_support_layers_by_object(object, intermediate_layers, 0., 0., m_gap_xy);
this->trim_support_layers_by_object(object, intermediate_layers,
- m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value,
- m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance.value, m_gap_xy);
+ m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance_top.value,
+ m_slicing_params.soluble_interface ? 0. : m_object_config->support_material_contact_distance_bottom.value, m_gap_xy);
}
void PrintObjectSupportMaterial::trim_support_layers_by_object(
@@ -2094,7 +2106,7 @@ void PrintObjectSupportMaterial::trim_support_layers_by_object(
// BOOST_LOG_TRIVIAL(trace) << "Support generator - trim_support_layers_by_object - trimmming non-empty layer " << idx_layer << " of " << nonempty_layers.size();
assert(! support_layer.polygons.empty() && support_layer.print_z >= m_slicing_params.raft_contact_top_z + EPSILON);
// Find the overlapping object layers including the extra above / below gap.
- coordf_t z_threshold = support_layer.print_z - support_layer.height - gap_extra_below + EPSILON;
+ coordf_t z_threshold = support_layer.print_z - support_layer.height_block - gap_extra_below + EPSILON;
idx_object_layer_overlapping = idx_higher_or_equal(
object.layers(), idx_object_layer_overlapping,
[z_threshold](const Layer *layer){ return layer->print_z >= z_threshold; });
@@ -2107,13 +2119,15 @@ void PrintObjectSupportMaterial::trim_support_layers_by_object(
break;
polygons_append(polygons_trimming, offset(object_layer.slices.expolygons, gap_xy_scaled, SUPPORT_SURFACES_OFFSET_PARAMETERS));
}
- if (! m_slicing_params.soluble_interface) {
+ if (!m_slicing_params.soluble_interface) {
// Collect all bottom surfaces, which will be extruded with a bridging flow.
for (; i < object.layers().size(); ++ i) {
const Layer &object_layer = *object.layers()[i];
bool some_region_overlaps = false;
for (LayerRegion *region : object_layer.regions()) {
- coordf_t bridging_height = region->region()->bridging_height_avg(*this->m_print_config);
+ coordf_t bridging_height = m_object_config->support_material_contact_distance_type == zdFilament
+ ? region->region()->bridging_height_avg(*this->m_print_config)
+ : object_layer.height;
if (object_layer.print_z - bridging_height > support_layer.print_z + gap_extra_above - EPSILON)
break;
some_region_overlaps = true;
@@ -3101,7 +3115,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
size_t idx_layer_top_contact = size_t(-1);
size_t idx_layer_intermediate = size_t(-1);
size_t idx_layer_inteface = size_t(-1);
- std::unique_ptr<Fill> filler_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_slicing_params.soluble_interface ? ipConcentricGapFill : ipRectilinear));
+ std::unique_ptr<Fill> filler_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_slicing_params.soluble_interface ? ipRectilinear : ipRectilinear));
std::unique_ptr<Fill> filler_support = std::unique_ptr<Fill>(Fill::new_from_type(infill_pattern));
std::unique_ptr<Fill> filler_solid = std::unique_ptr<Fill>(Fill::new_from_type(ipRectiWithPerimeter));
filler_interface->set_bounding_box(bbox_object);
@@ -3180,7 +3194,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
layer_ex.layer->bridging);
Fill *filler = filler_interface.get();
float density = interface_density;
- //if first alyer and solid first layer : draw concentric with 100% density
+ //if first layer and solid first layer : draw concentric with 100% density
if (support_layer.id() == 0 && this->m_object_config->support_material_solid_first_layer.value) {
filler = filler_solid.get();
density = 1.f;
diff --git a/src/libslic3r/SupportMaterial.hpp b/src/libslic3r/SupportMaterial.hpp
index 2e1a05946..743fccc40 100644
--- a/src/libslic3r/SupportMaterial.hpp
+++ b/src/libslic3r/SupportMaterial.hpp
@@ -52,11 +52,12 @@ public:
class MyLayer
{
public:
- MyLayer() :
- layer_type(sltUnknown),
- print_z(0.),
- bottom_z(0.),
- height(0.),
+ MyLayer() :
+ layer_type(sltUnknown),
+ print_z(0.),
+ bottom_z(0.),
+ height(0.),
+ height_block(0.),
idx_object_layer_above(size_t(-1)),
idx_object_layer_below(size_t(-1)),
bridging(false),
@@ -77,6 +78,7 @@ public:
print_z = 0.;
bottom_z = 0.;
height = 0.;
+ height_block = 0.;
idx_object_layer_above = size_t(-1);
idx_object_layer_below = size_t(-1);
bridging = false;
@@ -119,9 +121,11 @@ public:
coordf_t print_z;
// Bottom Z of this layer. For soluble layers, bottom_z + height = print_z,
// otherwise bottom_z + gap + height = print_z.
- coordf_t bottom_z;
- // Layer height in unscaled coordinates.
- coordf_t height;
+ coordf_t bottom_z;
+ // Layer height in unscaled coordinates.
+ coordf_t height;
+ // Layer height for collision in unscaled coordinates.
+ coordf_t height_block;
// Index of a PrintObject layer_id supported by this layer. This will be set for top contact layers.
// If this is not a contact layer, it will be set to size_t(-1).
size_t idx_object_layer_above;
diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp
index 501d1f1bc..8b84ef1df 100644
--- a/src/slic3r/GUI/Field.cpp
+++ b/src/slic3r/GUI/Field.cpp
@@ -718,6 +718,8 @@ boost::any& Choice::get_value()
m_value = static_cast<PrintHostType>(ret_enum);
else if (m_opt_id.compare("infill_dense_algo") == 0)
m_value = static_cast<DenseInfillAlgo>(ret_enum);
+ else if (m_opt_id.compare("support_material_contact_distance_type") == 0)
+ m_value = static_cast<SupportZDistanceType>(ret_enum);
else if (m_opt_id.compare("display_orientation") == 0)
m_value = static_cast<SLADisplayOrientation>(ret_enum);
}
diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp
index 58fb0dc5e..186fcb110 100644
--- a/src/slic3r/GUI/GUI.cpp
+++ b/src/slic3r/GUI/GUI.cpp
@@ -198,6 +198,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
else if (opt_key.compare("infill_dense_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<DenseInfillAlgo>(boost::any_cast<DenseInfillAlgo>(value)));
+ else if (opt_key.compare("support_material_contact_distance_type") == 0)
+ config.set_key_value(opt_key, new ConfigOptionEnum<SupportZDistanceType>(boost::any_cast<SupportZDistanceType>(value)));
else if (opt_key.compare("display_orientation") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value)));
}
diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp
index c5a85e3a6..52edb4493 100644
--- a/src/slic3r/GUI/OptionsGroup.cpp
+++ b/src/slic3r/GUI/OptionsGroup.cpp
@@ -557,6 +557,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
else if (opt_key.compare("infill_dense_algo") == 0){
ret = static_cast<int>(config.option<ConfigOptionEnum<DenseInfillAlgo>>(opt_key)->value);
}
+ else if (opt_key.compare("support_material_contact_distance_type") == 0){
+ ret = static_cast<int>(config.option<ConfigOptionEnum<SupportZDistanceType>>(opt_key)->value);
+ }
else if (opt_key.compare("display_orientation") == 0) {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value);
}
diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp
index 84fae86b3..645ec6f41 100644
--- a/src/slic3r/GUI/Preset.cpp
+++ b/src/slic3r/GUI/Preset.cpp
@@ -186,7 +186,7 @@ void Preset::set_num_extruders(DynamicPrintConfig &config, unsigned int num_extr
continue;
auto *opt = config.option(key, false);
assert(opt != nullptr);
- assert(opt->is_vector());
+ //assert(opt->is_vector());
if (opt != nullptr && opt->is_vector())
static_cast<ConfigOptionVectorBase*>(opt)->resize(num_extruders, defaults.option(key));
}
@@ -332,8 +332,11 @@ const std::vector<std::string>& Preset::print_options()
"support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers",
"raft_layers", "support_material_pattern", "support_material_with_sheath", "support_material_spacing",
"support_material_synchronize_layers", "support_material_angle", "support_material_interface_layers",
- "support_material_interface_spacing", "support_material_interface_contact_loops", "support_material_contact_distance",
- "support_material_buildplate_only", "dont_support_bridges", "notes", "complete_objects", "extruder_clearance_radius",
+ "support_material_interface_spacing", "support_material_interface_contact_loops"
+ , "support_material_contact_distance_type"
+ , "support_material_contact_distance_top"
+ , "support_material_contact_distance_bottom"
+ , "support_material_buildplate_only", "dont_support_bridges", "notes", "complete_objects", "extruder_clearance_radius",
"extruder_clearance_height", "gcode_comments", "output_filename_format", "post_process", "perimeter_extruder",
"infill_extruder", "solid_infill_extruder", "support_material_extruder", "support_material_interface_extruder",
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp
index fa67a9b61..76e8e8143 100644
--- a/src/slic3r/GUI/Tab.cpp
+++ b/src/slic3r/GUI/Tab.cpp
@@ -1007,7 +1007,11 @@ void TabPrint::build()
// # optgroup->append_single_option_line(get_option_("raft_contact_distance");
optgroup = page->new_optgroup(_(L("Options for support material and raft")));
- optgroup->append_single_option_line("support_material_contact_distance");
+ line = { _(L("Z-offset")), "" };
+ line.append_option(optgroup->get_option("support_material_contact_distance_type"));
+ line.append_option(optgroup->get_option("support_material_contact_distance_top"));
+ line.append_option(optgroup->get_option("support_material_contact_distance_bottom"));
+ optgroup->append_line(line);
optgroup->append_single_option_line("support_material_pattern");
optgroup->append_single_option_line("support_material_with_sheath");
optgroup->append_single_option_line("support_material_spacing");
@@ -1221,7 +1225,7 @@ void TabPrint::update()
}
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
- m_config->opt_float("support_material_contact_distance") > 0. &&
+ ((ConfigOptionEnumGeneric*)m_config->option("support_material_contact_distance_type"))->value != zdNone &&
(m_config->opt_int("support_material_extruder") != 0 || m_config->opt_int("support_material_interface_extruder") != 0)) {
wxString msg_text = _(L("The Wipe Tower currently supports the non-soluble supports only\n"
"if they are printed with the current extruder without triggering a tool change.\n"
@@ -1239,7 +1243,7 @@ void TabPrint::update()
}
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
- m_config->opt_float("support_material_contact_distance") == 0 &&
+ ((ConfigOptionEnumGeneric*)m_config->option("support_material_contact_distance_type"))->value == zdNone &&
!m_config->opt_bool("support_material_synchronize_layers")) {
wxString msg_text = _(L("For the Wipe Tower to work with the soluble supports, the support layers\n"
"need to be synchronized with the object layers.\n"
@@ -1390,13 +1394,17 @@ void TabPrint::update()
bool have_support_material = m_config->opt_bool("support_material") || have_raft;
bool have_support_material_auto = have_support_material && m_config->opt_bool("support_material_auto");
bool have_support_interface = m_config->opt_int("support_material_interface_layers") > 0;
- bool have_support_soluble = have_support_material && m_config->opt_float("support_material_contact_distance") == 0;
+ bool have_support_soluble = have_support_material && ((ConfigOptionEnumGeneric*)m_config->option("support_material_contact_distance_type"))->value == zdNone;
for (auto el : {"support_material_pattern", "support_material_with_sheath",
"support_material_spacing", "support_material_angle", "support_material_interface_layers",
- "dont_support_bridges", "support_material_extrusion_width", "support_material_contact_distance",
+ "dont_support_bridges", "support_material_extrusion_width",
+ "support_material_contact_distance_type",
"support_material_xy_spacing" })
get_field(el)->toggle(have_support_material);
- get_field("support_material_threshold")->toggle(have_support_material_auto);
+ get_field("support_material_threshold")->toggle(have_support_material_auto);
+ for (auto el : { "support_material_contact_distance_top",
+ "support_material_contact_distance_bottom"})
+ get_field(el)->toggle(have_support_material && !have_support_soluble);
for (auto el : {"support_material_interface_spacing", "support_material_interface_extruder",
"support_material_interface_speed", "support_material_interface_contact_loops" })