mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 08:45:56 +08:00
Moved constructor to cpp file
This commit is contained in:
parent
11bb5c3117
commit
321b5893b8
@ -129,10 +129,10 @@ PrintGCode::output()
|
|||||||
if (include_start_extruder_temp) this->_print_first_layer_temperature(0);
|
if (include_start_extruder_temp) this->_print_first_layer_temperature(0);
|
||||||
|
|
||||||
// Apply gcode math to start and end gcode
|
// Apply gcode math to start and end gcode
|
||||||
// fh << apply_math(gcodegen.placeholder_parser->process(config.start_gcode.value));
|
fh << apply_math(gcodegen.placeholder_parser->process(config.start_gcode.value));
|
||||||
|
|
||||||
for(const auto& start_gcode : config.start_filament_gcode.values) {
|
for(const auto& start_gcode : config.start_filament_gcode.values) {
|
||||||
// fh << apply_math(gcodegen.placeholder_parser->process(start_gcode));
|
fh << apply_math(gcodegen.placeholder_parser->process(start_gcode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (include_start_extruder_temp) this->_print_first_layer_temperature(1);
|
if (include_start_extruder_temp) this->_print_first_layer_temperature(1);
|
||||||
@ -143,12 +143,12 @@ PrintGCode::output()
|
|||||||
|
|
||||||
// initialize motion planner for object-to-object travel moves
|
// initialize motion planner for object-to-object travel moves
|
||||||
if (config.avoid_crossing_perimeters.getBool()) {
|
if (config.avoid_crossing_perimeters.getBool()) {
|
||||||
auto distance_from_objects {scale_(1)};
|
|
||||||
|
|
||||||
// compute the offsetted convex hull for each object and repeat it for each copy
|
// compute the offsetted convex hull for each object and repeat it for each copy
|
||||||
Polygons islands_p {};
|
Polygons islands_p {};
|
||||||
for (auto object : this->objects) {
|
for (auto object : this->objects) {
|
||||||
Polygons polygons {};
|
Polygons polygons {};
|
||||||
|
// Add polygons that aren't just thin walls.
|
||||||
for (auto layer : object->layers) {
|
for (auto layer : object->layers) {
|
||||||
const auto& slice {ExPolygons(layer->slices)};
|
const auto& slice {ExPolygons(layer->slices)};
|
||||||
std::for_each(slice.cbegin(), slice.cend(), [&polygons] (const ExPolygon& a) { polygons.emplace_back(a.contour); });
|
std::for_each(slice.cbegin(), slice.cend(), [&polygons] (const ExPolygon& a) { polygons.emplace_back(a.contour); });
|
||||||
@ -207,5 +207,30 @@ PrintGCode::_print_first_layer_temperature(bool wait)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrintGCode::PrintGCode(Slic3r::Print& print, std::ostream& _fh) :
|
||||||
|
_print(print),
|
||||||
|
config(print.config),
|
||||||
|
_gcodegen(Slic3r::GCode()),
|
||||||
|
objects(print.objects),
|
||||||
|
fh(_fh),
|
||||||
|
_cooling_buffer(Slic3r::CoolingBuffer(this->_gcodegen)),
|
||||||
|
_spiral_vase(Slic3r::SpiralVase(this->config))
|
||||||
|
{
|
||||||
|
size_t layer_count {0};
|
||||||
|
if (config.complete_objects) {
|
||||||
|
layer_count = std::accumulate(objects.cbegin(), objects.cend(), layer_count, [](const size_t& ret, const PrintObject* obj){ return ret + (obj->copies().size() * obj->total_layer_count()); });
|
||||||
|
} else {
|
||||||
|
layer_count = std::accumulate(objects.cbegin(), objects.cend(), layer_count, [](const size_t& ret, const PrintObject* obj){ return ret + obj->total_layer_count(); });
|
||||||
|
}
|
||||||
|
_gcodegen.placeholder_parser = &(print.placeholder_parser); // initialize
|
||||||
|
_gcodegen.layer_count = layer_count;
|
||||||
|
_gcodegen.enable_cooling_markers = true;
|
||||||
|
_gcodegen.apply_print_config(config);
|
||||||
|
std::cerr << "Setting " << print.extruders().size() << "\n";
|
||||||
|
|
||||||
|
auto extruders {print.extruders()};
|
||||||
|
_gcodegen.set_extruders(extruders.cbegin(), extruders.cend());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
#endif //SLIC3RXS
|
#endif //SLIC3RXS
|
||||||
|
@ -17,15 +17,8 @@ namespace Slic3r {
|
|||||||
|
|
||||||
class PrintGCode {
|
class PrintGCode {
|
||||||
public:
|
public:
|
||||||
PrintGCode(Slic3r::Print& print, std::ostream& _fh) :
|
/// Constructor.
|
||||||
_print(print),
|
PrintGCode(Slic3r::Print& print, std::ostream& _fh);
|
||||||
config(print.config),
|
|
||||||
_gcodegen(Slic3r::GCode()),
|
|
||||||
objects(print.objects),
|
|
||||||
fh(_fh),
|
|
||||||
_cooling_buffer(Slic3r::CoolingBuffer(this->_gcodegen)),
|
|
||||||
_spiral_vase(Slic3r::SpiralVase(this->config))
|
|
||||||
{ };
|
|
||||||
|
|
||||||
/// Perform the export. export is a reserved name in C++, so changed to output
|
/// Perform the export. export is a reserved name in C++, so changed to output
|
||||||
void output();
|
void output();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user