mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-04-21 21:30:00 +08:00
Fixed regression in dont_support_bridges. #3859
This commit is contained in:
parent
7b300e2c20
commit
c82302e284
@ -208,20 +208,29 @@ sub contact_area {
|
|||||||
|
|
||||||
if ($conf->dont_support_bridges) {
|
if ($conf->dont_support_bridges) {
|
||||||
# compute the area of bridging perimeters
|
# compute the area of bridging perimeters
|
||||||
# Note: this is duplicate code from GCode.pm, we need to refactor
|
|
||||||
|
|
||||||
my $bridged_perimeters; # Polygons
|
my $bridged_perimeters; # Polygons
|
||||||
{
|
{
|
||||||
my $bridge_flow = $layerm->flow(FLOW_ROLE_PERIMETER, 1);
|
my $bridge_flow = $layerm->flow(FLOW_ROLE_PERIMETER, 1);
|
||||||
|
|
||||||
my $nozzle_diameter = $self->print_config->get_at('nozzle_diameter', $layerm->region->config->perimeter_extruder-1);
|
# Get the lower layer's slices and grow them by half the nozzle diameter
|
||||||
my $lower_grown_slices = offset([ map @$_, @{$lower_layer->slices} ], +scale($nozzle_diameter/2));
|
# because we will consider the upper perimeters supported even if half nozzle
|
||||||
|
# falls outside the lower slices.
|
||||||
|
my $lower_grown_slices;
|
||||||
|
{
|
||||||
|
my $nozzle_diameter = $self->print_config->get_at('nozzle_diameter', $layerm->region->config->perimeter_extruder-1);
|
||||||
|
$lower_grown_slices = offset(
|
||||||
|
[ map @$_, @{$lower_layer->slices} ],
|
||||||
|
+scale($nozzle_diameter/2),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
# TODO: split_at_first_point() could split a bridge mid-way
|
# Get all perimeters as polylines.
|
||||||
my @overhang_perimeters =
|
# TODO: split_at_first_point() (called by as_polyline() for ExtrusionLoops)
|
||||||
map { $_->isa('Slic3r::ExtrusionLoop') ? $_->polygon->split_at_first_point : $_->polyline->clone }
|
# could split a bridge mid-way
|
||||||
map @$_, @{$layerm->perimeters};
|
my @overhang_perimeters = map $_->as_polyline, @{$layerm->perimeters->flatten};
|
||||||
|
|
||||||
|
# Only consider the overhang parts of such perimeters,
|
||||||
|
# overhangs being those parts not supported by
|
||||||
# workaround for Clipper bug, see Slic3r::Polygon::clip_as_polyline()
|
# workaround for Clipper bug, see Slic3r::Polygon::clip_as_polyline()
|
||||||
$_->[0]->translate(1,0) for @overhang_perimeters;
|
$_->[0]->translate(1,0) for @overhang_perimeters;
|
||||||
@overhang_perimeters = @{diff_pl(
|
@overhang_perimeters = @{diff_pl(
|
||||||
@ -243,11 +252,16 @@ sub contact_area {
|
|||||||
|
|
||||||
# convert bridging polylines into polygons by inflating them with their thickness
|
# convert bridging polylines into polygons by inflating them with their thickness
|
||||||
{
|
{
|
||||||
# since we're dealing with bridges, we can't assume width is larger than spacing,
|
# For bridges we can't assume width is larger than spacing because they
|
||||||
# so we take the largest value and also apply safety offset to be ensure no gaps
|
# are positioned according to non-bridging perimeters spacing.
|
||||||
# are left in between
|
my $w = max(
|
||||||
my $w = max($bridge_flow->scaled_width, $bridge_flow->scaled_spacing);
|
$bridge_flow->scaled_width,
|
||||||
|
$bridge_flow->scaled_spacing,
|
||||||
|
$fw, # width of external perimeters
|
||||||
|
$layerm->flow(FLOW_ROLE_PERIMETER)->scaled_width,
|
||||||
|
);
|
||||||
$bridged_perimeters = union([
|
$bridged_perimeters = union([
|
||||||
|
# Also apply safety offset to ensure no gaps are left in between.
|
||||||
map @{$_->grow($w/2 + 10)}, @overhang_perimeters
|
map @{$_->grow($w/2 + 10)}, @overhang_perimeters
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -258,7 +272,7 @@ sub contact_area {
|
|||||||
my @bridges = map $_->expolygon,
|
my @bridges = map $_->expolygon,
|
||||||
grep $_->bridge_angle != -1,
|
grep $_->bridge_angle != -1,
|
||||||
@{$layerm->fill_surfaces->filter_by_type(S_TYPE_BOTTOMBRIDGE)};
|
@{$layerm->fill_surfaces->filter_by_type(S_TYPE_BOTTOMBRIDGE)};
|
||||||
|
|
||||||
$diff = diff(
|
$diff = diff(
|
||||||
$diff,
|
$diff,
|
||||||
[
|
[
|
||||||
|
@ -198,12 +198,12 @@ Polyline::is_straight() const
|
|||||||
/* Check that each segment's direction is equal to the line connecting
|
/* Check that each segment's direction is equal to the line connecting
|
||||||
first point and last point. (Checking each line against the previous
|
first point and last point. (Checking each line against the previous
|
||||||
one would cause the error to accumulate.) */
|
one would cause the error to accumulate.) */
|
||||||
double dir = Line(this->first_point(), this->last_point()).direction();
|
const double dir = Line(this->first_point(), this->last_point()).direction();
|
||||||
|
|
||||||
|
for (const Line &line : this->lines())
|
||||||
|
if (!line.parallel_to(dir))
|
||||||
|
return false;
|
||||||
|
|
||||||
Lines lines = this->lines();
|
|
||||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
|
|
||||||
if (!line->parallel_to(dir)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
bool is_infill();
|
bool is_infill();
|
||||||
bool is_solid_infill();
|
bool is_solid_infill();
|
||||||
Polygons grow();
|
Polygons grow();
|
||||||
|
Clone<Polyline> as_polyline();
|
||||||
%{
|
%{
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
bool is_solid_infill();
|
bool is_solid_infill();
|
||||||
bool is_bridge();
|
bool is_bridge();
|
||||||
Polygons grow();
|
Polygons grow();
|
||||||
|
Clone<Polyline> as_polyline();
|
||||||
%{
|
%{
|
||||||
|
|
||||||
ExtrusionPath*
|
ExtrusionPath*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user