mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-31 20:51:12 -06:00
Merge branch 'master' into sender
Conflicts: Build.PL
This commit is contained in:
commit
3ae6f2630e
106 changed files with 2262 additions and 994 deletions
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ sub export {
|
|||
$gcodegen->set_origin(Slic3r::Pointf->new(map unscale $copy->[$_], X,Y));
|
||||
print $fh $gcodegen->retract;
|
||||
print $fh $gcodegen->travel_to(
|
||||
$object->_copies_shift->negative,
|
||||
Slic3r::Point->new(0,0),
|
||||
undef,
|
||||
'move to origin position for next object',
|
||||
);
|
||||
|
|
@ -321,9 +321,14 @@ sub process_layer {
|
|||
}
|
||||
|
||||
# set new layer - this will change Z and force a retraction if retract_layer_change is enabled
|
||||
$gcode .= $self->_gcodegen->placeholder_parser->process($self->print->config->before_layer_gcode, {
|
||||
layer_num => $layer->id,
|
||||
layer_z => $layer->print_z,
|
||||
}) . "\n" if $self->print->config->before_layer_gcode;
|
||||
$gcode .= $self->_gcodegen->change_layer($layer);
|
||||
$gcode .= $self->_gcodegen->placeholder_parser->process($self->print->config->layer_gcode, {
|
||||
layer_num => $layer->id,
|
||||
layer_z => $layer->print_z,
|
||||
}) . "\n" if $self->print->config->layer_gcode;
|
||||
|
||||
# extrude skirt
|
||||
|
|
@ -428,6 +433,8 @@ sub process_layer {
|
|||
{
|
||||
my $extruder_id = $region->config->perimeter_extruder-1;
|
||||
foreach my $perimeter_coll (@{$layerm->perimeters}) {
|
||||
next if $perimeter_coll->empty; # this shouldn't happen but first_point() would fail
|
||||
|
||||
# init by_extruder item only if we actually use the extruder
|
||||
$by_extruder{$extruder_id} //= [];
|
||||
|
||||
|
|
@ -450,6 +457,8 @@ sub process_layer {
|
|||
# throughout the code). We can redefine the order of such Collections but we have to
|
||||
# do each one completely at once.
|
||||
foreach my $fill (@{$layerm->fills}) {
|
||||
next if $fill->empty; # this shouldn't happen but first_point() would fail
|
||||
|
||||
# init by_extruder item only if we actually use the extruder
|
||||
my $extruder_id = $fill->[0]->is_solid_infill
|
||||
? $region->config->solid_infill_extruder-1
|
||||
|
|
|
|||
|
|
@ -55,13 +55,14 @@ sub slice {
|
|||
|
||||
# raise first object layer Z by the thickness of the raft itself
|
||||
# plus the extra distance required by the support material logic
|
||||
$print_z += $self->config->get_value('first_layer_height');
|
||||
my $first_layer_height = $self->config->get_value('first_layer_height');
|
||||
$print_z += $first_layer_height;
|
||||
$print_z += $self->config->layer_height * ($self->config->raft_layers - 1);
|
||||
|
||||
# at this stage we don't know which nozzles are actually used for the first layer
|
||||
# so we compute the average of all of them
|
||||
my $nozzle_diameter = sum(@{$self->print->config->nozzle_diameter})/@{$self->print->config->nozzle_diameter};
|
||||
my $distance = Slic3r::Print::SupportMaterial::contact_distance($nozzle_diameter);
|
||||
my $distance = $self->_support_material->contact_distance($first_layer_height, $nozzle_diameter);
|
||||
|
||||
# force first layer print_z according to the contact distance
|
||||
# (the loop below will raise print_z by such height)
|
||||
|
|
@ -291,7 +292,7 @@ sub slice {
|
|||
while (@{$self->layers} && !@{$self->get_layer(0)->slices}) {
|
||||
shift @{$self->layers};
|
||||
for (my $i = 0; $i <= $#{$self->layers}; $i++) {
|
||||
$self->get_layer($i)->id( $self->get_layer($i)->id-1 );
|
||||
$self->get_layer($i)->set_id( $self->get_layer($i)->id-1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -537,6 +538,14 @@ sub generate_support_material {
|
|||
}
|
||||
$self->print->status_cb->(85, "Generating support material");
|
||||
|
||||
$self->_support_material->generate($self);
|
||||
|
||||
$self->set_step_done(STEP_SUPPORTMATERIAL);
|
||||
}
|
||||
|
||||
sub _support_material {
|
||||
my ($self) = @_;
|
||||
|
||||
my $first_layer_flow = Slic3r::Flow->new_from_width(
|
||||
width => ($self->config->first_layer_extrusion_width || $self->config->support_material_extrusion_width),
|
||||
role => FLOW_ROLE_SUPPORT_MATERIAL,
|
||||
|
|
@ -546,16 +555,13 @@ sub generate_support_material {
|
|||
bridge_flow_ratio => 0,
|
||||
);
|
||||
|
||||
my $s = Slic3r::Print::SupportMaterial->new(
|
||||
return Slic3r::Print::SupportMaterial->new(
|
||||
print_config => $self->print->config,
|
||||
object_config => $self->config,
|
||||
first_layer_flow => $first_layer_flow,
|
||||
flow => $self->support_material_flow,
|
||||
interface_flow => $self->support_material_flow(FLOW_ROLE_SUPPORT_MATERIAL_INTERFACE),
|
||||
);
|
||||
$s->generate($self);
|
||||
|
||||
$self->set_step_done(STEP_SUPPORTMATERIAL);
|
||||
}
|
||||
|
||||
sub detect_surfaces_type {
|
||||
|
|
@ -572,6 +578,7 @@ sub detect_surfaces_type {
|
|||
my $diff = diff(
|
||||
[ map @$_, @$subject ],
|
||||
[ map @$_, @$clip ],
|
||||
1,
|
||||
);
|
||||
|
||||
# collapse very narrow parts (using the safety offset in the diff is not enough)
|
||||
|
|
@ -616,6 +623,11 @@ sub detect_surfaces_type {
|
|||
S_TYPE_BOTTOMBRIDGE,
|
||||
);
|
||||
|
||||
# if we have soluble support material, don't bridge
|
||||
if ($self->config->support_material && $self->config->support_material_contact_distance == 0) {
|
||||
$_->surface_type(S_TYPE_BOTTOM) for @bottom;
|
||||
}
|
||||
|
||||
# if user requested internal shells, we need to identify surfaces
|
||||
# lying on other slices not belonging to this region
|
||||
if ($self->config->interface_shells) {
|
||||
|
|
@ -1009,7 +1021,7 @@ sub combine_infill {
|
|||
# Because fill areas for rectilinear and honeycomb are grown
|
||||
# later to overlap perimeters, we need to counteract that too.
|
||||
+ (($type == S_TYPE_INTERNALSOLID || $region->config->fill_pattern =~ /(rectilinear|honeycomb)/)
|
||||
? $layerms[-1]->flow(FLOW_ROLE_SOLID_INFILL)->scaled_width * &Slic3r::INFILL_OVERLAP_OVER_SPACING
|
||||
? $layerms[-1]->flow(FLOW_ROLE_SOLID_INFILL)->scaled_width
|
||||
: 0)
|
||||
)}, @$intersection;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ sub generate {
|
|||
$i, # id
|
||||
($i == 0) ? $support_z->[$i] : ($support_z->[$i] - $support_z->[$i-1]), # height
|
||||
$support_z->[$i], # print_z
|
||||
-1); # slice_z
|
||||
);
|
||||
if ($i >= 1) {
|
||||
$object->support_layers->[-2]->set_upper_layer($object->support_layers->[-1]);
|
||||
$object->support_layers->[-1]->set_lower_layer($object->support_layers->[-2]);
|
||||
|
|
@ -270,8 +270,7 @@ sub contact_area {
|
|||
@{$layer->regions};
|
||||
my $nozzle_diameter = sum(@nozzle_diameters)/@nozzle_diameters;
|
||||
|
||||
my $contact_z = $layer->print_z - contact_distance($nozzle_diameter);
|
||||
###$contact_z = $layer->print_z - $layer->height;
|
||||
my $contact_z = $layer->print_z - $self->contact_distance($layer->height, $nozzle_diameter);
|
||||
|
||||
# ignore this contact area if it's too low
|
||||
next if $contact_z < $self->object_config->get_value('first_layer_height');
|
||||
|
|
@ -339,12 +338,13 @@ sub support_layers_z {
|
|||
# layer_height > nozzle_diameter * 0.75
|
||||
my $nozzle_diameter = $self->print_config->get_at('nozzle_diameter', $self->object_config->support_material_extruder-1);
|
||||
my $support_material_height = max($max_object_layer_height, $nozzle_diameter * 0.75);
|
||||
my $contact_distance = $self->contact_distance($support_material_height, $nozzle_diameter);
|
||||
|
||||
# initialize known, fixed, support layers
|
||||
my @z = sort { $a <=> $b }
|
||||
@$contact_z,
|
||||
@$top_z, # TODO: why we have this?
|
||||
(map $_ + contact_distance($nozzle_diameter), @$top_z);
|
||||
(map $_ + $contact_distance, @$top_z);
|
||||
|
||||
# enforce first layer height
|
||||
my $first_layer_height = $self->object_config->get_value('first_layer_height');
|
||||
|
|
@ -752,8 +752,12 @@ sub generate_toolpaths {
|
|||
# TODO: use offset2_ex()
|
||||
$to_infill = offset_ex([ map @$_, @$to_infill ], -$_flow->scaled_spacing);
|
||||
}
|
||||
$filler->spacing($base_flow->spacing);
|
||||
|
||||
# We don't use $base_flow->spacing because we need a constant spacing
|
||||
# value that guarantees that all layers are correctly aligned.
|
||||
$filler->spacing($flow->spacing);
|
||||
|
||||
my $mm3_per_mm = $base_flow->mm3_per_mm;
|
||||
foreach my $expolygon (@$to_infill) {
|
||||
my @p = $filler->fill_surface(
|
||||
Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL),
|
||||
|
|
@ -761,7 +765,6 @@ sub generate_toolpaths {
|
|||
layer_height => $layer->height,
|
||||
complete => 1,
|
||||
);
|
||||
my $mm3_per_mm = $base_flow->mm3_per_mm;
|
||||
|
||||
push @paths, map Slic3r::ExtrusionPath->new(
|
||||
polyline => Slic3r::Polyline->new(@$_),
|
||||
|
|
@ -906,10 +909,15 @@ sub overlapping_layers {
|
|||
} 0..$#$support_z;
|
||||
}
|
||||
|
||||
# class method
|
||||
sub contact_distance {
|
||||
my ($nozzle_diameter) = @_;
|
||||
return $nozzle_diameter * 1.5;
|
||||
my ($self, $layer_height, $nozzle_diameter) = @_;
|
||||
|
||||
my $extra = $self->object_config->support_material_contact_distance;
|
||||
if ($extra == 0) {
|
||||
return $layer_height;
|
||||
} else {
|
||||
return $nozzle_diameter + $extra;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue