ENH: add grid & rectilinear_interlaced interface pattern
Github: #1018, #1221 Jira: STUDIO-2534 Change-Id: I8c766b5b934364253c0344e39f474e4ac3b81add (cherry picked from commit e7d46fe60856ab511905b46799943bfde8a71826)
This commit is contained in:
parent
9309831d26
commit
af0fca211b
|
@ -1636,11 +1636,13 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector<const Po
|
||||||
double arc_length;
|
double arc_length;
|
||||||
};
|
};
|
||||||
std::vector<Arc> arches;
|
std::vector<Arc> arches;
|
||||||
arches.reserve(graph.map_infill_end_point_to_boundary.size());
|
if (!params.dont_sort) {
|
||||||
for (ContourIntersectionPoint &cp : graph.map_infill_end_point_to_boundary)
|
arches.reserve(graph.map_infill_end_point_to_boundary.size());
|
||||||
if (cp.contour_idx != boundary_idx_unconnected && cp.next_on_contour != &cp && cp.could_connect_next())
|
for (ContourIntersectionPoint& cp : graph.map_infill_end_point_to_boundary)
|
||||||
arches.push_back({ &cp, path_length_along_contour_ccw(&cp, cp.next_on_contour, graph.boundary_params[cp.contour_idx].back()) });
|
if (cp.contour_idx != boundary_idx_unconnected && cp.next_on_contour != &cp && cp.could_connect_next())
|
||||||
std::sort(arches.begin(), arches.end(), [](const auto &l, const auto &r) { return l.arc_length < r.arc_length; });
|
arches.push_back({ &cp, path_length_along_contour_ccw(&cp, cp.next_on_contour, graph.boundary_params[cp.contour_idx].back()) });
|
||||||
|
std::sort(arches.begin(), arches.end(), [](const auto& l, const auto& r) { return l.arc_length < r.arc_length; });
|
||||||
|
}
|
||||||
|
|
||||||
//FIXME improve the Traveling Salesman problem with 2-opt and 3-opt local optimization.
|
//FIXME improve the Traveling Salesman problem with 2-opt and 3-opt local optimization.
|
||||||
for (Arc &arc : arches)
|
for (Arc &arc : arches)
|
||||||
|
|
|
@ -76,6 +76,7 @@ struct FillParams
|
||||||
bool using_internal_flow{ false };
|
bool using_internal_flow{ false };
|
||||||
//BBS: only used for new top surface pattern
|
//BBS: only used for new top surface pattern
|
||||||
float no_extrusion_overlap{ 0.0 };
|
float no_extrusion_overlap{ 0.0 };
|
||||||
|
bool dont_sort{ false }; // do not sort the lines, just simply connect them
|
||||||
};
|
};
|
||||||
static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
|
static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,9 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SupportMaterialStyle)
|
||||||
static t_config_enum_values s_keys_map_SupportMaterialInterfacePattern {
|
static t_config_enum_values s_keys_map_SupportMaterialInterfacePattern {
|
||||||
{ "auto", smipAuto },
|
{ "auto", smipAuto },
|
||||||
{ "rectilinear", smipRectilinear },
|
{ "rectilinear", smipRectilinear },
|
||||||
{ "concentric", smipConcentric }
|
{ "concentric", smipConcentric },
|
||||||
|
{ "rectilinear_interlaced", smipRectilinearInterlaced},
|
||||||
|
{ "grid", smipGrid }
|
||||||
};
|
};
|
||||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SupportMaterialInterfacePattern)
|
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SupportMaterialInterfacePattern)
|
||||||
|
|
||||||
|
@ -2634,9 +2636,13 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->enum_values.push_back("auto");
|
def->enum_values.push_back("auto");
|
||||||
def->enum_values.push_back("rectilinear");
|
def->enum_values.push_back("rectilinear");
|
||||||
def->enum_values.push_back("concentric");
|
def->enum_values.push_back("concentric");
|
||||||
|
def->enum_values.push_back("rectilinear_interlaced");
|
||||||
|
def->enum_values.push_back("grid");
|
||||||
def->enum_labels.push_back(L("Default"));
|
def->enum_labels.push_back(L("Default"));
|
||||||
def->enum_labels.push_back(L("Rectilinear"));
|
def->enum_labels.push_back(L("Rectilinear"));
|
||||||
def->enum_labels.push_back(L("Concentric"));
|
def->enum_labels.push_back(L("Concentric"));
|
||||||
|
def->enum_labels.push_back(L("Rectilinear Interlaced"));
|
||||||
|
def->enum_labels.push_back(L("Grid"));
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionEnum<SupportMaterialInterfacePattern>(smipRectilinear));
|
def->set_default_value(new ConfigOptionEnum<SupportMaterialInterfacePattern>(smipRectilinear));
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ enum SupportMaterialStyle {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SupportMaterialInterfacePattern {
|
enum SupportMaterialInterfacePattern {
|
||||||
smipAuto, smipRectilinear, smipConcentric,
|
smipAuto, smipRectilinear, smipConcentric, smipRectilinearInterlaced, smipGrid
|
||||||
};
|
};
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
|
|
|
@ -412,7 +412,12 @@ PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object
|
||||||
support_pattern == smpHoneycomb ? ipHoneycomb :
|
support_pattern == smpHoneycomb ? ipHoneycomb :
|
||||||
m_support_params.support_density > 0.95 || m_support_params.with_sheath ? ipRectilinear : ipSupportBase;
|
m_support_params.support_density > 0.95 || m_support_params.with_sheath ? ipRectilinear : ipSupportBase;
|
||||||
m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
|
m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
|
||||||
m_support_params.contact_fill_pattern =
|
if (m_object_config->support_interface_pattern == smipGrid)
|
||||||
|
m_support_params.contact_fill_pattern = ipGrid;
|
||||||
|
else if (m_object_config->support_interface_pattern == smipRectilinearInterlaced)
|
||||||
|
m_support_params.contact_fill_pattern = ipRectilinear;
|
||||||
|
else
|
||||||
|
m_support_params.contact_fill_pattern =
|
||||||
(m_object_config->support_interface_pattern == smipAuto && m_slicing_params.soluble_interface) ||
|
(m_object_config->support_interface_pattern == smipAuto && m_slicing_params.soluble_interface) ||
|
||||||
m_object_config->support_interface_pattern == smipConcentric ?
|
m_object_config->support_interface_pattern == smipConcentric ?
|
||||||
ipConcentric :
|
ipConcentric :
|
||||||
|
@ -3642,7 +3647,6 @@ static inline void fill_expolygon_generate_paths(
|
||||||
ExPolygon &&expolygon,
|
ExPolygon &&expolygon,
|
||||||
Fill *filler,
|
Fill *filler,
|
||||||
const FillParams &fill_params,
|
const FillParams &fill_params,
|
||||||
float density,
|
|
||||||
ExtrusionRole role,
|
ExtrusionRole role,
|
||||||
const Flow &flow)
|
const Flow &flow)
|
||||||
{
|
{
|
||||||
|
@ -3664,12 +3668,11 @@ static inline void fill_expolygons_generate_paths(
|
||||||
ExPolygons &&expolygons,
|
ExPolygons &&expolygons,
|
||||||
Fill *filler,
|
Fill *filler,
|
||||||
const FillParams &fill_params,
|
const FillParams &fill_params,
|
||||||
float density,
|
|
||||||
ExtrusionRole role,
|
ExtrusionRole role,
|
||||||
const Flow &flow)
|
const Flow &flow)
|
||||||
{
|
{
|
||||||
for (ExPolygon &expoly : expolygons)
|
for (ExPolygon &expoly : expolygons)
|
||||||
fill_expolygon_generate_paths(dst, std::move(expoly), filler, fill_params, density, role, flow);
|
fill_expolygon_generate_paths(dst, std::move(expoly), filler, fill_params, role, flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void fill_expolygons_generate_paths(
|
static inline void fill_expolygons_generate_paths(
|
||||||
|
@ -3683,7 +3686,7 @@ static inline void fill_expolygons_generate_paths(
|
||||||
FillParams fill_params;
|
FillParams fill_params;
|
||||||
fill_params.density = density;
|
fill_params.density = density;
|
||||||
fill_params.dont_adjust = true;
|
fill_params.dont_adjust = true;
|
||||||
fill_expolygons_generate_paths(dst, std::move(expolygons), filler, fill_params, density, role, flow);
|
fill_expolygons_generate_paths(dst, std::move(expolygons), filler, fill_params, role, flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void fill_expolygons_with_sheath_generate_paths(
|
static inline void fill_expolygons_with_sheath_generate_paths(
|
||||||
|
@ -3731,7 +3734,7 @@ static inline void fill_expolygons_with_sheath_generate_paths(
|
||||||
}
|
}
|
||||||
extrusion_entities_append_paths(out, polylines, erSupportMaterial, flow.mm3_per_mm(), flow.width(), flow.height());
|
extrusion_entities_append_paths(out, polylines, erSupportMaterial, flow.mm3_per_mm(), flow.width(), flow.height());
|
||||||
// Fill in the rest.
|
// Fill in the rest.
|
||||||
fill_expolygons_generate_paths(out, offset_ex(expoly, float(-0.4 * spacing)), filler, fill_params, density, role, flow);
|
fill_expolygons_generate_paths(out, offset_ex(expoly, float(-0.4 * spacing)), filler, fill_params, role, flow);
|
||||||
if (no_sort && ! eec->empty())
|
if (no_sort && ! eec->empty())
|
||||||
dst.emplace_back(eec.release());
|
dst.emplace_back(eec.release());
|
||||||
}
|
}
|
||||||
|
@ -4581,13 +4584,23 @@ void PrintObjectSupportMaterial::generate_toolpaths(
|
||||||
double density = interface_as_base ? m_support_params.support_density : m_support_params.interface_density;
|
double density = interface_as_base ? m_support_params.support_density : m_support_params.interface_density;
|
||||||
filler_interface->spacing = interface_as_base ? m_support_params.support_material_flow.spacing() : m_support_params.support_material_interface_flow.spacing();
|
filler_interface->spacing = interface_as_base ? m_support_params.support_material_flow.spacing() : m_support_params.support_material_interface_flow.spacing();
|
||||||
filler_interface->link_max_length = coord_t(scale_(filler_interface->spacing * link_max_length_factor / density));
|
filler_interface->link_max_length = coord_t(scale_(filler_interface->spacing * link_max_length_factor / density));
|
||||||
|
// BBS support more interface patterns
|
||||||
|
FillParams fill_params;
|
||||||
|
fill_params.density = density;
|
||||||
|
fill_params.dont_adjust = true;
|
||||||
|
if (m_object_config->support_interface_pattern == smipGrid) {
|
||||||
|
filler_interface->angle = Geometry::deg2rad(m_support_params.base_angle);
|
||||||
|
fill_params.dont_sort = true;
|
||||||
|
}
|
||||||
|
if (m_object_config->support_interface_pattern == smipRectilinearInterlaced)
|
||||||
|
filler_interface->layer_id = support_layer.interface_id();
|
||||||
fill_expolygons_generate_paths(
|
fill_expolygons_generate_paths(
|
||||||
// Destination
|
// Destination
|
||||||
layer_ex.extrusions,
|
layer_ex.extrusions,
|
||||||
// Regions to fill
|
// Regions to fill
|
||||||
union_safety_offset_ex(layer_ex.polygons_to_extrude()),
|
union_safety_offset_ex(layer_ex.polygons_to_extrude()),
|
||||||
// Filler and its parameters
|
// Filler and its parameters
|
||||||
filler_interface.get(), float(density),
|
filler_interface.get(), fill_params,
|
||||||
// Extrusion parameters
|
// Extrusion parameters
|
||||||
erSupportMaterialInterface, interface_flow);
|
erSupportMaterialInterface, interface_flow);
|
||||||
}
|
}
|
||||||
|
|
|
@ -698,10 +698,15 @@ TreeSupport::TreeSupport(PrintObject& object, const SlicingParameters &slicing_p
|
||||||
ipSupportBase;
|
ipSupportBase;
|
||||||
|
|
||||||
m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
|
m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
|
||||||
m_support_params.contact_fill_pattern = (m_object_config->support_interface_pattern == smipAuto && m_slicing_params.soluble_interface) ||
|
if (m_object_config->support_interface_pattern == smipGrid)
|
||||||
m_object_config->support_interface_pattern == smipConcentric ?
|
m_support_params.contact_fill_pattern = ipGrid;
|
||||||
ipConcentric :
|
else if (m_object_config->support_interface_pattern == smipRectilinearInterlaced)
|
||||||
(m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
|
m_support_params.contact_fill_pattern = ipRectilinear;
|
||||||
|
else
|
||||||
|
m_support_params.contact_fill_pattern = (m_object_config->support_interface_pattern == smipAuto && m_slicing_params.soluble_interface) ||
|
||||||
|
m_object_config->support_interface_pattern == smipConcentric ?
|
||||||
|
ipConcentric :
|
||||||
|
(m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
|
||||||
m_support_params.support_extrusion_width = m_object_config->support_line_width.value > 0 ? m_object_config->support_line_width : m_object_config->line_width;
|
m_support_params.support_extrusion_width = m_object_config->support_line_width.value > 0 ? m_object_config->support_line_width : m_object_config->line_width;
|
||||||
is_slim = is_tree_slim(support_type, support_style);
|
is_slim = is_tree_slim(support_type, support_style);
|
||||||
MAX_BRANCH_RADIUS = 10.0;
|
MAX_BRANCH_RADIUS = 10.0;
|
||||||
|
@ -1573,6 +1578,12 @@ void TreeSupport::generate_toolpaths()
|
||||||
// roof_areas
|
// roof_areas
|
||||||
fill_params.density = interface_density;
|
fill_params.density = interface_density;
|
||||||
filler_interface->spacing = m_support_material_interface_flow.spacing();
|
filler_interface->spacing = m_support_material_interface_flow.spacing();
|
||||||
|
if (m_object_config->support_interface_pattern == smipGrid) {
|
||||||
|
filler_interface->angle = Geometry::deg2rad(object_config.support_angle.value);
|
||||||
|
fill_params.dont_sort = true;
|
||||||
|
}
|
||||||
|
if (m_object_config->support_interface_pattern == smipRectilinearInterlaced)
|
||||||
|
filler_interface->layer_id = round(area_group.dist_to_top / ts_layer->height);
|
||||||
fill_expolygons_generate_paths(ts_layer->support_fills.entities, std::move(polys), filler_interface.get(), fill_params, erSupportMaterialInterface,
|
fill_expolygons_generate_paths(ts_layer->support_fills.entities, std::move(polys), filler_interface.get(), fill_params, erSupportMaterialInterface,
|
||||||
m_support_material_interface_flow);
|
m_support_material_interface_flow);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue