Put internal brim also inside objects when they have no infill. #2026

This commit is contained in:
Alessandro Ranellucci 2017-03-12 00:29:49 +01:00
parent f670ad6821
commit cf0021c101
3 changed files with 17 additions and 26 deletions

View File

@ -73,12 +73,6 @@ Print::clear_objects()
this->clear_regions(); this->clear_regions();
} }
PrintObject*
Print::get_object(size_t idx)
{
return objects.at(idx);
}
void void
Print::delete_object(size_t idx) Print::delete_object(size_t idx)
{ {
@ -919,10 +913,18 @@ Print::_make_brim()
if (this->config.interior_brim_width > 0) { if (this->config.interior_brim_width > 0) {
// collect all island holes to fill // collect all island holes to fill
Polygons holes; Polygons holes;
for (PrintObject* object : this->objects) { for (const PrintObject* object : this->objects) {
const Layer &layer0 = *object->get_layer(0); const Layer &layer0 = *object->get_layer(0);
const Polygons o_holes = layer0.slices.holes(); Polygons o_holes = layer0.slices.holes();
// When we have no infill on this layer, consider the internal part
// of the model as a hole.
for (const LayerRegion* layerm : layer0.regions) {
if (layerm->fills.empty())
append_to(o_holes, (Polygons)layerm->fill_surfaces);
}
for (const Point &copy : object->_shifted_copies) { for (const Point &copy : object->_shifted_copies) {
for (Polygon p : o_holes) { for (Polygon p : o_holes) {
p.translate(copy); p.translate(copy);
@ -937,9 +939,7 @@ Print::_make_brim()
append_to(loops, offset2( append_to(loops, offset2(
holes, holes,
-flow.scaled_spacing() * (i + 0.5), -flow.scaled_spacing() * (i + 0.5),
flow.scaled_spacing(), flow.scaled_spacing()
100000,
ClipperLib::jtSquare
)); ));
} }

View File

@ -118,14 +118,16 @@ class PrintObject
size_t total_layer_count() const; size_t total_layer_count() const;
size_t layer_count() const; size_t layer_count() const;
void clear_layers(); void clear_layers();
Layer* get_layer(int idx); Layer* get_layer(int idx) { return this->layers.at(idx); };
const Layer* get_layer(int idx) const { return this->layers.at(idx); };
// print_z: top of the layer; slice_z: center of the layer. // print_z: top of the layer; slice_z: center of the layer.
Layer* add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z); Layer* add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
void delete_layer(int idx); void delete_layer(int idx);
size_t support_layer_count() const; size_t support_layer_count() const;
void clear_support_layers(); void clear_support_layers();
SupportLayer* get_support_layer(int idx); SupportLayer* get_support_layer(int idx) { return this->support_layers.at(idx); };
const SupportLayer* get_support_layer(int idx) const { return this->support_layers.at(idx); };
SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z); SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z);
void delete_support_layer(int idx); void delete_support_layer(int idx);
@ -179,7 +181,8 @@ class Print
// methods for handling objects // methods for handling objects
void clear_objects(); void clear_objects();
PrintObject* get_object(size_t idx); PrintObject* get_object(size_t idx) { return this->objects.at(idx); };
const PrintObject* get_object(size_t idx) const { return this->objects.at(idx); };
void delete_object(size_t idx); void delete_object(size_t idx);
void reload_object(size_t idx); void reload_object(size_t idx);
bool reload_model_instances(); bool reload_model_instances();

View File

@ -166,12 +166,6 @@ PrintObject::clear_layers()
this->delete_layer(i); this->delete_layer(i);
} }
Layer*
PrintObject::get_layer(int idx)
{
return this->layers.at(idx);
}
Layer* Layer*
PrintObject::add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z) PrintObject::add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
{ {
@ -201,12 +195,6 @@ PrintObject::clear_support_layers()
this->delete_support_layer(i); this->delete_support_layer(i);
} }
SupportLayer*
PrintObject::get_support_layer(int idx)
{
return this->support_layers.at(idx);
}
SupportLayer* SupportLayer*
PrintObject::add_support_layer(int id, coordf_t height, coordf_t print_z) PrintObject::add_support_layer(int id, coordf_t height, coordf_t print_z)
{ {