Support points existence validation.

This commit is contained in:
tamasmeszaros 2018-11-27 13:52:42 +01:00
parent cc557b8a7f
commit 21d5acfdd7

View file

@ -463,6 +463,14 @@ void SLAPrint::process()
po.m_supportdata->emesh = sla::to_eigenmesh(po.transformed_mesh());
po.m_supportdata->support_points =
sla::to_point_set(po.transformed_support_points());
} else if(po.m_config.supports_enable.getBool()) {
// Supports are enabled but there are no support points to process.
// We throw here a runtime exception with some explanation and
// the background processing framework will handle it.
throw std::runtime_error(
L("Supports are enabled but no support points selected."
" Hint: create some support points or disable support "
"creation."));
}
};
@ -487,14 +495,14 @@ void SLAPrint::process()
auto stfirst = OBJ_STEP_LEVELS.begin();
auto stthis = stfirst + slaposSupportTree;
// we need to add up the status portions until this operation
unsigned init = std::accumulate(stfirst, stthis, 0);
init = unsigned(init * ostepd); // scale the init portion
int init = std::accumulate(stfirst, stthis, 0);
init = int(init * ostepd); // scale the init portion
// scaling for the sub operations
double d = *stthis / (objcount * 100.0);
ctl.statuscb = [this, init, d](unsigned st, const std::string& msg){
set_status(unsigned(init + st*d), msg);
set_status(int(init + st*d), msg);
};
ctl.stopcondition = [this](){ return canceled(); };
ctl.cancelfn = [this]() { throw_if_canceled(); };
@ -583,7 +591,7 @@ void SLAPrint::process()
auto smodelgnd = LevelID(scale_(modelgnd));
auto slh = LevelID(scale_(lh));
// It is important that the next levels math the levels in
// It is important that the next levels match the levels in
// model_slice method. Only difference is that here it works with
// scaled coordinates
std::vector<LevelID> levelids;
@ -709,7 +717,7 @@ void SLAPrint::process()
auto st = ist + unsigned(sd*level_id*slot/levels.size());
{ std::lock_guard<SpinMutex> lck(slck);
if( st > pst) {
set_status(st, PRINT_STEP_LABELS[slapsRasterize]);
set_status(int(st), PRINT_STEP_LABELS[slapsRasterize]);
pst = st;
}
}
@ -776,7 +784,7 @@ void SLAPrint::process()
if(po->m_stepmask[currentstep] && po->set_started(currentstep)) {
set_status(st, OBJ_STEP_LABELS[currentstep]);
set_status(int(st), OBJ_STEP_LABELS[currentstep]);
pobj_program[currentstep](*po);
po->set_done(currentstep);
@ -788,7 +796,7 @@ void SLAPrint::process()
// ready. We can grant access for the control thread to read
// the geometries, but first we have to update the caches:
po->support_mesh(); /*po->pad_mesh();*/
set_status(st, L("Visualizing supports"), RELOAD_SCENE);
set_status(int(st), L("Visualizing supports"), RELOAD_SCENE);
}
}
@ -812,7 +820,7 @@ void SLAPrint::process()
if(m_stepmask[currentstep] && set_started(currentstep))
{
set_status(st, PRINT_STEP_LABELS[currentstep]);
set_status(int(st), PRINT_STEP_LABELS[currentstep]);
print_program[currentstep]();
set_done(currentstep);
}
@ -900,12 +908,12 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
std::vector<SLAPrintObjectStep> steps;
bool invalidated = false;
for (const t_config_option_key &opt_key : opt_keys) {
if ( opt_key == "supports_enable"
|| opt_key == "support_head_front_diameter"
if ( opt_key == "support_head_front_radius"
|| opt_key == "support_head_penetration"
|| opt_key == "support_head_back_radius"
|| opt_key == "support_head_width"
|| opt_key == "support_pillar_diameter"
|| opt_key == "support_base_diameter"
|| opt_key == "support_pillar_radius"
|| opt_key == "support_base_radius"
|| opt_key == "support_base_height"
|| opt_key == "support_critical_angle"
|| opt_key == "support_max_bridge_length"
@ -937,21 +945,18 @@ bool SLAPrintObject::invalidate_step(SLAPrintObjectStep step)
if (step == slaposObjectSlice) {
invalidated |= this->invalidate_all_steps();
} else if (step == slaposSupportIslands) {
invalidated |= this->invalidate_steps({ slaposSupportPoints, slaposSupportTree, slaposBasePool, slaposSliceSupports, slaposIndexSlices });
invalidated |= this->invalidate_steps({ slaposSupportPoints, slaposSupportTree, slaposBasePool, slaposSliceSupports });
invalidated |= m_print->invalidate_step(slapsRasterize);
} else if (step == slaposSupportPoints) {
invalidated |= this->invalidate_steps({ slaposSupportTree, slaposBasePool, slaposSliceSupports, slaposIndexSlices });
invalidated |= this->invalidate_steps({ slaposSupportTree, slaposBasePool, slaposSliceSupports });
invalidated |= m_print->invalidate_step(slapsRasterize);
} else if (step == slaposSupportTree) {
invalidated |= this->invalidate_steps({ slaposBasePool, slaposSliceSupports, slaposIndexSlices });
invalidated |= this->invalidate_steps({ slaposBasePool, slaposSliceSupports });
invalidated |= m_print->invalidate_step(slapsRasterize);
} else if (step == slaposBasePool) {
invalidated |= this->invalidate_steps({slaposSliceSupports, slaposIndexSlices});
invalidated |= this->invalidate_step(slaposSliceSupports);
invalidated |= m_print->invalidate_step(slapsRasterize);
} else if (step == slaposSliceSupports) {
invalidated |= this->invalidate_step(slaposIndexSlices);
invalidated |= m_print->invalidate_step(slapsRasterize);
} else if(step == slaposIndexSlices) {
invalidated |= m_print->invalidate_step(slapsRasterize);
}
return invalidated;