Stubbed out/implemented Print::process and generate_support_material.

(w/o unit tests)
This commit is contained in:
Joseph Lenox 2018-07-16 17:12:32 -05:00
parent 321b5893b8
commit eedf81e871
3 changed files with 46 additions and 0 deletions

View File

@ -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

View File

@ -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();

View File

@ -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());
}
}