FIX: Auto brim will not be considered during model arrange

if the brim of an object exceeds the bed area, it will be clipped before transformed to G-Codes

Change-Id: I68d700a85e1d28a5e337e53d614266f6e5e0a653
(cherry picked from commit d19ffaa7bdf4b0ab750119d9ef6252491d936f3e)
This commit is contained in:
wintergua 2022-11-11 15:46:22 +08:00 committed by Lane.Wei
parent bf24a71b60
commit 6dfd598b7f
6 changed files with 34 additions and 5 deletions

View file

@ -876,6 +876,8 @@ static ExPolygons outer_inner_brim_area(const Print& print,
brimToWrite.insert({ objectWithExtruder.first, {true,true} });
ExPolygons objectIslands;
auto bedPoly = Model::getBedPolygon();
auto bedExPoly = diff_ex((offset(bedPoly, scale_(30.), jtRound, SCALED_RESOLUTION)), { bedPoly });
for (unsigned int extruderNo : printExtruders) {
++extruderNo;
@ -1036,7 +1038,9 @@ static ExPolygons outer_inner_brim_area(const Print& print,
}
}
}
for (const PrintObject* object : print.objects())
if (!bedExPoly.empty())
no_brim_area.push_back(bedExPoly.front());
for (const PrintObject* object : print.objects())
if (brimAreaMap.find(object->id()) != brimAreaMap.end()) {
brimAreaMap[object->id()] = diff_ex(brimAreaMap[object->id()], no_brim_area);

View file

@ -2917,6 +2917,7 @@ double getTemperatureFromExtruder(const ModelVolumePtrs objectVolumes) {
double ModelInstance::get_auto_brim_width() const
{
return 0.;
double adhcoeff = getadhesionCoeff(object->volumes);
double DeltaT = getTemperatureFromExtruder(object->volumes);
// get auto brim width (Note even if the global brim_type=btOuterBrim, we can still go into this branch)

View file

@ -1212,6 +1212,7 @@ struct GlobalSpeedMap
double topSolidInfillSpeed;
double supportSpeed;
double maxSpeed;
Polygon bed_poly;
};
/* info in ModelDesignInfo can not changed after initialization */
@ -1307,6 +1308,7 @@ public:
static double findMaxSpeed(const ModelObject* object);
static double getThermalLength(const ModelVolume* modelVolumePtr);
static double getThermalLength(const std::vector<ModelVolume*> modelVolumePtrs);
static Polygon getBedPolygon() { return Model::printSpeedMap.bed_poly; }
// BBS: backup
static Model read_from_archive(

View file

@ -145,6 +145,7 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
// get brim width
auto obj = instance->get_object();
#if 0
ap.brim_width = instance->get_auto_brim_width();
auto brim_type_ptr = obj->get_config_value<ConfigOptionEnum<BrimType>>(config, "brim_type");
if (brim_type_ptr) {
@ -154,7 +155,9 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
else if (brim_type == btNoBrim)
ap.brim_width = 0;
}
#else
ap.brim_width = 0;
#endif
ap.height = obj->bounding_box().size().z();
ap.name = obj->name;

View file

@ -527,6 +527,12 @@ void ArrangeJob::process()
}
}
if (print.full_print_config().opt_bool("enable_support")) {
params.bed_shrink_x = std::max(5.f, params.bed_shrink_x);
params.bed_shrink_y = std::max(5.f, params.bed_shrink_y);
params.min_obj_distance = std::max(scaled(10.0), params.min_obj_distance);
}
// do not inflate brim_width. Objects are allowed to have overlapped brim.
std::for_each(m_selected.begin(), m_selected.end(), [&](auto& ap) {ap.inflation = params.min_obj_distance / 2; });
// For occulusion regions, inflation should be larger to prevent genrating brim on them.

View file

@ -2550,9 +2550,22 @@ void Plater::setPrintSpeedTable(GlobalSpeedMap &printSpeedMap) {
printSpeedMap.maxSpeed = printSpeedMap.supportSpeed;
}
/* "inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
"bridge_speed", "gap_infill_speed", "travel_speed", "initial_layer_speed"*/
auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
auto print_config = print.config();
printSpeedMap.bed_poly.points = get_bed_shape(*(wxGetApp().plater()->config()));
Pointfs excluse_area_points = print_config.bed_exclude_area.values;
Polygons exclude_polys;
Polygon exclude_poly;
for (int i = 0; i < excluse_area_points.size(); i++) {
auto pt = excluse_area_points[i];
exclude_poly.points.emplace_back(scale_(pt.x()), scale_(pt.y()));
if (i % 4 == 3) { // exclude areas are always rectangle
exclude_polys.push_back(exclude_poly);
exclude_poly.points.clear();
}
}
printSpeedMap.bed_poly = diff({ printSpeedMap.bed_poly }, exclude_polys)[0];
}
// find temperature of heatend and bed and matierial of an given extruder