Fixed a regression bug, which was made during the porting of
discover_horizontal_shells() fron Perl to C++, where the already calculated bridge direction was being lost. Improved constness of the debug methods void export_region_slices_to_svg(const char *path) const; void export_region_fill_surfaces_to_svg(const char *path) const;
This commit is contained in:
parent
630b746cab
commit
cd084a33c6
@ -161,7 +161,7 @@ void Layer::make_fills()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layer::export_region_slices_to_svg(const char *path)
|
void Layer::export_region_slices_to_svg(const char *path) const
|
||||||
{
|
{
|
||||||
BoundingBox bbox;
|
BoundingBox bbox;
|
||||||
for (LayerRegionPtrs::const_iterator region = this->regions.begin(); region != this->regions.end(); ++region)
|
for (LayerRegionPtrs::const_iterator region = this->regions.begin(); region != this->regions.end(); ++region)
|
||||||
@ -181,13 +181,13 @@ void Layer::export_region_slices_to_svg(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
||||||
void Layer::export_region_slices_to_svg_debug(const char *name)
|
void Layer::export_region_slices_to_svg_debug(const char *name) const
|
||||||
{
|
{
|
||||||
static size_t idx = 0;
|
static size_t idx = 0;
|
||||||
this->export_region_slices_to_svg(debug_out_path("Layer-slices-%s-%d.svg", name, idx ++).c_str());
|
this->export_region_slices_to_svg(debug_out_path("Layer-slices-%s-%d.svg", name, idx ++).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layer::export_region_fill_surfaces_to_svg(const char *path)
|
void Layer::export_region_fill_surfaces_to_svg(const char *path) const
|
||||||
{
|
{
|
||||||
BoundingBox bbox;
|
BoundingBox bbox;
|
||||||
for (LayerRegionPtrs::const_iterator region = this->regions.begin(); region != this->regions.end(); ++region)
|
for (LayerRegionPtrs::const_iterator region = this->regions.begin(); region != this->regions.end(); ++region)
|
||||||
@ -207,7 +207,7 @@ void Layer::export_region_fill_surfaces_to_svg(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
||||||
void Layer::export_region_fill_surfaces_to_svg_debug(const char *name)
|
void Layer::export_region_fill_surfaces_to_svg_debug(const char *name) const
|
||||||
{
|
{
|
||||||
static size_t idx = 0;
|
static size_t idx = 0;
|
||||||
this->export_region_fill_surfaces_to_svg(debug_out_path("Layer-fill_surfaces-%s-%d.svg", name, idx ++).c_str());
|
this->export_region_fill_surfaces_to_svg(debug_out_path("Layer-fill_surfaces-%s-%d.svg", name, idx ++).c_str());
|
||||||
|
@ -68,11 +68,11 @@ public:
|
|||||||
void process_external_surfaces(const Layer* lower_layer);
|
void process_external_surfaces(const Layer* lower_layer);
|
||||||
double infill_area_threshold() const;
|
double infill_area_threshold() const;
|
||||||
|
|
||||||
void export_region_slices_to_svg(const char *path);
|
void export_region_slices_to_svg(const char *path) const;
|
||||||
void export_region_fill_surfaces_to_svg(const char *path);
|
void export_region_fill_surfaces_to_svg(const char *path) const;
|
||||||
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
||||||
void export_region_slices_to_svg_debug(const char *name);
|
void export_region_slices_to_svg_debug(const char *name) const;
|
||||||
void export_region_fill_surfaces_to_svg_debug(const char *name);
|
void export_region_fill_surfaces_to_svg_debug(const char *name) const;
|
||||||
|
|
||||||
// Is there any valid extrusion assigned to this LayerRegion?
|
// Is there any valid extrusion assigned to this LayerRegion?
|
||||||
bool has_extrusions() const { return ! this->perimeters.entities.empty() || ! this->fills.entities.empty(); }
|
bool has_extrusions() const { return ! this->perimeters.entities.empty() || ! this->fills.entities.empty(); }
|
||||||
@ -129,11 +129,11 @@ public:
|
|||||||
void make_perimeters();
|
void make_perimeters();
|
||||||
void make_fills();
|
void make_fills();
|
||||||
|
|
||||||
void export_region_slices_to_svg(const char *path);
|
void export_region_slices_to_svg(const char *path) const;
|
||||||
void export_region_fill_surfaces_to_svg(const char *path);
|
void export_region_fill_surfaces_to_svg(const char *path) const;
|
||||||
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
||||||
void export_region_slices_to_svg_debug(const char *name);
|
void export_region_slices_to_svg_debug(const char *name) const;
|
||||||
void export_region_fill_surfaces_to_svg_debug(const char *name);
|
void export_region_fill_surfaces_to_svg_debug(const char *name) const;
|
||||||
|
|
||||||
// Is there any valid extrusion assigned to this LayerRegion?
|
// Is there any valid extrusion assigned to this LayerRegion?
|
||||||
virtual bool has_extrusions() const { for (auto layerm : this->regions) if (layerm->has_extrusions()) return true; return false; }
|
virtual bool has_extrusions() const { for (auto layerm : this->regions) if (layerm->has_extrusions()) return true; return false; }
|
||||||
|
@ -389,8 +389,7 @@ LayerRegion::infill_area_threshold() const
|
|||||||
return ss*ss;
|
return ss*ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayerRegion::export_region_slices_to_svg(const char *path) const
|
||||||
void LayerRegion::export_region_slices_to_svg(const char *path)
|
|
||||||
{
|
{
|
||||||
BoundingBox bbox;
|
BoundingBox bbox;
|
||||||
for (Surfaces::const_iterator surface = this->slices.surfaces.begin(); surface != this->slices.surfaces.end(); ++surface)
|
for (Surfaces::const_iterator surface = this->slices.surfaces.begin(); surface != this->slices.surfaces.end(); ++surface)
|
||||||
@ -410,14 +409,14 @@ void LayerRegion::export_region_slices_to_svg(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
||||||
void LayerRegion::export_region_slices_to_svg_debug(const char *name)
|
void LayerRegion::export_region_slices_to_svg_debug(const char *name) const
|
||||||
{
|
{
|
||||||
static std::map<std::string, size_t> idx_map;
|
static std::map<std::string, size_t> idx_map;
|
||||||
size_t &idx = idx_map[name];
|
size_t &idx = idx_map[name];
|
||||||
this->export_region_slices_to_svg(debug_out_path("LayerRegion-slices-%s-%d.svg", name, idx ++).c_str());
|
this->export_region_slices_to_svg(debug_out_path("LayerRegion-slices-%s-%d.svg", name, idx ++).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerRegion::export_region_fill_surfaces_to_svg(const char *path)
|
void LayerRegion::export_region_fill_surfaces_to_svg(const char *path) const
|
||||||
{
|
{
|
||||||
BoundingBox bbox;
|
BoundingBox bbox;
|
||||||
for (Surfaces::const_iterator surface = this->fill_surfaces.surfaces.begin(); surface != this->fill_surfaces.surfaces.end(); ++surface)
|
for (Surfaces::const_iterator surface = this->fill_surfaces.surfaces.begin(); surface != this->fill_surfaces.surfaces.end(); ++surface)
|
||||||
@ -428,16 +427,16 @@ void LayerRegion::export_region_fill_surfaces_to_svg(const char *path)
|
|||||||
|
|
||||||
SVG svg(path, bbox);
|
SVG svg(path, bbox);
|
||||||
const float transparency = 0.5f;
|
const float transparency = 0.5f;
|
||||||
for (Surfaces::const_iterator surface = this->fill_surfaces.surfaces.begin(); surface != this->fill_surfaces.surfaces.end(); ++surface) {
|
for (const Surface &surface : this->fill_surfaces.surfaces) {
|
||||||
svg.draw(surface->expolygon, surface_type_to_color_name(surface->surface_type), transparency);
|
svg.draw(surface.expolygon, surface_type_to_color_name(surface.surface_type), transparency);
|
||||||
svg.draw_outline(surface->expolygon, "black", "blue", scale_(0.05));
|
svg.draw_outline(surface.expolygon, "black", "blue", scale_(0.05));
|
||||||
}
|
}
|
||||||
export_surface_type_legend_to_svg(svg, legend_pos);
|
export_surface_type_legend_to_svg(svg, legend_pos);
|
||||||
svg.Close();
|
svg.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
// Export to "out/LayerRegion-name-%d.svg" with an increasing index with every export.
|
||||||
void LayerRegion::export_region_fill_surfaces_to_svg_debug(const char *name)
|
void LayerRegion::export_region_fill_surfaces_to_svg_debug(const char *name) const
|
||||||
{
|
{
|
||||||
static std::map<std::string, size_t> idx_map;
|
static std::map<std::string, size_t> idx_map;
|
||||||
size_t &idx = idx_map[name];
|
size_t &idx = idx_map[name];
|
||||||
|
@ -314,7 +314,7 @@ void PrintObject::_prepare_infill()
|
|||||||
|
|
||||||
// Debugging output.
|
// Debugging output.
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id)
|
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id) {
|
||||||
for (const Layer *layer : this->layers) {
|
for (const Layer *layer : this->layers) {
|
||||||
LayerRegion *layerm = layer->regions[region_id];
|
LayerRegion *layerm = layer->regions[region_id];
|
||||||
layerm->export_region_slices_to_svg_debug("6_discover_vertical_shells-final");
|
layerm->export_region_slices_to_svg_debug("6_discover_vertical_shells-final");
|
||||||
@ -332,7 +332,7 @@ void PrintObject::_prepare_infill()
|
|||||||
this->discover_horizontal_shells();
|
this->discover_horizontal_shells();
|
||||||
|
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id)
|
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id) {
|
||||||
for (const Layer *layer : this->layers) {
|
for (const Layer *layer : this->layers) {
|
||||||
LayerRegion *layerm = layer->regions[region_id];
|
LayerRegion *layerm = layer->regions[region_id];
|
||||||
layerm->export_region_slices_to_svg_debug("7_discover_horizontal_shells-final");
|
layerm->export_region_slices_to_svg_debug("7_discover_horizontal_shells-final");
|
||||||
@ -350,7 +350,7 @@ void PrintObject::_prepare_infill()
|
|||||||
this->clip_fill_surfaces();
|
this->clip_fill_surfaces();
|
||||||
|
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id)
|
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id) {
|
||||||
for (const Layer *layer : this->layers) {
|
for (const Layer *layer : this->layers) {
|
||||||
LayerRegion *layerm = layer->regions[region_id];
|
LayerRegion *layerm = layer->regions[region_id];
|
||||||
layerm->export_region_slices_to_svg_debug("8_clip_surfaces-final");
|
layerm->export_region_slices_to_svg_debug("8_clip_surfaces-final");
|
||||||
@ -367,7 +367,7 @@ void PrintObject::_prepare_infill()
|
|||||||
this->combine_infill();
|
this->combine_infill();
|
||||||
|
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id)
|
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id) {
|
||||||
for (const Layer *layer : this->layers) {
|
for (const Layer *layer : this->layers) {
|
||||||
LayerRegion *layerm = layer->regions[region_id];
|
LayerRegion *layerm = layer->regions[region_id];
|
||||||
layerm->export_region_slices_to_svg_debug("9_prepare_infill-final");
|
layerm->export_region_slices_to_svg_debug("9_prepare_infill-final");
|
||||||
@ -1816,7 +1816,8 @@ void PrintObject::discover_horizontal_shells()
|
|||||||
for (SurfacesPtr &group : top_bottom_groups)
|
for (SurfacesPtr &group : top_bottom_groups)
|
||||||
neighbor_layerm->fill_surfaces.append(
|
neighbor_layerm->fill_surfaces.append(
|
||||||
diff_ex(to_polygons(group), polygons_internal),
|
diff_ex(to_polygons(group), polygons_internal),
|
||||||
group.front()->surface_type);
|
// Use an existing surface as a template, it carries the bridge angle etc.
|
||||||
|
*group.front());
|
||||||
}
|
}
|
||||||
EXTERNAL:;
|
EXTERNAL:;
|
||||||
} // foreach type (stTop, stBottom, stBottomBridge)
|
} // foreach type (stTop, stBottom, stBottomBridge)
|
||||||
@ -1824,7 +1825,7 @@ void PrintObject::discover_horizontal_shells()
|
|||||||
} // for each region
|
} // for each region
|
||||||
|
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id)
|
for (size_t region_id = 0; region_id < this->print()->regions.size(); ++ region_id) {
|
||||||
for (const Layer *layer : this->layers) {
|
for (const Layer *layer : this->layers) {
|
||||||
const LayerRegion *layerm = layer->regions[region_id];
|
const LayerRegion *layerm = layer->regions[region_id];
|
||||||
layerm->export_region_slices_to_svg_debug("5_discover_horizontal_shells");
|
layerm->export_region_slices_to_svg_debug("5_discover_horizontal_shells");
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
%code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
|
%code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
|
||||||
double infill_area_threshold();
|
double infill_area_threshold();
|
||||||
|
|
||||||
void export_region_slices_to_svg(const char *path);
|
void export_region_slices_to_svg(const char *path) const;
|
||||||
void export_region_fill_surfaces_to_svg(const char *path);
|
void export_region_fill_surfaces_to_svg(const char *path) const;
|
||||||
void export_region_slices_to_svg_debug(const char *name);
|
void export_region_slices_to_svg_debug(const char *name) const;
|
||||||
void export_region_fill_surfaces_to_svg_debug(const char *name);
|
void export_region_fill_surfaces_to_svg_debug(const char *name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
%name{Slic3r::Layer} class Layer {
|
%name{Slic3r::Layer} class Layer {
|
||||||
|
Loading…
Reference in New Issue
Block a user