mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
Fix raft_layers according to the new support material logic
This commit is contained in:
parent
d7656f5fdc
commit
3f7adfc07d
2 changed files with 27 additions and 20 deletions
|
@ -80,8 +80,14 @@ sub contact_area {
|
|||
# determine contact areas
|
||||
my %contact = (); # contact_z => [ polygons ]
|
||||
my %overhang = (); # contact_z => [ polygons ] - this stores the actual overhang supported by each contact layer
|
||||
for my $layer_id (1 .. $#{$object->layers}) {
|
||||
last if $layer_id > $self->config->raft_layers && !$self->config->support_material;
|
||||
for my $layer_id (0 .. $#{$object->layers}) {
|
||||
if ($self->config->raft_layers == 0) {
|
||||
next if $layer_id == 0;
|
||||
} elsif (!$self->config->support_material) {
|
||||
# if we are only going to generate raft just check
|
||||
# the 'overhangs' of the first object layer
|
||||
last if $layer_id > 0;
|
||||
}
|
||||
my $layer = $object->layers->[$layer_id];
|
||||
my $lower_layer = $object->layers->[$layer_id-1];
|
||||
|
||||
|
@ -93,7 +99,8 @@ sub contact_area {
|
|||
|
||||
# If a threshold angle was specified, use a different logic for detecting overhangs.
|
||||
if (defined $threshold_rad
|
||||
|| $layer_id <= $self->config->support_material_enforce_layers + $self->config->raft_layers) {
|
||||
|| $layer_id < $self->config->support_material_enforce_layers
|
||||
|| $self->config->raft_layers > 0) {
|
||||
my $d = defined $threshold_rad
|
||||
? scale $lower_layer->height * ((cos $threshold_rad) / (sin $threshold_rad))
|
||||
: 0;
|
||||
|
@ -233,6 +240,17 @@ sub support_layers_z {
|
|||
shift @z while @z && $z[0] <= $first_layer_height;
|
||||
unshift @z, $first_layer_height;
|
||||
|
||||
# add raft layers by dividing the space between first layer and
|
||||
# first contact layer evenly
|
||||
if ($self->config->raft_layers > 1) {
|
||||
# $z[1] is last raft layer (contact layer for the first layer object)
|
||||
my $height = ($z[1] - $z[0]) / ($self->config->raft_layers - 1);
|
||||
splice @z, 1, 0,
|
||||
map { int($_*100)/100 }
|
||||
map { $z[0] + $height * $_ }
|
||||
0..($self->config->raft_layers - 1);
|
||||
}
|
||||
|
||||
for (my $i = $#z; $i >= 0; $i--) {
|
||||
my $target_height = $support_material_height;
|
||||
if ($i > 0 && $top{ $z[$i-1] }) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue