mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Untested fix for incomplete honeycomb support material. #1032
This commit is contained in:
parent
25554a345f
commit
0f5064dd32
3 changed files with 23 additions and 11 deletions
|
@ -26,7 +26,7 @@ sub fill_surface {
|
||||||
|
|
||||||
my $cache_id = sprintf "d%s_s%s_a%s",
|
my $cache_id = sprintf "d%s_s%s_a%s",
|
||||||
$params{density}, $params{flow_spacing}, $rotate_vector->[0][0];
|
$params{density}, $params{flow_spacing}, $rotate_vector->[0][0];
|
||||||
if (!$self->cache->{$cache_id}) {
|
if (!$self->cache->{$cache_id} || !defined $self->bounding_box) {
|
||||||
|
|
||||||
# hexagons math
|
# hexagons math
|
||||||
my $hex_side = $distance / (sqrt(3)/2);
|
my $hex_side = $distance / (sqrt(3)/2);
|
||||||
|
@ -40,15 +40,10 @@ sub fill_surface {
|
||||||
|
|
||||||
# adjust actual bounding box to the nearest multiple of our hex pattern
|
# adjust actual bounding box to the nearest multiple of our hex pattern
|
||||||
# and align it so that it matches across layers
|
# and align it so that it matches across layers
|
||||||
$self->bounding_box([ $expolygon->bounding_box ]) if !defined $self->bounding_box;
|
my $bounding_box = [ $self->bounding_box ? @{$self->bounding_box} : $expolygon->bounding_box ];
|
||||||
my $bounding_box = [ 0, 0, $self->bounding_box->[X2], $self->bounding_box->[Y2] ];
|
$bounding_box->[$_] = 0 for X1, Y1;
|
||||||
{
|
{
|
||||||
my $bb_polygon = Slic3r::Polygon->new([
|
my $bb_polygon = Slic3r::Polygon->new_from_bounding_box($bounding_box);
|
||||||
[ $bounding_box->[X1], $bounding_box->[Y1] ],
|
|
||||||
[ $bounding_box->[X2], $bounding_box->[Y1] ],
|
|
||||||
[ $bounding_box->[X2], $bounding_box->[Y2] ],
|
|
||||||
[ $bounding_box->[X1], $bounding_box->[Y2] ],
|
|
||||||
]);
|
|
||||||
$bb_polygon->rotate($rotate_vector->[0][0], $hex_center);
|
$bb_polygon->rotate($rotate_vector->[0][0], $hex_center);
|
||||||
$bounding_box = [ Slic3r::Geometry::bounding_box($bb_polygon) ];
|
$bounding_box = [ Slic3r::Geometry::bounding_box($bb_polygon) ];
|
||||||
# $bounding_box->[X1] and [Y1] represent the displacement between new bounding box offset and old one
|
# $bounding_box->[X1] and [Y1] represent the displacement between new bounding box offset and old one
|
||||||
|
|
|
@ -6,9 +6,22 @@ use warnings;
|
||||||
use parent 'Slic3r::Polyline';
|
use parent 'Slic3r::Polyline';
|
||||||
|
|
||||||
use Slic3r::Geometry qw(polygon_lines polygon_remove_parallel_continuous_edges
|
use Slic3r::Geometry qw(polygon_lines polygon_remove_parallel_continuous_edges
|
||||||
polygon_remove_acute_vertices polygon_segment_having_point point_in_polygon);
|
polygon_remove_acute_vertices polygon_segment_having_point point_in_polygon
|
||||||
|
X1 X2 Y1 Y2);
|
||||||
use Slic3r::Geometry::Clipper qw(JT_MITER);
|
use Slic3r::Geometry::Clipper qw(JT_MITER);
|
||||||
|
|
||||||
|
sub new_from_bounding_box {
|
||||||
|
my $class = shift;
|
||||||
|
my ($bounding_box) = @_;
|
||||||
|
|
||||||
|
return $class->new([
|
||||||
|
[ $bounding_box->[X1], $bounding_box->[Y1] ],
|
||||||
|
[ $bounding_box->[X2], $bounding_box->[Y1] ],
|
||||||
|
[ $bounding_box->[X2], $bounding_box->[Y2] ],
|
||||||
|
[ $bounding_box->[X1], $bounding_box->[Y2] ],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
sub lines {
|
sub lines {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return polygon_lines($self);
|
return polygon_lines($self);
|
||||||
|
|
|
@ -857,7 +857,7 @@ sub generate_support_material {
|
||||||
{
|
{
|
||||||
# 0.5 ensures the paths don't get clipped externally when applying them to layers
|
# 0.5 ensures the paths don't get clipped externally when applying them to layers
|
||||||
my @areas = map $_->offset_ex(- 0.5 * $flow->scaled_width),
|
my @areas = map $_->offset_ex(- 0.5 * $flow->scaled_width),
|
||||||
@{union_ex([ map $_->contour, map @$_, values %layers ])};
|
@{union_ex([ map $_->contour, map @$_, values %layers, values %layers_interfaces, values %layers_contact_areas ])};
|
||||||
|
|
||||||
my $pattern = $Slic3r::Config->support_material_pattern;
|
my $pattern = $Slic3r::Config->support_material_pattern;
|
||||||
my @angles = ($Slic3r::Config->support_material_angle);
|
my @angles = ($Slic3r::Config->support_material_angle);
|
||||||
|
@ -865,7 +865,11 @@ sub generate_support_material {
|
||||||
$pattern = 'rectilinear';
|
$pattern = 'rectilinear';
|
||||||
push @angles, $angles[0] + 90;
|
push @angles, $angles[0] + 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $filler = Slic3r::Fill->filler($pattern);
|
my $filler = Slic3r::Fill->filler($pattern);
|
||||||
|
$filler->bounding_box([ Slic3r::Geometry::bounding_box([ map @$_, map @$_, @areas ]) ])
|
||||||
|
if $filler->can('bounding_box');
|
||||||
|
|
||||||
my $make_pattern = sub {
|
my $make_pattern = sub {
|
||||||
my ($expolygon, $density) = @_;
|
my ($expolygon, $density) = @_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue