mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
fix for progress indication values
This commit is contained in:
parent
5c141d9f10
commit
3bd1734daa
1 changed files with 43 additions and 29 deletions
|
@ -28,14 +28,15 @@ public:
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// should add up to 100 (%)
|
||||||
const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS =
|
const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS =
|
||||||
{
|
{
|
||||||
0,
|
10, // slaposObjectSlice,
|
||||||
20,
|
10, // slaposSupportIslands,
|
||||||
30,
|
20, // slaposSupportPoints,
|
||||||
50,
|
25, // slaposSupportTree,
|
||||||
70,
|
25, // slaposBasePool,
|
||||||
90
|
10 // slaposSliceSupports,
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::array<std::string, slaposCount> OBJ_STEP_LABELS =
|
const std::array<std::string, slaposCount> OBJ_STEP_LABELS =
|
||||||
|
@ -48,11 +49,11 @@ const std::array<std::string, slaposCount> OBJ_STEP_LABELS =
|
||||||
L("Slicing supports") // slaposSliceSupports,
|
L("Slicing supports") // slaposSliceSupports,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Should also add up to 100 (%)
|
||||||
const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS =
|
const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS =
|
||||||
{
|
{
|
||||||
// This is after processing all the Print objects, so we start from 50%
|
80, // slapsRasterize
|
||||||
50, // slapsRasterize
|
20, // slapsValidate
|
||||||
90, // slapsValidate
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::array<std::string, slapsCount> PRINT_STEP_LABELS =
|
const std::array<std::string, slapsCount> PRINT_STEP_LABELS =
|
||||||
|
@ -132,6 +133,11 @@ void SLAPrint::process()
|
||||||
// shortcut to initial layer height
|
// shortcut to initial layer height
|
||||||
double ilhd = m_material_config.initial_layer_height.getFloat();
|
double ilhd = m_material_config.initial_layer_height.getFloat();
|
||||||
auto ilh = float(ilhd);
|
auto ilh = float(ilhd);
|
||||||
|
const size_t objcount = m_objects.size();
|
||||||
|
|
||||||
|
const unsigned min_objstatus = 0;
|
||||||
|
const unsigned max_objstatus = 80;
|
||||||
|
const double ostepd = (max_objstatus - min_objstatus) / (objcount * 100.0);
|
||||||
|
|
||||||
// The slicing will be performed on an imaginary 1D grid which starts from
|
// The slicing will be performed on an imaginary 1D grid which starts from
|
||||||
// the bottom of the bounding box created around the supported model. So
|
// the bottom of the bounding box created around the supported model. So
|
||||||
|
@ -188,7 +194,7 @@ void SLAPrint::process()
|
||||||
};
|
};
|
||||||
|
|
||||||
// In this step we create the supports
|
// In this step we create the supports
|
||||||
auto support_tree = [this](SLAPrintObject& po) {
|
auto support_tree = [this, objcount, ostepd](SLAPrintObject& po) {
|
||||||
if(!po.m_supportdata) return;
|
if(!po.m_supportdata) return;
|
||||||
|
|
||||||
auto& emesh = po.m_supportdata->emesh;
|
auto& emesh = po.m_supportdata->emesh;
|
||||||
|
@ -207,10 +213,15 @@ void SLAPrint::process()
|
||||||
scfg.pillar_radius_mm = c.support_pillar_radius.getFloat();
|
scfg.pillar_radius_mm = c.support_pillar_radius.getFloat();
|
||||||
|
|
||||||
sla::Controller ctl;
|
sla::Controller ctl;
|
||||||
ctl.statuscb = [this](unsigned st, const std::string& msg) {
|
|
||||||
unsigned stinit = OBJ_STEP_LEVELS[slaposSupportTree];
|
auto stfirst = OBJ_STEP_LEVELS.begin();
|
||||||
double d = (OBJ_STEP_LEVELS[slaposBasePool] - stinit) / 100.0;
|
auto stthis = stfirst + slaposSupportTree;
|
||||||
set_status(unsigned(stinit + st*d), msg);
|
unsigned init = std::accumulate(stfirst, stthis, 0);
|
||||||
|
init = unsigned(init * ostepd);
|
||||||
|
double d = *stthis / (objcount * 100.0);
|
||||||
|
|
||||||
|
ctl.statuscb = [this, init, d](unsigned st, const std::string& msg){
|
||||||
|
set_status(unsigned(init + st*d), msg);
|
||||||
};
|
};
|
||||||
ctl.stopcondition = [this](){ return canceled(); };
|
ctl.stopcondition = [this](){ return canceled(); };
|
||||||
ctl.cancelfn = [this]() { throw_if_canceled(); };
|
ctl.cancelfn = [this]() { throw_if_canceled(); };
|
||||||
|
@ -235,7 +246,6 @@ void SLAPrint::process()
|
||||||
po.m_supportdata &&
|
po.m_supportdata &&
|
||||||
po.m_supportdata->support_tree_ptr)
|
po.m_supportdata->support_tree_ptr)
|
||||||
{
|
{
|
||||||
std::cout << "Generating base pool for real" << std::endl;
|
|
||||||
double wt = po.m_config.pad_wall_thickness.getFloat();
|
double wt = po.m_config.pad_wall_thickness.getFloat();
|
||||||
double h = po.m_config.pad_wall_height.getFloat();
|
double h = po.m_config.pad_wall_height.getFloat();
|
||||||
double md = po.m_config.pad_max_merge_distance.getFloat();
|
double md = po.m_config.pad_max_merge_distance.getFloat();
|
||||||
|
@ -417,11 +427,11 @@ void SLAPrint::process()
|
||||||
|
|
||||||
// This is the actual order of steps done on each PrintObject
|
// This is the actual order of steps done on each PrintObject
|
||||||
std::array<SLAPrintObjectStep, slaposCount> objectsteps = {
|
std::array<SLAPrintObjectStep, slaposCount> objectsteps = {
|
||||||
|
slaposObjectSlice, // Support Islands will need this step
|
||||||
slaposSupportIslands,
|
slaposSupportIslands,
|
||||||
slaposSupportPoints,
|
slaposSupportPoints,
|
||||||
slaposSupportTree,
|
slaposSupportTree,
|
||||||
slaposBasePool,
|
slaposBasePool,
|
||||||
slaposObjectSlice,
|
|
||||||
slaposSliceSupports
|
slaposSliceSupports
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -441,13 +451,13 @@ void SLAPrint::process()
|
||||||
[](){} // validate
|
[](){} // validate
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned min_objstatus = 0;
|
|
||||||
const unsigned max_objstatus = PRINT_STEP_LEVELS[slapsRasterize];
|
|
||||||
const size_t objcount = m_objects.size();
|
|
||||||
const double ostepd = (max_objstatus - min_objstatus) / (objcount * 100.0);
|
|
||||||
|
|
||||||
static const auto RELOAD_SCENE = SlicingStatus::RELOAD_SCENE;
|
static const auto RELOAD_SCENE = SlicingStatus::RELOAD_SCENE;
|
||||||
|
|
||||||
|
unsigned st = min_objstatus;
|
||||||
|
unsigned incr = 0;
|
||||||
|
|
||||||
|
// TODO: this loop could run in parallel but should not exhaust all the CPU
|
||||||
|
// power available
|
||||||
for(SLAPrintObject * po : m_objects) {
|
for(SLAPrintObject * po : m_objects) {
|
||||||
for(size_t s = 0; s < objectsteps.size(); ++s) {
|
for(size_t s = 0; s < objectsteps.size(); ++s) {
|
||||||
auto currentstep = objectsteps[s];
|
auto currentstep = objectsteps[s];
|
||||||
|
@ -457,11 +467,10 @@ void SLAPrint::process()
|
||||||
// execution gets to this point and throws the canceled signal.
|
// execution gets to this point and throws the canceled signal.
|
||||||
throw_if_canceled();
|
throw_if_canceled();
|
||||||
|
|
||||||
if(po->m_stepmask[currentstep] && !po->is_step_done(currentstep)) {
|
st += unsigned(incr * ostepd);
|
||||||
po->set_started(currentstep);
|
|
||||||
|
|
||||||
unsigned st = OBJ_STEP_LEVELS[currentstep];
|
if(po->m_stepmask[currentstep] && !po->is_step_done(currentstep) ) {
|
||||||
st = unsigned(min_objstatus + st * ostepd);
|
po->set_started(currentstep);
|
||||||
set_status(st, OBJ_STEP_LABELS[currentstep]);
|
set_status(st, OBJ_STEP_LABELS[currentstep]);
|
||||||
|
|
||||||
pobj_program[currentstep](*po);
|
pobj_program[currentstep](*po);
|
||||||
|
@ -477,6 +486,8 @@ void SLAPrint::process()
|
||||||
set_status(st, L("Visualizing supports"), RELOAD_SCENE);
|
set_status(st, L("Visualizing supports"), RELOAD_SCENE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
incr = OBJ_STEP_LEVELS[currentstep];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,19 +498,22 @@ void SLAPrint::process()
|
||||||
// this would disable the rasterization step
|
// this would disable the rasterization step
|
||||||
// m_stepmask[slapsRasterize] = false;
|
// m_stepmask[slapsRasterize] = false;
|
||||||
|
|
||||||
|
double pstd = (100 - max_objstatus) / 100.0;
|
||||||
|
st = max_objstatus;
|
||||||
for(size_t s = 0; s < print_program.size(); ++s) {
|
for(size_t s = 0; s < print_program.size(); ++s) {
|
||||||
auto currentstep = printsteps[s];
|
auto currentstep = printsteps[s];
|
||||||
|
|
||||||
throw_if_canceled();
|
throw_if_canceled();
|
||||||
|
|
||||||
if(m_stepmask[currentstep] && !is_step_done(currentstep)) {
|
if(m_stepmask[currentstep] && !is_step_done(currentstep))
|
||||||
set_status(PRINT_STEP_LEVELS[currentstep],
|
{
|
||||||
PRINT_STEP_LABELS[currentstep]);
|
set_status(st, PRINT_STEP_LABELS[currentstep]);
|
||||||
|
|
||||||
set_started(currentstep);
|
set_started(currentstep);
|
||||||
print_program[currentstep]();
|
print_program[currentstep]();
|
||||||
set_done(currentstep);
|
set_done(currentstep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
st += unsigned(PRINT_STEP_LEVELS[currentstep] * pstd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If everything vent well
|
// If everything vent well
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue