Fixed test and implementation of ooze prevention standby points (wrong test caused wrong implementation). #2103

This commit is contained in:
Alessandro Ranellucci 2015-01-19 15:30:34 +01:00
parent 7b980c1dc9
commit 229039d3b8
5 changed files with 18 additions and 16 deletions

View File

@ -500,11 +500,14 @@ sub pre_toolchange {
# move to the nearest standby point
if (@{$self->standby_points}) {
my $last_pos = $gcodegen->last_pos->clone;
$last_pos->translate(scale +$gcodegen->origin->x, scale +$gcodegen->origin->y); #))
my $standby_point = $last_pos->nearest_point($self->standby_points);
$standby_point->translate(scale -$gcodegen->origin->x, scale -$gcodegen->origin->y); #))
$gcode .= $gcodegen->travel_to($standby_point, undef, 'move to standby position');
# get current position in print coordinates
my $pos = Slic3r::Point->new_scale(@{$gcodegen->writer->get_position}[0,1]);
my $standby_point = Slic3r::Pointf->new_unscale(@{$pos->nearest_point($self->standby_points)});
# We don't call $gcodegen->travel_to() because we don't need retraction (it was already
# triggered by the caller) nor avoid_crossing_perimeters and also because the coordinates
# of the destination point must not be transformed by origin nor current extruder offset.
$gcode .= $gcodegen->writer->travel_to_xy($standby_point, 'move to standby position');
}
if ($gcodegen->config->standby_temperature_delta != 0) {

View File

@ -1138,8 +1138,8 @@ sub load_print_object_toolpaths {
color => COLORS->[0],
quad_verts => OpenGL::Array->new_list(GL_FLOAT, @perim_qverts),
quad_norms => OpenGL::Array->new_list(GL_FLOAT, @perim_qnorms),
verts => OpenGL::Array->new_list(GL_FLOAT, @perim_tverts),
norms => OpenGL::Array->new_list(GL_FLOAT, @perim_tnorms),
#verts => OpenGL::Array->new_list(GL_FLOAT, @perim_tverts),
#norms => OpenGL::Array->new_list(GL_FLOAT, @perim_tnorms),
offsets => { %perim_offsets },
);
@ -1148,8 +1148,8 @@ sub load_print_object_toolpaths {
color => COLORS->[1],
quad_verts => OpenGL::Array->new_list(GL_FLOAT, @infill_qverts),
quad_norms => OpenGL::Array->new_list(GL_FLOAT, @infill_qnorms),
verts => OpenGL::Array->new_list(GL_FLOAT, @infill_tverts),
norms => OpenGL::Array->new_list(GL_FLOAT, @infill_tnorms),
#verts => OpenGL::Array->new_list(GL_FLOAT, @infill_tverts),
#norms => OpenGL::Array->new_list(GL_FLOAT, @infill_tnorms),
offsets => { %infill_offsets },
);
@ -1158,8 +1158,8 @@ sub load_print_object_toolpaths {
color => COLORS->[2],
quad_verts => OpenGL::Array->new_list(GL_FLOAT, @support_qverts),
quad_norms => OpenGL::Array->new_list(GL_FLOAT, @support_qnorms),
verts => OpenGL::Array->new_list(GL_FLOAT, @support_tverts),
norms => OpenGL::Array->new_list(GL_FLOAT, @support_tnorms),
#verts => OpenGL::Array->new_list(GL_FLOAT, @support_tverts),
#norms => OpenGL::Array->new_list(GL_FLOAT, @support_tnorms),
offsets => { %support_offsets },
);
}

View File

@ -169,8 +169,8 @@ sub export {
require "Slic3r/SVG.pm";
Slic3r::SVG::output(
"ooze_prevention.svg",
polygons => [$outer_skirt],
red_polygons => \@skirts,
polygons => [$outer_skirt],
points => $gcodegen->ooze_prevention->standby_points,
);
}

View File

@ -156,7 +156,7 @@ sub init_print {
$model->duplicate($params{duplicate} // 1, $print->config->min_object_distance);
}
$model->arrange_objects($print->config->min_object_distance);
$model->center_instances_around_point(Slic3r::Pointf->new(@{$params{print_center}}) // Slic3r::Pointf->new(100,100));
$model->center_instances_around_point($params{print_center} ? Slic3r::Pointf->new(@{$params{print_center}}) : Slic3r::Pointf->new(100,100));
foreach my $model_object (@{$model->objects}) {
$print->auto_assign_extruders($model_object);
$print->add_model_object($model_object);

View File

@ -44,7 +44,6 @@ use Slic3r::Test;
if $tool_temp[$tool] != $expected_temp + $config->standby_temperature_delta;
push @toolchange_points, my $point = Slic3r::Point->new_scale($self->X, $self->Y);
$point->translate(map +scale($_), @{ $config->extruder_offset->[$tool] });
}
$tool = $1;
} elsif ($cmd eq 'M104' || $cmd eq 'M109') {
@ -73,11 +72,11 @@ use Slic3r::Test;
if (0) {
require "Slic3r/SVG.pm";
Slic3r::SVG::output(
"ooze_prevention.svg",
"ooze_prevention_test.svg",
no_arrows => 1,
polygons => [$convex_hull],
points => \@toolchange_points,
red_points => \@t,
points => \@toolchange_points,
);
}