diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index f020935e0..ef00d8fe2 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -97,6 +97,13 @@ Print::delete_object(size_t idx) void Print::process() { + if (this->status_cb != nullptr) + this->status_cb(70, "Infilling layers"); + for(auto obj : this->objects) { obj->_infill(); } + for(auto obj : this->objects) { obj->generate_support_material(); } + + this->make_skirt(); + this->make_brim(); // must follow make_skirt } void diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index 78dd0b963..9c11ee085 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -136,6 +136,10 @@ class PrintObject void delete_layer(int idx); SupportMaterial* _support_material(); + + /// Initialize and generate support material. + void generate_support_material(); + Flow _support_material_flow(FlowRole role = frSupportMaterial); size_t support_layer_count() const; void clear_support_layers(); diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index 7af318b45..c305471fb 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -1146,4 +1146,39 @@ PrintObject::_support_material_flow(FlowRole role) return support_flow; } + +void +PrintObject::generate_support_material() +{ + auto* print { this->_print }; + auto& config {this->config }; + //prereqs + this->_slice(); + if (this->state.is_done(posSupportMaterial)) { return; } + + this->state.set_started(posSupportMaterial); + + this->clear_support_layers(); + + if ((!config.support_material + && config.raft_layers == 0 + && config.support_material_enforce_layers == 0) + || this->layers.size() < 2 + ) { + this->state.set_done(posSupportMaterial); + return; + } + if (print->status_cb != nullptr) + print->status_cb(85, "Generating support material"); + + this->_support_material()->generate(this); + + this->state.set_done(posSupportMaterial); + + std::stringstream stats {""}; + + if (print->status_cb != nullptr) + print->status_cb(85, stats.str().c_str()); + +} }