mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-05 13:04:03 -06:00
Display skirt and brim in toolpaths preview. Also take support material margin into account when sizing the window. #2169
This commit is contained in:
parent
70fb381ecf
commit
86bad17abb
5 changed files with 95 additions and 19 deletions
|
@ -356,6 +356,8 @@ sub max_layer_height {
|
|||
return max(@{$self->config->nozzle_diameter});
|
||||
}
|
||||
|
||||
# the bounding box of objects placed in copies position
|
||||
# (without taking skirt/brim/support material into account)
|
||||
sub bounding_box {
|
||||
my $self = shift;
|
||||
|
||||
|
@ -370,6 +372,30 @@ sub bounding_box {
|
|||
return Slic3r::Geometry::BoundingBox->new_from_points([ map Slic3r::Point->new(@$_), @points ]);
|
||||
}
|
||||
|
||||
# the total bounding box of extrusions, including skirt/brim/support material
|
||||
sub total_bounding_box {
|
||||
my ($self) = @_;
|
||||
|
||||
# get objects bounding box
|
||||
my $bb = $self->bounding_box;
|
||||
|
||||
# check how much we need to increase it
|
||||
my $extra = 0;
|
||||
if ($self->has_support_material) {
|
||||
$extra = &Slic3r::Print::SupportMaterial::MARGIN;
|
||||
}
|
||||
if ($self->config->skirts > 0) {
|
||||
my $skirt_flow = $self->skirt_flow;
|
||||
$extra = max($extra, $self->config->skirt_distance + ($self->config->skirts * $skirt_flow->spacing));
|
||||
}
|
||||
$extra = max($extra, $self->config->brim_width);
|
||||
|
||||
if ($extra > 0) {
|
||||
$bb->offset(scale $extra);
|
||||
}
|
||||
return $bb;
|
||||
}
|
||||
|
||||
sub size {
|
||||
my $self = shift;
|
||||
return $self->bounding_box->size;
|
||||
|
@ -602,14 +628,8 @@ sub make_skirt {
|
|||
# skirt may be printed on several layers, having distinct layer heights,
|
||||
# but loops must be aligned so can't vary width/spacing
|
||||
# TODO: use each extruder's own flow
|
||||
my $first_layer_height = $self->objects->[0]->config->get_value('first_layer_height');
|
||||
my $flow = Slic3r::Flow->new_from_width(
|
||||
width => ($self->config->first_layer_extrusion_width || $self->regions->[0]->config->perimeter_extrusion_width),
|
||||
role => FLOW_ROLE_PERIMETER,
|
||||
nozzle_diameter => $self->config->nozzle_diameter->[0],
|
||||
layer_height => $first_layer_height,
|
||||
bridge_flow_ratio => 0,
|
||||
);
|
||||
my $first_layer_height = $self->skirt_first_layer_height;
|
||||
my $flow = $self->skirt_flow;
|
||||
my $spacing = $flow->spacing;
|
||||
my $mm3_per_mm = $flow->mm3_per_mm;
|
||||
|
||||
|
@ -677,14 +697,8 @@ sub make_brim {
|
|||
$self->status_cb->(88, "Generating brim");
|
||||
|
||||
# brim is only printed on first layer and uses support material extruder
|
||||
my $first_layer_height = $self->objects->[0]->config->get_abs_value('first_layer_height');
|
||||
my $flow = Slic3r::Flow->new_from_width(
|
||||
width => ($self->config->first_layer_extrusion_width || $self->regions->[0]->config->perimeter_extrusion_width),
|
||||
role => FLOW_ROLE_PERIMETER,
|
||||
nozzle_diameter => $self->config->get_at('nozzle_diameter', $self->objects->[0]->config->support_material_extruder-1),
|
||||
layer_height => $first_layer_height,
|
||||
bridge_flow_ratio => 0,
|
||||
);
|
||||
my $first_layer_height = $self->skirt_first_layer_height;
|
||||
my $flow = $self->skirt_flow;
|
||||
my $mm3_per_mm = $flow->mm3_per_mm;
|
||||
|
||||
my $grow_distance = $flow->scaled_width / 2;
|
||||
|
@ -738,6 +752,23 @@ sub make_brim {
|
|||
$self->set_step_done(STEP_BRIM);
|
||||
}
|
||||
|
||||
sub skirt_first_layer_height {
|
||||
my ($self) = @_;
|
||||
return $self->objects->[0]->config->get_abs_value('first_layer_height');
|
||||
}
|
||||
|
||||
sub skirt_flow {
|
||||
my ($self) = @_;
|
||||
|
||||
return Slic3r::Flow->new_from_width(
|
||||
width => ($self->config->first_layer_extrusion_width || $self->regions->[0]->config->perimeter_extrusion_width),
|
||||
role => FLOW_ROLE_PERIMETER,
|
||||
nozzle_diameter => $self->config->get_at('nozzle_diameter', $self->objects->[0]->config->support_material_extruder-1),
|
||||
layer_height => $self->skirt_first_layer_height,
|
||||
bridge_flow_ratio => 0,
|
||||
);
|
||||
}
|
||||
|
||||
sub write_gcode {
|
||||
my $self = shift;
|
||||
my ($file) = @_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue