Untested fix for incomplete honeycomb support material. #1032

internal-support
Alessandro Ranellucci 2013-03-16 21:10:12 +01:00
parent 25554a345f
commit 0f5064dd32
3 changed files with 23 additions and 11 deletions

View File

@ -26,7 +26,7 @@ sub fill_surface {
my $cache_id = sprintf "d%s_s%s_a%s",
$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
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
# and align it so that it matches across layers
$self->bounding_box([ $expolygon->bounding_box ]) if !defined $self->bounding_box;
my $bounding_box = [ 0, 0, $self->bounding_box->[X2], $self->bounding_box->[Y2] ];
my $bounding_box = [ $self->bounding_box ? @{$self->bounding_box} : $expolygon->bounding_box ];
$bounding_box->[$_] = 0 for X1, Y1;
{
my $bb_polygon = Slic3r::Polygon->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] ],
]);
my $bb_polygon = Slic3r::Polygon->new_from_bounding_box($bounding_box);
$bb_polygon->rotate($rotate_vector->[0][0], $hex_center);
$bounding_box = [ Slic3r::Geometry::bounding_box($bb_polygon) ];
# $bounding_box->[X1] and [Y1] represent the displacement between new bounding box offset and old one

View File

@ -6,9 +6,22 @@ use warnings;
use parent 'Slic3r::Polyline';
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);
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 {
my $self = shift;
return polygon_lines($self);

View File

@ -857,7 +857,7 @@ sub generate_support_material {
{
# 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),
@{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 @angles = ($Slic3r::Config->support_material_angle);
@ -865,7 +865,11 @@ sub generate_support_material {
$pattern = 'rectilinear';
push @angles, $angles[0] + 90;
}
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 ($expolygon, $density) = @_;