@@ -71,12 +71,12 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
71
71
Slic3r::Model model;
72
72
auto gcode {std::stringstream (" " )};
73
73
gcode.clear ();
74
+ const double used_layer_height = 0.01 ;
74
75
GIVEN (" A default configuration" ) {
75
76
auto config {Config::new_from_defaults ()};
76
77
config->set (" support_material_speed" , 99 );
77
- config->set (" first_layer_height" , 0.3 );
78
+ config->set (" first_layer_height" , used_layer_height );
78
79
config->set (" gcode_comments" , true );
79
-
80
80
// avoid altering speeds unexpectedly
81
81
config->set (" cooling" , false );
82
82
config->set (" first_layer_speed" , " 100%" );
@@ -88,21 +88,55 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
88
88
config->set (" perimeters" , 0 );
89
89
config->set (" skirts" , 0 );
90
90
config->set (" brim_width" , 5 );
91
+ config->set (" interior_brim_width" , 0 );
92
+ config->set (" brim_connections_width" , 0 );
93
+ config->set (" first_layer_extrusion_width" , 0.10 );
94
+ config->set (" extrusion_width" , 0.10 );
95
+ config->set (" nozzle_diameter" , " 0.05" );
96
+ THEN (" Configuration is sane." ) {
97
+ REQUIRE (config->get <ConfigOptionFloatOrPercent>(" first_layer_extrusion_width" ).get_abs_value (used_layer_height) > 0.05 );
98
+ REQUIRE (used_layer_height < 0.05 );
99
+ }
91
100
THEN (" Brim is generated" ) {
92
101
auto print {Slic3r::Test::init_print ({TestMesh::cube_20x20x20}, model, config)};
93
102
Slic3r::Test::gcode (gcode, print);
94
103
bool brim_generated = false ;
95
104
auto support_speed = config->get <ConfigOptionFloat>(" support_material_speed" ) * MM_PER_MIN;
96
- parser.parse_stream (gcode, [&brim_generated, support_speed] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
105
+ parser.parse_stream (gcode, [&brim_generated, support_speed, used_layer_height ] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
97
106
{
98
- if (self.Z == Approx (0.3 ) || line.new_Z () == Approx (0.3 )) {
107
+ if (self.Z == Approx (used_layer_height ) || line.new_Z () == Approx (used_layer_height )) {
99
108
if (line.extruding () && self.F == Approx (support_speed)) {
100
109
brim_generated = true ;
101
110
}
102
111
}
103
112
});
104
113
REQUIRE (brim_generated);
105
114
}
115
+ THEN (" Brim width is 5mm around the object." ) {
116
+ auto print {Slic3r::Test::init_print ({TestMesh::cube_20x20x20}, model, config, false , Slic3r::Pointf (0 , 0 ))};
117
+ Slic3r::Test::gcode (gcode, print);
118
+ double max_x = 0 , min_x = 0 , max_y = 0 , min_y = 0 ;
119
+ auto support_speed = config->get <ConfigOptionFloat>(" support_material_speed" ) * MM_PER_MIN;
120
+ auto line_width = config->get <ConfigOptionFloatOrPercent>(" first_layer_extrusion_width" ).get_abs_value (used_layer_height);
121
+ auto brim = config->get <ConfigOptionFloat>(" brim_width" );
122
+ parser.parse_stream (gcode, [&max_x, &max_y, &min_x, &min_y, line_width, support_speed, used_layer_height] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
123
+ {
124
+ if (self.Z == Approx (used_layer_height) || line.new_Z () == Approx (used_layer_height)) {
125
+ if (line.extruding () && self.F == Approx (support_speed)) {
126
+ max_x = std::max (double (self.X ), max_x);
127
+ min_x = std::min (double (self.X ), min_x);
128
+ max_y = std::max (double (self.Y ), max_y);
129
+ min_y = std::min (double (self.Y ), min_y);
130
+ }
131
+ }
132
+ });
133
+ // match the centerline of our extrusion min/max, should be very close to +/-15mm
134
+ REQUIRE (max_x == Approx (15.0 -(line_width / 2.0 )).epsilon (line_width * 0.01 ));
135
+ REQUIRE (max_y == Approx (15.0 -(line_width / 2.0 )).epsilon (line_width * 0.01 ));
136
+ REQUIRE (min_x == Approx (-15.0 +(line_width / 2.0 )).epsilon (line_width * 0.01 ));
137
+ REQUIRE (min_y == Approx (-15.0 +(line_width / 2.0 )).epsilon (line_width * 0.01 ));
138
+ }
139
+
106
140
}
107
141
108
142
WHEN (" Skirt area is smaller than the brim" ) {
0 commit comments