mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 23:55:56 +08:00
Refactoring.
This commit is contained in:
parent
99c7c2c8bf
commit
737353a85b
@ -1018,4 +1018,3 @@ sub contact_distance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//#include <catch.hpp>
|
//#include <catch.hpp>
|
||||||
#include <libslic3r/IO.hpp>
|
#include <libslic3r/IO.hpp>
|
||||||
|
#include <libslic3r/GCodeReader.hpp>
|
||||||
#include "/home/ahmedsamir/Work/SamirSlic3r/Slic3r/build/external/Catch/include/catch.hpp"
|
#include "/home/ahmedsamir/Work/SamirSlic3r/Slic3r/build/external/Catch/include/catch.hpp"
|
||||||
|
|
||||||
#include "libslic3r.h"
|
#include "libslic3r.h"
|
||||||
@ -10,9 +11,10 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Slic3r;
|
using namespace Slic3r;
|
||||||
|
|
||||||
void test_1_check(Print &print, bool &a, bool &b, bool &c, bool &d);
|
void test_1_checks(Print &print, bool &a, bool &b, bool &c, bool &d);
|
||||||
|
bool test_6_checks(Print &print);
|
||||||
|
|
||||||
// Testing supports material member functions.
|
// Testing 0.1: supports material member functions.
|
||||||
TEST_CASE("", "")
|
TEST_CASE("", "")
|
||||||
{
|
{
|
||||||
// Create a mesh & modelObject.
|
// Create a mesh & modelObject.
|
||||||
@ -44,6 +46,95 @@ TEST_CASE("", "")
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test 1.
|
||||||
|
SCENARIO("SupportMaterial: support_layers_z and contact_distance")
|
||||||
|
{
|
||||||
|
GIVEN("A print object having one modelObject") {
|
||||||
|
// Create a mesh & modelObject.
|
||||||
|
TriangleMesh mesh = TriangleMesh::make_cube(20, 20, 20);
|
||||||
|
|
||||||
|
// Create modelObject.
|
||||||
|
Model model = Model();
|
||||||
|
ModelObject *object = model.add_object();
|
||||||
|
object->add_volume(mesh);
|
||||||
|
model.add_default_instances();
|
||||||
|
|
||||||
|
// Align to origin.
|
||||||
|
model.align_instances_to_origin();
|
||||||
|
// Create Print.
|
||||||
|
Print print = Print();
|
||||||
|
print.default_object_config.set_deserialize("support_material", "1");
|
||||||
|
|
||||||
|
WHEN("First layer height = 0.4") {
|
||||||
|
print.default_object_config.set_deserialize("layer_height", "0.2");
|
||||||
|
print.default_object_config.set_deserialize("first_layer_height", "0.4");
|
||||||
|
|
||||||
|
print.add_model_object(model.objects[0]);
|
||||||
|
print.objects.front()->_slice();
|
||||||
|
bool a, b, c, d;
|
||||||
|
|
||||||
|
test_1_checks(print, a, b, c, d);
|
||||||
|
THEN("First layer height is honored") {
|
||||||
|
REQUIRE(a == true);
|
||||||
|
}
|
||||||
|
THEN("No null or negative support layers") {
|
||||||
|
REQUIRE(b == true);
|
||||||
|
}
|
||||||
|
THEN("No layers thicker than nozzle diameter") {
|
||||||
|
REQUIRE(c == true);
|
||||||
|
}
|
||||||
|
THEN("Layers above top surfaces are spaced correctly") {
|
||||||
|
REQUIRE(d == true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("Layer height = 0.2 and, first layer height = 0.3") {
|
||||||
|
print.default_object_config.set_deserialize("layer_height", "0.2");
|
||||||
|
print.default_object_config.set_deserialize("first_layer_height", "0.3");
|
||||||
|
print.add_model_object(model.objects[0]);
|
||||||
|
print.objects.front()->_slice();
|
||||||
|
bool a, b, c, d;
|
||||||
|
|
||||||
|
test_1_checks(print, a, b, c, d);
|
||||||
|
THEN("First layer height is honored") {
|
||||||
|
REQUIRE(a == true);
|
||||||
|
}
|
||||||
|
THEN("No null or negative support layers") {
|
||||||
|
REQUIRE(b == true);
|
||||||
|
}
|
||||||
|
THEN("No layers thicker than nozzle diameter") {
|
||||||
|
REQUIRE(c == true);
|
||||||
|
}
|
||||||
|
THEN("Layers above top surfaces are spaced correctly") {
|
||||||
|
REQUIRE(d == true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WHEN("Layer height = nozzle_diameter[0]") {
|
||||||
|
print.default_object_config.set_deserialize("layer_height", "0.2");
|
||||||
|
print.default_object_config.set_deserialize("first_layer_height", "0.3");
|
||||||
|
print.add_model_object(model.objects[0]);
|
||||||
|
print.objects.front()->_slice();
|
||||||
|
bool a, b, c, d;
|
||||||
|
|
||||||
|
test_1_checks(print, a, b, c, d);
|
||||||
|
THEN("First layer height is honored") {
|
||||||
|
REQUIRE(a == true);
|
||||||
|
}
|
||||||
|
THEN("No null or negative support layers") {
|
||||||
|
REQUIRE(b == true);
|
||||||
|
}
|
||||||
|
THEN("No layers thicker than nozzle diameter") {
|
||||||
|
REQUIRE(c == true);
|
||||||
|
}
|
||||||
|
THEN("Layers above top surfaces are spaced correctly") {
|
||||||
|
REQUIRE(d == true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test 8.
|
||||||
TEST_CASE("SupportMaterial: forced support is generated", "")
|
TEST_CASE("SupportMaterial: forced support is generated", "")
|
||||||
{
|
{
|
||||||
// Create a mesh & modelObject.
|
// Create a mesh & modelObject.
|
||||||
@ -71,7 +162,7 @@ TEST_CASE("SupportMaterial: forced support is generated", "")
|
|||||||
auto support_z = support->support_layers_z(contact_z, top_z, print.default_object_config.layer_height);
|
auto support_z = support->support_layers_z(contact_z, top_z, print.default_object_config.layer_height);
|
||||||
|
|
||||||
bool check = true;
|
bool check = true;
|
||||||
for (int i = 1; i < support_z.size(); i++) {
|
for (size_t i = 1; i < support_z.size(); i++) {
|
||||||
if (support_z[i] - support_z[i - 1] <= 0)
|
if (support_z[i] - support_z[i - 1] <= 0)
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
@ -79,107 +170,67 @@ TEST_CASE("SupportMaterial: forced support is generated", "")
|
|||||||
REQUIRE(check == true);
|
REQUIRE(check == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENARIO("SupportMaterial: support_layers_z and contact_distance")
|
// Test 6.
|
||||||
|
SCENARIO("SupportMaterial: Checking bridge speed")
|
||||||
{
|
{
|
||||||
GIVEN("A print object having one modelObject") {
|
GIVEN("Print object") {
|
||||||
// Create a mesh & modelObject.
|
// Create a mesh & modelObject.
|
||||||
TriangleMesh mesh = TriangleMesh::make_cube(20, 20, 20);
|
TriangleMesh mesh = TriangleMesh::make_cube(20, 20, 20);
|
||||||
|
|
||||||
// Create modelObject.
|
|
||||||
Model model = Model();
|
Model model = Model();
|
||||||
ModelObject *object = model.add_object();
|
ModelObject *object = model.add_object();
|
||||||
object->add_volume(mesh);
|
object->add_volume(mesh);
|
||||||
model.add_default_instances();
|
model.add_default_instances();
|
||||||
|
|
||||||
// Align to origin.
|
|
||||||
model.align_instances_to_origin();
|
model.align_instances_to_origin();
|
||||||
|
|
||||||
WHEN("First layer height = 0.4") {
|
Print print = Print();
|
||||||
// Create Print.
|
print.config.brim_width = 0;
|
||||||
Print print = Print();
|
print.config.skirts = 0;
|
||||||
print.default_object_config.set_deserialize("support_material", "1");
|
print.config.skirts = 0;
|
||||||
print.default_object_config.set_deserialize("layer_height", "0.2");
|
print.default_object_config.support_material = 1;
|
||||||
print.default_object_config.set_deserialize("first_layer_height", "0.4");
|
print.default_region_config.top_solid_layers = 0; // so that we don't have the internal bridge over infill.
|
||||||
|
print.default_region_config.bridge_speed = 99;
|
||||||
|
print.config.cooling = 0;
|
||||||
|
print.config.set_deserialize("first_layer_speed", "100%");
|
||||||
|
|
||||||
|
WHEN("support_material_contact_distance = 0.2") {
|
||||||
|
print.default_object_config.support_material_contact_distance = 0.2;
|
||||||
print.add_model_object(model.objects[0]);
|
print.add_model_object(model.objects[0]);
|
||||||
print.objects.front()->_slice();
|
|
||||||
bool a, b, c, d;
|
|
||||||
|
|
||||||
test_1_check(print, a, b, c, d);
|
bool check = test_6_checks(print);
|
||||||
THEN("First layer height is honored") {
|
REQUIRE(check == true); // bridge speed is used.
|
||||||
REQUIRE(a == true);
|
}
|
||||||
}
|
|
||||||
THEN("No null or negative support layers") {
|
WHEN("support_material_contact_distance = 0") {
|
||||||
REQUIRE(b == true);
|
print.default_object_config.support_material_contact_distance = 0;
|
||||||
}
|
print.add_model_object(model.objects[0]);
|
||||||
THEN("No layers thicker than nozzle diameter") {
|
|
||||||
REQUIRE(c == true);
|
bool check = test_6_checks(print);
|
||||||
}
|
REQUIRE(check == true); // bridge speed is not used.
|
||||||
THEN("Layers above top surfaces are spaced correctly") {
|
}
|
||||||
REQUIRE(d == true);
|
|
||||||
}
|
WHEN("support_material_contact_distance = 0.2 & raft_layers = 5") {
|
||||||
|
print.default_object_config.support_material_contact_distance = 0.2;
|
||||||
|
print.default_object_config.raft_layers = 5;
|
||||||
|
print.add_model_object(model.objects[0]);
|
||||||
|
|
||||||
|
bool check = test_6_checks(print);
|
||||||
|
REQUIRE(check == true); // bridge speed is used.
|
||||||
|
}
|
||||||
|
|
||||||
|
WHEN("support_material_contact_distance = 0 & raft_layers = 5") {
|
||||||
|
print.default_object_config.support_material_contact_distance = 0;
|
||||||
|
print.default_object_config.raft_layers = 5;
|
||||||
|
print.add_model_object(model.objects[0]);
|
||||||
|
|
||||||
|
bool check = test_6_checks(print);
|
||||||
|
|
||||||
|
REQUIRE(check == true); // bridge speed is not used.
|
||||||
}
|
}
|
||||||
// WHEN("Layer height = 0.2 and, first layer height = 0.3") {
|
|
||||||
// print.default_object_config.set_deserialize("layer_height", "0.2");
|
|
||||||
// print.default_object_config.set_deserialize("first_layer_height", "0.3");
|
|
||||||
// print.add_model_object(model.objects[0]);
|
|
||||||
// print.objects.front()->_slice();
|
|
||||||
// bool a, b, c, d;
|
|
||||||
//
|
|
||||||
// test_1_check(print, a, b, c, d);
|
|
||||||
// THEN("First layer height is honored") {
|
|
||||||
// REQUIRE(a == true);
|
|
||||||
// }
|
|
||||||
// THEN("No null or negative support layers") {
|
|
||||||
// REQUIRE(b == true);
|
|
||||||
// }
|
|
||||||
// THEN("No layers thicker than nozzle diameter") {
|
|
||||||
// REQUIRE(c == true);
|
|
||||||
// }
|
|
||||||
// THEN("Layers above top surfaces are spaced correctly") {
|
|
||||||
// REQUIRE(d == true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// WHEN("Layer height = nozzle_diameter[0]") {
|
|
||||||
// print.default_object_config.set_deserialize("layer_height", "0.2");
|
|
||||||
// print.default_object_config.set_deserialize("first_layer_height", "0.3");
|
|
||||||
// print.add_model_object(model.objects[0]);
|
|
||||||
// print.objects.front()->_slice();
|
|
||||||
// bool a, b, c, d;
|
|
||||||
//
|
|
||||||
// test_1_check(print, a, b, c, d);
|
|
||||||
// THEN("First layer height is honored") {
|
|
||||||
// REQUIRE(a == true);
|
|
||||||
// }
|
|
||||||
// THEN("No null or negative support layers") {
|
|
||||||
// REQUIRE(b == true);
|
|
||||||
// }
|
|
||||||
// THEN("No layers thicker than nozzle diameter") {
|
|
||||||
// REQUIRE(c == true);
|
|
||||||
// }
|
|
||||||
// THEN("Layers above top surfaces are spaced correctly") {
|
|
||||||
// REQUIRE(d == true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENARIO("SupportMaterial: Checking bridge speed") {
|
void test_1_checks(Print &print, bool &a, bool &b, bool &c, bool &d)
|
||||||
// Create a mesh & modelObject.
|
|
||||||
TriangleMesh mesh = TriangleMesh::make_cube(20, 20, 20);
|
|
||||||
|
|
||||||
Model model = Model();
|
|
||||||
ModelObject *object = model.add_object();
|
|
||||||
object->add_volume(mesh);
|
|
||||||
model.add_default_instances();
|
|
||||||
model.align_instances_to_origin();
|
|
||||||
|
|
||||||
Print print = Print();
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_1_check(Print &print, bool &a, bool &b, bool &c, bool &d)
|
|
||||||
{
|
{
|
||||||
vector<coordf_t> contact_z = {1.9};
|
vector<coordf_t> contact_z = {1.9};
|
||||||
vector<coordf_t> top_z = {1.1};
|
vector<coordf_t> top_z = {1.1};
|
||||||
@ -188,9 +239,6 @@ void test_1_check(Print &print, bool &a, bool &b, bool &c, bool &d)
|
|||||||
|
|
||||||
vector<coordf_t>
|
vector<coordf_t>
|
||||||
support_z = support->support_layers_z(contact_z, top_z, print.default_object_config.layer_height);
|
support_z = support->support_layers_z(contact_z, top_z, print.default_object_config.layer_height);
|
||||||
for(auto el: support_z)
|
|
||||||
cout << el << endl;
|
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
a = (support_z[0] == print.default_object_config.first_layer_height.value);
|
a = (support_z[0] == print.default_object_config.first_layer_height.value);
|
||||||
|
|
||||||
@ -227,3 +275,22 @@ for(auto el: support_z)
|
|||||||
}
|
}
|
||||||
d = !wrong_top_spacing;
|
d = !wrong_top_spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
bool test_6_checks(Print &print)
|
||||||
|
{
|
||||||
|
bool has_bridge_speed = true;
|
||||||
|
|
||||||
|
// Pre-Processing.
|
||||||
|
PrintObject *print_object = print.objects.front();
|
||||||
|
print_object->_infill();
|
||||||
|
SupportMaterial *support_material = print.objects.front()->_support_material();
|
||||||
|
support_material->generate(print_object);
|
||||||
|
// TODO but not needed in test 6 (make brims and make skirts).
|
||||||
|
|
||||||
|
// Exporting gcode.
|
||||||
|
// TODO validation found in Simple.pm
|
||||||
|
|
||||||
|
|
||||||
|
return has_bridge_speed;
|
||||||
|
}
|
559
t/support.t
559
t/support.t
@ -1,4 +1,4 @@
|
|||||||
use Test::More tests => 12;
|
use Test::More tests => 29;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ BEGIN {
|
|||||||
use lib "$FindBin::Bin/../lib";
|
use lib "$FindBin::Bin/../lib";
|
||||||
use local::lib "$FindBin::Bin/../local-lib";
|
use local::lib "$FindBin::Bin/../local-lib";
|
||||||
}
|
}
|
||||||
use Data::Dumper;
|
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use Slic3r;
|
use Slic3r;
|
||||||
use Slic3r::Geometry qw(epsilon scale PI);
|
use Slic3r::Geometry qw(epsilon scale PI);
|
||||||
@ -31,7 +31,7 @@ use Slic3r::Test;
|
|||||||
);
|
);
|
||||||
my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
|
my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
|
||||||
my $expected_top_spacing = $support->contact_distance($config->layer_height, $config->nozzle_diameter->[0]);
|
my $expected_top_spacing = $support->contact_distance($config->layer_height, $config->nozzle_diameter->[0]);
|
||||||
diag(Dumper($support_z));
|
|
||||||
is $support_z->[0], $config->first_layer_height,
|
is $support_z->[0], $config->first_layer_height,
|
||||||
'first layer height is honored';
|
'first layer height is honored';
|
||||||
is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0,
|
is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0,
|
||||||
@ -64,281 +64,280 @@ use Slic3r::Test;
|
|||||||
$config->set('layer_height', $config->nozzle_diameter->[0]);
|
$config->set('layer_height', $config->nozzle_diameter->[0]);
|
||||||
$test->();
|
$test->();
|
||||||
}
|
}
|
||||||
#
|
|
||||||
#{
|
{
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# $config->set('raft_layers', 3);
|
$config->set('raft_layers', 3);
|
||||||
# $config->set('brim_width', 0);
|
$config->set('brim_width', 0);
|
||||||
# $config->set('skirts', 0);
|
$config->set('skirts', 0);
|
||||||
# $config->set('support_material_extruder', 2);
|
$config->set('support_material_extruder', 2);
|
||||||
# $config->set('support_material_interface_extruder', 2);
|
$config->set('support_material_interface_extruder', 2);
|
||||||
# $config->set('layer_height', 0.4);
|
$config->set('layer_height', 0.4);
|
||||||
# $config->set('first_layer_height', 0.4);
|
$config->set('first_layer_height', 0.4);
|
||||||
# my $print = Slic3r::Test::init_print('overhang', config => $config);
|
my $print = Slic3r::Test::init_print('overhang', config => $config);
|
||||||
# ok my $gcode = Slic3r::Test::gcode($print), 'no conflict between raft/support and brim';
|
ok my $gcode = Slic3r::Test::gcode($print), 'no conflict between raft/support and brim';
|
||||||
#
|
|
||||||
# my $tool = 0;
|
my $tool = 0;
|
||||||
# Slic3r::GCode::Reader->new->parse($gcode, sub {
|
Slic3r::GCode::Reader->new->parse($gcode, sub {
|
||||||
# my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
#
|
|
||||||
# if ($cmd =~ /^T(\d+)/) {
|
if ($cmd =~ /^T(\d+)/) {
|
||||||
# $tool = $1;
|
$tool = $1;
|
||||||
# } elsif ($info->{extruding}) {
|
} elsif ($info->{extruding}) {
|
||||||
# if ($self->Z <= ($config->raft_layers * $config->layer_height)) {
|
if ($self->Z <= ($config->raft_layers * $config->layer_height)) {
|
||||||
# fail 'not extruding raft with support material extruder'
|
fail 'not extruding raft with support material extruder'
|
||||||
# if $tool != ($config->support_material_extruder-1);
|
if $tool != ($config->support_material_extruder-1);
|
||||||
# } else {
|
} else {
|
||||||
# fail 'support material exceeds raft layers'
|
fail 'support material exceeds raft layers'
|
||||||
# if $tool == $config->support_material_extruder-1;
|
if $tool == $config->support_material_extruder-1;
|
||||||
# # TODO: we should test that full support is generated when we use raft too
|
# TODO: we should test that full support is generated when we use raft too
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
# });
|
});
|
||||||
#}
|
}
|
||||||
#
|
|
||||||
#{
|
{
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# $config->set('skirts', 0);
|
$config->set('skirts', 0);
|
||||||
# $config->set('raft_layers', 3);
|
$config->set('raft_layers', 3);
|
||||||
# $config->set('support_material_pattern', 'honeycomb');
|
$config->set('support_material_pattern', 'honeycomb');
|
||||||
# $config->set('support_material_extrusion_width', 0.6);
|
$config->set('support_material_extrusion_width', 0.6);
|
||||||
# $config->set('first_layer_extrusion_width', '100%');
|
$config->set('first_layer_extrusion_width', '100%');
|
||||||
# $config->set('bridge_speed', 99);
|
$config->set('bridge_speed', 99);
|
||||||
# $config->set('cooling', 0); # prevent speed alteration
|
$config->set('cooling', 0); # prevent speed alteration
|
||||||
# $config->set('first_layer_speed', '100%'); # prevent speed alteration
|
$config->set('first_layer_speed', '100%'); # prevent speed alteration
|
||||||
# $config->set('start_gcode', ''); # prevent any unexpected Z move
|
$config->set('start_gcode', ''); # prevent any unexpected Z move
|
||||||
# my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
#
|
|
||||||
# my $layer_id = -1; # so that first Z move sets this to 0
|
my $layer_id = -1; # so that first Z move sets this to 0
|
||||||
# my @raft = my @first_object_layer = ();
|
my @raft = my @first_object_layer = ();
|
||||||
# my %first_object_layer_speeds = (); # F => 1
|
my %first_object_layer_speeds = (); # F => 1
|
||||||
# Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||||
# my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
# if ($info->{extruding} && $info->{dist_XY} > 0) {
|
if ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
# if ($layer_id <= $config->raft_layers) {
|
if ($layer_id <= $config->raft_layers) {
|
||||||
# # this is a raft layer or the first object layer
|
# this is a raft layer or the first object layer
|
||||||
# my $line = Slic3r::Line->new_scale([ $self->X, $self->Y ], [ $info->{new_X}, $info->{new_Y} ]);
|
my $line = Slic3r::Line->new_scale([ $self->X, $self->Y ], [ $info->{new_X}, $info->{new_Y} ]);
|
||||||
# my @path = @{$line->grow(scale($config->support_material_extrusion_width/2))};
|
my @path = @{$line->grow(scale($config->support_material_extrusion_width/2))};
|
||||||
# if ($layer_id < $config->raft_layers) {
|
if ($layer_id < $config->raft_layers) {
|
||||||
# # this is a raft layer
|
# this is a raft layer
|
||||||
# push @raft, @path;
|
push @raft, @path;
|
||||||
# } else {
|
} else {
|
||||||
# push @first_object_layer, @path;
|
push @first_object_layer, @path;
|
||||||
# $first_object_layer_speeds{ $args->{F} // $self->F } = 1;
|
$first_object_layer_speeds{ $args->{F} // $self->F } = 1;
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
# } elsif ($cmd eq 'G1' && $info->{dist_Z} > 0) {
|
} elsif ($cmd eq 'G1' && $info->{dist_Z} > 0) {
|
||||||
# $layer_id++;
|
$layer_id++;
|
||||||
# }
|
}
|
||||||
# });
|
});
|
||||||
#
|
|
||||||
# ok !@{diff(\@first_object_layer, \@raft)},
|
ok !@{diff(\@first_object_layer, \@raft)},
|
||||||
# 'first object layer is completely supported by raft';
|
'first object layer is completely supported by raft';
|
||||||
# is scalar(keys %first_object_layer_speeds), 1,
|
is scalar(keys %first_object_layer_speeds), 1,
|
||||||
# 'only one speed used in first object layer';
|
'only one speed used in first object layer';
|
||||||
# ok +(keys %first_object_layer_speeds)[0] == $config->bridge_speed*60,
|
ok +(keys %first_object_layer_speeds)[0] == $config->bridge_speed*60,
|
||||||
# 'bridge speed used in first object layer';
|
'bridge speed used in first object layer';
|
||||||
#}
|
}
|
||||||
#
|
|
||||||
#{
|
{
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# $config->set('layer_height', 0.2);
|
$config->set('layer_height', 0.2);
|
||||||
# $config->set('skirts', 0);
|
$config->set('skirts', 0);
|
||||||
# $config->set('raft_layers', 5);
|
$config->set('raft_layers', 5);
|
||||||
# $config->set('support_material_pattern', 'rectilinear');
|
$config->set('support_material_pattern', 'rectilinear');
|
||||||
# $config->set('support_material_extrusion_width', 0.4);
|
$config->set('support_material_extrusion_width', 0.4);
|
||||||
# $config->set('support_material_interface_extrusion_width', 0.6);
|
$config->set('support_material_interface_extrusion_width', 0.6);
|
||||||
# $config->set('support_material_interface_layers', 2);
|
$config->set('support_material_interface_layers', 2);
|
||||||
# $config->set('first_layer_extrusion_width', '100%');
|
$config->set('first_layer_extrusion_width', '100%');
|
||||||
# $config->set('bridge_speed', 99);
|
$config->set('bridge_speed', 99);
|
||||||
# $config->set('cooling', 0); # prevent speed alteration
|
$config->set('cooling', 0); # prevent speed alteration
|
||||||
# $config->set('first_layer_speed', '100%'); # prevent speed alteration
|
$config->set('first_layer_speed', '100%'); # prevent speed alteration
|
||||||
# $config->set('start_gcode', ''); # prevent any unexpected Z move
|
$config->set('start_gcode', ''); # prevent any unexpected Z move
|
||||||
# my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
#
|
|
||||||
# my $layer_id = -1;
|
my $layer_id = -1;
|
||||||
# my $success = 1;
|
my $success = 1;
|
||||||
# Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||||
# my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
# if ($info->{extruding} && $info->{dist_XY} > 0) {
|
if ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
# # this is a raft layer
|
# this is a raft layer
|
||||||
# if (($layer_id < $config->raft_layers) && ($layer_id > 0)) {
|
if (($layer_id < $config->raft_layers) && ($layer_id > 0)) {
|
||||||
# my $width;
|
my $width;
|
||||||
# my $support_layer_height = $config->nozzle_diameter->[0] * 0.75;
|
my $support_layer_height = $config->nozzle_diameter->[0] * 0.75;
|
||||||
#
|
|
||||||
# # support layer
|
# support layer
|
||||||
# if ($config->raft_layers - $config->support_material_interface_layers > $layer_id) {
|
if ($config->raft_layers - $config->support_material_interface_layers > $layer_id) {
|
||||||
# $width = $config->support_material_extrusion_width;
|
$width = $config->support_material_extrusion_width;
|
||||||
# }
|
}
|
||||||
# # interface layer
|
# interface layer
|
||||||
# else {
|
else {
|
||||||
# $width = $config->support_material_interface_extrusion_width;
|
$width = $config->support_material_interface_extrusion_width;
|
||||||
# }
|
}
|
||||||
# my $expected_E_per_mm3 = 4 / (($config->filament_diameter->[0]**2) * PI);
|
my $expected_E_per_mm3 = 4 / (($config->filament_diameter->[0]**2) * PI);
|
||||||
# my $expected_mm3_per_mm = $width * $support_layer_height + ($support_layer_height**2) / 4.0 * (PI-4.0);
|
my $expected_mm3_per_mm = $width * $support_layer_height + ($support_layer_height**2) / 4.0 * (PI-4.0);
|
||||||
# my $expected_e_per_mm = $expected_E_per_mm3 * $expected_mm3_per_mm;
|
my $expected_e_per_mm = $expected_E_per_mm3 * $expected_mm3_per_mm;
|
||||||
#
|
|
||||||
# my $e_per_mm = ($info->{dist_E} / $info->{dist_XY});;
|
my $e_per_mm = ($info->{dist_E} / $info->{dist_XY});;
|
||||||
#
|
|
||||||
# my $diff = abs($e_per_mm - $expected_e_per_mm);
|
my $diff = abs($e_per_mm - $expected_e_per_mm);
|
||||||
#
|
|
||||||
# if ($diff > 0.001) {
|
if ($diff > 0.001) {
|
||||||
# $success = 0;
|
$success = 0;
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
# } elsif ($cmd eq 'G1' && $info->{dist_Z} > 0) {
|
} elsif ($cmd eq 'G1' && $info->{dist_Z} > 0) {
|
||||||
# $layer_id++;
|
$layer_id++;
|
||||||
# }
|
}
|
||||||
# });
|
});
|
||||||
#
|
|
||||||
# ok $success,
|
ok $success,
|
||||||
# 'support material interface extrusion width is used for interfaces';
|
'support material interface extrusion width is used for interfaces';
|
||||||
#}
|
}
|
||||||
#
|
|
||||||
#{
|
{
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# $config->set('skirts', 0);
|
$config->set('skirts', 0);
|
||||||
# $config->set('layer_height', 0.35);
|
$config->set('layer_height', 0.35);
|
||||||
# $config->set('first_layer_height', 0.3);
|
$config->set('first_layer_height', 0.3);
|
||||||
# $config->set('nozzle_diameter', [0.5]);
|
$config->set('nozzle_diameter', [0.5]);
|
||||||
# $config->set('support_material_extruder', 2);
|
$config->set('support_material_extruder', 2);
|
||||||
# $config->set('support_material_interface_extruder', 2);
|
$config->set('support_material_interface_extruder', 2);
|
||||||
#
|
|
||||||
# my $test = sub {
|
my $test = sub {
|
||||||
# my ($raft_layers) = @_;
|
my ($raft_layers) = @_;
|
||||||
# $config->set('raft_layers', $raft_layers);
|
$config->set('raft_layers', $raft_layers);
|
||||||
# my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
# my %raft_z = (); # z => 1
|
my %raft_z = (); # z => 1
|
||||||
# my $tool = undef;
|
my $tool = undef;
|
||||||
# Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||||
# my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
#
|
|
||||||
# if ($cmd =~ /^T(\d+)/) {
|
if ($cmd =~ /^T(\d+)/) {
|
||||||
# $tool = $1;
|
$tool = $1;
|
||||||
# } elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
} elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
# if ($tool == $config->support_material_extruder-1) {
|
if ($tool == $config->support_material_extruder-1) {
|
||||||
# $raft_z{$self->Z} = 1;
|
$raft_z{$self->Z} = 1;
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
# });
|
});
|
||||||
#
|
|
||||||
# is scalar(keys %raft_z), $config->raft_layers, 'correct number of raft layers is generated';
|
is scalar(keys %raft_z), $config->raft_layers, 'correct number of raft layers is generated';
|
||||||
# };
|
};
|
||||||
#
|
|
||||||
# $test->(2);
|
$test->(2);
|
||||||
# $test->(70);
|
$test->(70);
|
||||||
#
|
|
||||||
# $config->set('layer_height', 0.4);
|
$config->set('layer_height', 0.4);
|
||||||
# $config->set('first_layer_height', 0.35);
|
$config->set('first_layer_height', 0.35);
|
||||||
# $test->(3);
|
$test->(3);
|
||||||
# $test->(70);
|
$test->(70);
|
||||||
#}
|
}
|
||||||
#
|
|
||||||
#{
|
{
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# $config->set('brim_width', 0);
|
$config->set('brim_width', 0);
|
||||||
# $config->set('skirts', 0);
|
$config->set('skirts', 0);
|
||||||
# $config->set('support_material', 1);
|
$config->set('support_material', 1);
|
||||||
# $config->set('top_solid_layers', 0); # so that we don't have the internal bridge over infill
|
$config->set('top_solid_layers', 0); # so that we don't have the internal bridge over infill
|
||||||
# $config->set('bridge_speed', 99);
|
$config->set('bridge_speed', 99);
|
||||||
# $config->set('cooling', 0);
|
$config->set('cooling', 0);
|
||||||
# $config->set('first_layer_speed', '100%');
|
$config->set('first_layer_speed', '100%');
|
||||||
#
|
|
||||||
# my $test = sub {
|
my $test = sub {
|
||||||
# my $print = Slic3r::Test::init_print('overhang', config => $config);
|
my $print = Slic3r::Test::init_print('overhang', config => $config);
|
||||||
#
|
|
||||||
# my $has_bridge_speed = 0;
|
my $has_bridge_speed = 0;
|
||||||
# Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||||
# my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
#
|
|
||||||
# if ($info->{extruding}) {
|
if ($info->{extruding}) {
|
||||||
# if (($args->{F} // $self->F) == $config->bridge_speed*60) {
|
if (($args->{F} // $self->F) == $config->bridge_speed*60) {
|
||||||
# $has_bridge_speed = 1;
|
$has_bridge_speed = 1;
|
||||||
# }
|
}
|
||||||
# }
|
}
|
||||||
# });
|
});
|
||||||
# return $has_bridge_speed;
|
return $has_bridge_speed;
|
||||||
# };
|
};
|
||||||
#
|
|
||||||
# $config->set('support_material_contact_distance', 0.2);
|
$config->set('support_material_contact_distance', 0.2);
|
||||||
# ok $test->(), 'bridge speed is used when support_material_contact_distance > 0';
|
ok $test->(), 'bridge speed is used when support_material_contact_distance > 0';
|
||||||
#
|
|
||||||
# $config->set('support_material_contact_distance', 0);
|
$config->set('support_material_contact_distance', 0);
|
||||||
# ok !$test->(), 'bridge speed is not used when support_material_contact_distance == 0';
|
ok !$test->(), 'bridge speed is not used when support_material_contact_distance == 0';
|
||||||
#
|
|
||||||
# $config->set('raft_layers', 5);
|
$config->set('raft_layers', 5);
|
||||||
# $config->set('support_material_contact_distance', 0.2);
|
$config->set('support_material_contact_distance', 0.2);
|
||||||
# ok $test->(), 'bridge speed is used when raft_layers > 0 and support_material_contact_distance > 0';
|
ok $test->(), 'bridge speed is used when raft_layers > 0 and support_material_contact_distance > 0';
|
||||||
#
|
|
||||||
# $config->set('support_material_contact_distance', 0);
|
$config->set('support_material_contact_distance', 0);
|
||||||
# ok !$test->(), 'bridge speed is not used when raft_layers > 0 and support_material_contact_distance == 0';
|
ok !$test->(), 'bridge speed is not used when raft_layers > 0 and support_material_contact_distance == 0';
|
||||||
#}
|
}
|
||||||
#
|
|
||||||
#{
|
{
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# $config->set('skirts', 0);
|
$config->set('skirts', 0);
|
||||||
# $config->set('start_gcode', '');
|
$config->set('start_gcode', '');
|
||||||
# $config->set('raft_layers', 8);
|
$config->set('raft_layers', 8);
|
||||||
# $config->set('nozzle_diameter', [0.4, 1]);
|
$config->set('nozzle_diameter', [0.4, 1]);
|
||||||
# $config->set('layer_height', 0.1);
|
$config->set('layer_height', 0.1);
|
||||||
# $config->set('first_layer_height', 0.8);
|
$config->set('first_layer_height', 0.8);
|
||||||
# $config->set('support_material_extruder', 2);
|
$config->set('support_material_extruder', 2);
|
||||||
# $config->set('support_material_interface_extruder', 2);
|
$config->set('support_material_interface_extruder', 2);
|
||||||
# $config->set('support_material_contact_distance', 0);
|
$config->set('support_material_contact_distance', 0);
|
||||||
# my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
# ok my $gcode = Slic3r::Test::gcode($print), 'first_layer_height is validated with support material extruder nozzle diameter when using raft layers';
|
ok my $gcode = Slic3r::Test::gcode($print), 'first_layer_height is validated with support material extruder nozzle diameter when using raft layers';
|
||||||
#
|
|
||||||
# my $tool = undef;
|
my $tool = undef;
|
||||||
# my @z = (0);
|
my @z = (0);
|
||||||
# my %layer_heights_by_tool = (); # tool => [ lh, lh... ]
|
my %layer_heights_by_tool = (); # tool => [ lh, lh... ]
|
||||||
# Slic3r::GCode::Reader->new->parse($gcode, sub {
|
Slic3r::GCode::Reader->new->parse($gcode, sub {
|
||||||
# my ($self, $cmd, $args, $info) = @_;
|
my ($self, $cmd, $args, $info) = @_;
|
||||||
#
|
|
||||||
# if ($cmd =~ /^T(\d+)/) {
|
if ($cmd =~ /^T(\d+)/) {
|
||||||
# $tool = $1;
|
$tool = $1;
|
||||||
# } elsif ($cmd eq 'G1' && exists $args->{Z} && $args->{Z} != $self->Z) {
|
} elsif ($cmd eq 'G1' && exists $args->{Z} && $args->{Z} != $self->Z) {
|
||||||
# push @z, $args->{Z};
|
push @z, $args->{Z};
|
||||||
# } elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
} elsif ($info->{extruding} && $info->{dist_XY} > 0) {
|
||||||
# $layer_heights_by_tool{$tool} ||= [];
|
$layer_heights_by_tool{$tool} ||= [];
|
||||||
# push @{ $layer_heights_by_tool{$tool} }, $z[-1] - $z[-2];
|
push @{ $layer_heights_by_tool{$tool} }, $z[-1] - $z[-2];
|
||||||
# }
|
}
|
||||||
# });
|
});
|
||||||
#
|
|
||||||
# ok !defined(first { $_ > $config->nozzle_diameter->[0] + epsilon }
|
ok !defined(first { $_ > $config->nozzle_diameter->[0] + epsilon }
|
||||||
# @{ $layer_heights_by_tool{$config->perimeter_extruder-1} }),
|
@{ $layer_heights_by_tool{$config->perimeter_extruder-1} }),
|
||||||
# 'no object layer is thicker than nozzle diameter';
|
'no object layer is thicker than nozzle diameter';
|
||||||
#
|
|
||||||
# ok !defined(first { abs($_ - $config->layer_height) < epsilon }
|
ok !defined(first { abs($_ - $config->layer_height) < epsilon }
|
||||||
# @{ $layer_heights_by_tool{$config->support_material_extruder-1} }),
|
@{ $layer_heights_by_tool{$config->support_material_extruder-1} }),
|
||||||
# 'no support material layer is as thin as object layers';
|
'no support material layer is as thin as object layers';
|
||||||
#}
|
}
|
||||||
#
|
{
|
||||||
#{
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
# my $config = Slic3r::Config->new_from_defaults;
|
$config->set('support_material_enforce_layers', 100);
|
||||||
# $config->set('support_material_enforce_layers', 100);
|
$config->set('support_material', 0);
|
||||||
# $config->set('support_material', 0);
|
my @contact_z = my @top_z = ();
|
||||||
# my @contact_z = my @top_z = ();
|
|
||||||
#
|
my $test = sub {
|
||||||
# my $test = sub {
|
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||||
# my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
my $flow = $print->print->objects->[0]->support_material_flow;
|
||||||
# my $flow = $print->print->objects->[0]->support_material_flow;
|
my $support = Slic3r::Print::SupportMaterial->new(
|
||||||
# my $support = Slic3r::Print::SupportMaterial->new(
|
object_config => $print->print->objects->[0]->config,
|
||||||
# object_config => $print->print->objects->[0]->config,
|
print_config => $print->print->config,
|
||||||
# print_config => $print->print->config,
|
flow => $flow,
|
||||||
# flow => $flow,
|
interface_flow => $flow,
|
||||||
# interface_flow => $flow,
|
first_layer_flow => $flow,
|
||||||
# first_layer_flow => $flow,
|
);
|
||||||
# );
|
my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
|
||||||
# my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
|
|
||||||
#
|
is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0,
|
||||||
# is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0,
|
'forced support is generated';
|
||||||
# 'forced support is generated';
|
|
||||||
#
|
};
|
||||||
# };
|
$config->set('layer_height', 0.2);
|
||||||
# $config->set('layer_height', 0.2);
|
$config->set('first_layer_height', 0.3);
|
||||||
# $config->set('first_layer_height', 0.3);
|
@contact_z = (1.9);
|
||||||
# @contact_z = (1.9);
|
@top_z = (1.1);
|
||||||
# @top_z = (1.1);
|
$test->();
|
||||||
# $test->();
|
}
|
||||||
#}
|
|
||||||
__END__
|
__END__
|
||||||
|
@ -28,7 +28,7 @@ SupportMaterial::generate_toolpaths(PrintObject *object,
|
|||||||
params.circle = create_circle(params.circle_radius);
|
params.circle = create_circle(params.circle_radius);
|
||||||
|
|
||||||
#ifdef SLIC3R_DEBUG
|
#ifdef SLIC3R_DEBUG
|
||||||
printf("Generating patterns\n");
|
printf("Generating patterns.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Prepare fillers.
|
// Prepare fillers.
|
||||||
@ -448,7 +448,7 @@ SupportMaterial::contact_area(PrintObject *object)
|
|||||||
if (difference.empty()) continue;
|
if (difference.empty()) continue;
|
||||||
|
|
||||||
// NOTE: this is not the full overhang as it misses the outermost half of the perimeter width!
|
// NOTE: this is not the full overhang as it misses the outermost half of the perimeter width!
|
||||||
append_polygons(tmp_overhang, difference);
|
append_to(tmp_overhang, difference);
|
||||||
|
|
||||||
// Let's define the required contact area by using a max gap of half the upper
|
// Let's define the required contact area by using a max gap of half the upper
|
||||||
// extrusion width and extending the area according to the configured margin.
|
// extrusion width and extending the area according to the configured margin.
|
||||||
@ -473,7 +473,7 @@ SupportMaterial::contact_area(PrintObject *object)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
append_polygons(tmp_contact, difference);
|
append_to(tmp_contact, difference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tmp_contact.empty())
|
if (tmp_contact.empty())
|
||||||
@ -666,22 +666,22 @@ SupportMaterial::generate_base_layers(vector<coordf_t> support_z,
|
|||||||
// (1 interface layer means we only have contact layer, so $interface->{$i+1} is empty).
|
// (1 interface layer means we only have contact layer, so $interface->{$i+1} is empty).
|
||||||
Polygons upper_contact;
|
Polygons upper_contact;
|
||||||
if (object_config->support_material_interface_layers.value <= 1) {
|
if (object_config->support_material_interface_layers.value <= 1) {
|
||||||
append_polygons(upper_contact, (i + 1 < support_z.size() ? contact[support_z[i + 1]] : contact[-1]));
|
append_to(upper_contact, (i + 1 < support_z.size() ? contact[support_z[i + 1]] : contact[-1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygons ps_1;
|
Polygons ps_1;
|
||||||
append_polygons(ps_1, base[i + 1]); // support regions on upper layer.
|
append_to(ps_1, base[i + 1]); // support regions on upper layer.
|
||||||
append_polygons(ps_1, interface[i + 1]); // interface regions on upper layer
|
append_to(ps_1, interface[i + 1]); // interface regions on upper layer
|
||||||
append_polygons(ps_1, upper_contact); // contact regions on upper layer
|
append_to(ps_1, upper_contact); // contact regions on upper layer
|
||||||
|
|
||||||
Polygons ps_2;
|
Polygons ps_2;
|
||||||
for (auto el : overlapping_z) {
|
for (auto el : overlapping_z) {
|
||||||
if (top.count(el) > 0)
|
if (top.count(el) > 0)
|
||||||
append_polygons(ps_2, top[el]); // top slices on this layer.
|
append_to(ps_2, top[el]); // top slices on this layer.
|
||||||
if (interface.count(el) > 0)
|
if (interface.count(el) > 0)
|
||||||
append_polygons(ps_2, interface[el]); // interface regions on this layer.
|
append_to(ps_2, interface[el]); // interface regions on this layer.
|
||||||
if (contact.count(el) > 0)
|
if (contact.count(el) > 0)
|
||||||
append_polygons(ps_2, contact[el]); // contact regions on this layer.
|
append_to(ps_2, contact[el]); // contact regions on this layer.
|
||||||
}
|
}
|
||||||
|
|
||||||
base[i] = diff(
|
base[i] = diff(
|
||||||
@ -725,15 +725,15 @@ SupportMaterial::generate_interface_layers(vector<coordf_t> support_z,
|
|||||||
// surfaces vertically before performing the diff, but this needs
|
// surfaces vertically before performing the diff, but this needs
|
||||||
// investigation.
|
// investigation.
|
||||||
Polygons ps_1;
|
Polygons ps_1;
|
||||||
append_polygons(ps_1, _contact); // clipped projection of the current contact regions.
|
append_to(ps_1, _contact); // clipped projection of the current contact regions.
|
||||||
append_polygons(ps_1, interface[i]); // interface regions already applied to this layer.
|
append_to(ps_1, interface[i]); // interface regions already applied to this layer.
|
||||||
|
|
||||||
Polygons ps_2;
|
Polygons ps_2;
|
||||||
for (auto el : overlapping_z) {
|
for (auto el : overlapping_z) {
|
||||||
if (top.count(el) > 0)
|
if (top.count(el) > 0)
|
||||||
append_polygons(ps_2, top[el]); // top slices on this layer.
|
append_to(ps_2, top[el]); // top slices on this layer.
|
||||||
if (contact.count(el) > 0)
|
if (contact.count(el) > 0)
|
||||||
append_polygons(ps_2, contact[el]); // contact regions on this layer.
|
append_to(ps_2, contact[el]); // contact regions on this layer.
|
||||||
}
|
}
|
||||||
|
|
||||||
_contact = interface[i] = diff(
|
_contact = interface[i] = diff(
|
||||||
@ -792,7 +792,7 @@ SupportMaterial::generate_bottom_interface_layers(const vector<coordf_t> &suppor
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add the new interface area to interface.
|
// Add the new interface area to interface.
|
||||||
append_polygons(interface[layer_id], interface_area);
|
append_to(interface[layer_id], interface_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface_layers++;
|
interface_layers++;
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
/// Generate support material for the given print object.
|
/// Generate support material for the given print object.
|
||||||
void generate(PrintObject *object);
|
void generate(PrintObject *object);
|
||||||
|
|
||||||
/// Generate the support layers z coordinates. (TODO Dicuss more).
|
/// Generate the support layers slicing z coordinates.
|
||||||
vector<coordf_t> support_layers_z(vector<coordf_t> contact_z,
|
vector<coordf_t> support_layers_z(vector<coordf_t> contact_z,
|
||||||
vector<coordf_t> top_z,
|
vector<coordf_t> top_z,
|
||||||
coordf_t max_object_layer_height);
|
coordf_t max_object_layer_height);
|
||||||
@ -140,7 +140,7 @@ private:
|
|||||||
// Get the maximum layer height given a print object.
|
// Get the maximum layer height given a print object.
|
||||||
coordf_t get_max_layer_height(PrintObject *object);
|
coordf_t get_max_layer_height(PrintObject *object);
|
||||||
|
|
||||||
// (Deprecated) use append_to instead TODO @Samir55.
|
// (Deprecated) use append_to instead
|
||||||
void append_polygons(Polygons &dst, Polygons &src);
|
void append_polygons(Polygons &dst, Polygons &src);
|
||||||
|
|
||||||
// Return polygon vector given a vector of surfaces.
|
// Return polygon vector given a vector of surfaces.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user