FIX: Rectilinear Interlaced pattern not working

Rectilinear Interlaced interface pattern not working for normal support.

jira: STUDIO-8847
github: #5307
Change-Id: Ia17c9a0f8f20e3ac7a98ce13b1ea5065c200ac3a
This commit is contained in:
Arthur 2024-11-25 11:40:33 +08:00 committed by lane.wei
parent 2dfb9a15f4
commit f65f5fc208
4 changed files with 47 additions and 43 deletions

View File

@ -1424,6 +1424,11 @@ void generate_support_toolpaths(
if (config.support_base_pattern == smpRectilinearGrid)
angles.push_back(support_params.interface_angle);
std::vector<float> interface_angles;
if (config.support_interface_pattern == smipRectilinearInterlaced)
interface_angles.push_back(support_params.base_angle);
interface_angles.push_back(support_params.interface_angle);
BoundingBox bbox_object(Point(-scale_(1.), -scale_(1.0)), Point(scale_(1.), scale_(1.)));
// const coordf_t link_max_length_factor = 3.;
@ -1542,7 +1547,7 @@ void generate_support_toolpaths(
tbb::parallel_for(tbb::blocked_range<size_t>(n_raft_layers, support_layers.size()),
[&config, &slicing_params, &support_params, &support_layers, &bottom_contacts, &top_contacts, &intermediate_layers, &interface_layers, &base_interface_layers, &layer_caches, &loop_interface_processor,
&bbox_object, &angles, n_raft_layers, link_max_length_factor]
&bbox_object, &angles, &interface_angles, n_raft_layers, link_max_length_factor]
(const tbb::blocked_range<size_t>& range) {
// Indices of the 1st layer in their respective container at the support layer height.
size_t idx_layer_bottom_contact = size_t(-1);
@ -1577,8 +1582,6 @@ void generate_support_toolpaths(
{
SupportLayer &support_layer = *support_layers[support_layer_id];
LayerCache &layer_cache = layer_caches[support_layer_id];
const float support_interface_angle = (support_params.support_style == smsGrid || config.support_interface_pattern == smipRectilinear) ?
support_params.interface_angle : support_params.raft_interface_angle(support_layer.interface_id());
// Find polygons with the same print_z.
SupportGeneratorLayerExtruded &bottom_contact_layer = layer_cache.bottom_contact_layer;
@ -1662,13 +1665,10 @@ void generate_support_toolpaths(
(raft_contact ? &support_params.raft_interface_flow :
interface_as_base ? &support_params.support_material_flow : &support_params.support_material_interface_flow)
->with_height(float(layer_ex.layer->height));
filler->angle = interface_as_base ?
// If zero interface layers are configured, use the same angle as for the base layers.
angles[support_layer_id % angles.size()] :
// Use interface angle for the interface layers.
raft_contact ?
support_params.raft_interface_angle(support_layer.interface_id()) :
support_interface_angle;
// If zero interface layers are configured, use the same angle as for the base layers.
filler->angle = interface_as_base ? angles[support_layer_id % angles.size()] :
raft_contact ? support_params.raft_interface_angle(support_layer.interface_id()) :
interface_angles[support_layer_id % interface_angles.size()]; // Use interface angle for the interface layers.
double density = raft_contact ? support_params.raft_interface_density : interface_as_base ? support_params.support_density : support_params.interface_density;
filler->spacing = raft_contact ? support_params.raft_interface_flow.spacing() :
interface_as_base ? support_params.support_material_flow.spacing() : support_params.support_material_interface_flow.spacing();
@ -1697,7 +1697,7 @@ void generate_support_toolpaths(
// the bridging flow does not quite apply. Reduce the flow to area of an ellipse? (A = pi * a * b)
assert(! base_interface_layer.layer->bridging);
Flow interface_flow = support_params.support_material_flow.with_height(float(base_interface_layer.layer->height));
filler->angle = support_interface_angle;
filler->angle = interface_angles[(support_layer_id + 1) % interface_angles.size()]; // need to be the same as the interface layer above
filler->spacing = support_params.support_material_interface_flow.spacing();
filler->link_max_length = coord_t(scale_(filler->spacing * link_max_length_factor / support_params.interface_density));
fill_expolygons_generate_paths(

View File

@ -107,11 +107,41 @@ struct SupportParameters {
this->interface_density = this->support_density;
}
SupportMaterialPattern support_pattern = object_config.support_base_pattern;
support_style = object_config.support_style;
if (support_style != smsDefault) {
if ((support_style == smsSnug || support_style == smsGrid) && is_tree(object_config.support_type)) support_style = smsDefault;
if ((support_style == smsTreeSlim || support_style == smsTreeStrong || support_style == smsTreeHybrid || support_style == smsTreeOrganic) &&
!is_tree(object_config.support_type))
support_style = smsDefault;
}
if (support_style == smsDefault) {
if (is_tree(object_config.support_type)) {
// organic support doesn't work with variable layer heights (including adaptive layer height and height range modifier, see #4313)
if (!object.has_variable_layer_heights && !slicing_params.soluble_interface) {
BOOST_LOG_TRIVIAL(warning) << "tree support default to organic support";
support_style = smsTreeOrganic;
} else {
BOOST_LOG_TRIVIAL(warning) << "tree support default to hybrid tree due to adaptive layer height";
support_style = smsTreeHybrid;
}
} else {
support_style = smsGrid;
}
}
support_base_pattern = object_config.support_base_pattern;
if (support_base_pattern == smpDefault) {
if (is_tree(object_config.support_type))
support_base_pattern = support_style == smsTreeHybrid ? smpRectilinear : smpNone;
else
support_base_pattern = smpRectilinear;
}
this->with_sheath = object_config.tree_support_wall_count > 0;
this->base_fill_pattern =
support_pattern == smpHoneycomb ? ipHoneycomb :
this->support_density > 0.95 || this->with_sheath ? ipRectilinear : ipSupportBase;
this->base_fill_pattern = support_base_pattern == smpLightning ? ipLightning :
support_base_pattern == smpHoneycomb ? ipHoneycomb :
this->support_density > 0.95 || this->with_sheath ? ipRectilinear :
ipSupportBase;
this->interface_fill_pattern = (this->interface_density > 0.95 ? ipRectilinear : ipSupportBase);
this->raft_interface_fill_pattern = this->raft_interface_density > 0.95 ? ipRectilinear : ipSupportBase;
if (object_config.support_interface_pattern == smipGrid)
@ -182,28 +212,6 @@ struct SupportParameters {
}
independent_layer_height = print_config.independent_support_layer_height;
support_style = object_config.support_style;
if (support_style != smsDefault) {
if ((support_style == smsSnug || support_style == smsGrid) && is_tree(object_config.support_type)) support_style = smsDefault;
if ((support_style == smsTreeSlim || support_style == smsTreeStrong || support_style == smsTreeHybrid || support_style == smsTreeOrganic) &&
!is_tree(object_config.support_type))
support_style = smsDefault;
}
if (support_style == smsDefault) {
if (is_tree(object_config.support_type)) {
// organic support doesn't work with variable layer heights (including adaptive layer height and height range modifier, see #4313)
if (!object.has_variable_layer_heights && !slicing_params.soluble_interface) {
BOOST_LOG_TRIVIAL(warning) << "tree support default to organic support";
support_style = smsTreeOrganic;
} else {
BOOST_LOG_TRIVIAL(warning) << "tree support default to hybrid tree due to adaptive layer height";
support_style = smsTreeHybrid;
}
} else {
support_style = smsGrid;
}
}
}
// Both top / bottom contacts and interfaces are soluble.
bool soluble_interface;
@ -255,6 +263,7 @@ struct SupportParameters {
coordf_t support_spacing;
coordf_t support_density;
SupportMaterialStyle support_style = smsDefault;
SupportMaterialPattern support_base_pattern = smpDefault;
InfillPattern base_fill_pattern;
InfillPattern interface_fill_pattern;

View File

@ -622,7 +622,7 @@ TreeSupport::TreeSupport(PrintObject& object, const SlicingParameters &slicing_p
is_strong = is_tree(support_type) && m_support_params.support_style == smsTreeStrong;
base_radius = std::max(MIN_BRANCH_RADIUS, m_object_config->tree_support_branch_diameter.value / 2);
// by default tree support needs no infill, unless it's tree hybrid which contains normal nodes.
with_infill = support_pattern != smpNone && support_pattern != smpDefault;
with_infill = m_support_params.support_base_pattern != smpNone;
m_machine_border.contour = get_bed_shape_with_excluded_area(*m_print_config);
Vec3d plate_offset = m_object->print()->get_plate_origin();
// align with the centered object in current plate (may not be the 1st plate, so need to add the plate offset)

View File

@ -72,7 +72,6 @@ struct TreeSupportMeshGroupSettings {
this->support_floor_enable = config.support_interface_bottom_layers.value > 0;
this->support_floor_layers = config.support_interface_bottom_layers.value;
this->support_roof_pattern = config.support_interface_pattern;
this->support_pattern = config.support_base_pattern;
this->support_line_spacing = scaled<coord_t>(config.support_base_pattern_spacing.value);
this->support_wall_count = std::max(1, config.tree_support_wall_count.value); // at least 1 wall for organic tree support
this->support_roof_line_distance = scaled<coord_t>(config.support_interface_spacing.value) + this->support_roof_line_width;
@ -165,9 +164,6 @@ struct TreeSupportMeshGroupSettings {
// Support Roof Pattern (aka top interface)
// The pattern with which the roofs of the support are printed.
SupportMaterialInterfacePattern support_roof_pattern { smipAuto };
// Support Pattern
// The pattern of the support structures of the print. The different options available result in sturdy or easy to remove support.
SupportMaterialPattern support_pattern { smpRectilinear };
// Support Line Distance
// Distance between the printed support structure lines. This setting is calculated by the support density.
coord_t support_line_spacing { scaled<coord_t>(2.66 - 0.4) };
@ -283,7 +279,6 @@ struct TreeSupportSettings
// support_infill_angles(mesh_group_settings.support_infill_angles),
support_roof_angles(mesh_group_settings.support_roof_angles),
roof_pattern(mesh_group_settings.support_roof_pattern),
support_pattern(mesh_group_settings.support_pattern),
support_roof_line_width(mesh_group_settings.support_roof_line_width),
support_line_spacing(mesh_group_settings.support_line_spacing),
support_bottom_offset(mesh_group_settings.support_bottom_offset),