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;