mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
ENH: slicing: add cache data load/export for slicing
Change-Id: I88b7c79b6f79ec6bed0f829316b67310cac99b44 (cherry picked from commit 67c1d2e8dd459cc4450ce580632f01e25db038ac)
This commit is contained in:
@@ -37,7 +37,7 @@ bool is_zero_elevation(const SLAPrintObjectConfig &c)
|
||||
sla::SupportTreeConfig make_support_cfg(const SLAPrintObjectConfig& c)
|
||||
{
|
||||
sla::SupportTreeConfig scfg;
|
||||
|
||||
|
||||
scfg.enabled = c.supports_enable.getBool();
|
||||
scfg.head_front_radius_mm = 0.5*c.support_head_front_diameter.getFloat();
|
||||
double pillar_r = 0.5 * c.support_pillar_diameter.getFloat();
|
||||
@@ -66,18 +66,18 @@ sla::SupportTreeConfig make_support_cfg(const SLAPrintObjectConfig& c)
|
||||
scfg.pillar_base_safety_distance_mm =
|
||||
c.support_base_safety_distance.getFloat() < EPSILON ?
|
||||
scfg.safety_distance_mm : c.support_base_safety_distance.getFloat();
|
||||
|
||||
|
||||
scfg.max_bridges_on_pillar = unsigned(c.support_max_bridges_on_pillar.getInt());
|
||||
|
||||
|
||||
return scfg;
|
||||
}
|
||||
|
||||
sla::PadConfig::EmbedObject builtin_pad_cfg(const SLAPrintObjectConfig& c)
|
||||
{
|
||||
sla::PadConfig::EmbedObject ret;
|
||||
|
||||
|
||||
ret.enabled = is_zero_elevation(c);
|
||||
|
||||
|
||||
if(ret.enabled) {
|
||||
ret.everywhere = c.pad_around_object_everywhere.getBool();
|
||||
ret.object_gap_mm = c.pad_object_gap.getFloat();
|
||||
@@ -86,24 +86,24 @@ sla::PadConfig::EmbedObject builtin_pad_cfg(const SLAPrintObjectConfig& c)
|
||||
ret.stick_penetration_mm = c.pad_object_connector_penetration
|
||||
.getFloat();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
sla::PadConfig make_pad_cfg(const SLAPrintObjectConfig& c)
|
||||
{
|
||||
sla::PadConfig pcfg;
|
||||
|
||||
|
||||
pcfg.wall_thickness_mm = c.pad_wall_thickness.getFloat();
|
||||
pcfg.wall_slope = c.pad_wall_slope.getFloat() * PI / 180.0;
|
||||
|
||||
|
||||
pcfg.max_merge_dist_mm = c.pad_max_merge_distance.getFloat();
|
||||
pcfg.wall_height_mm = c.pad_wall_height.getFloat();
|
||||
pcfg.brim_size_mm = c.pad_brim_size.getFloat();
|
||||
|
||||
|
||||
// set builtin pad implicitly ON
|
||||
pcfg.embed_object = builtin_pad_cfg(c);
|
||||
|
||||
|
||||
return pcfg;
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ static std::vector<SLAPrintObject::Instance> sla_instances(const ModelObject &mo
|
||||
return instances;
|
||||
}
|
||||
|
||||
std::vector<ObjectID> SLAPrint::print_object_ids() const
|
||||
{
|
||||
std::vector<ObjectID> SLAPrint::print_object_ids() const
|
||||
{
|
||||
std::vector<ObjectID> out;
|
||||
// Reserve one more for the caller to append the ID of the Print itself.
|
||||
out.reserve(m_objects.size() + 1);
|
||||
@@ -238,7 +238,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig con
|
||||
m_material_config.apply_only(config, material_diff, true);
|
||||
// Handle changes to object config defaults
|
||||
m_default_object_config.apply_only(config, object_diff, true);
|
||||
|
||||
|
||||
if (m_printer) m_printer->apply(m_printer_config);
|
||||
|
||||
struct ModelObjectStatus {
|
||||
@@ -429,7 +429,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig con
|
||||
model_object.sla_support_points = model_object_new.sla_support_points;
|
||||
}
|
||||
model_object.sla_points_status = model_object_new.sla_points_status;
|
||||
|
||||
|
||||
// Invalidate hollowing if drain holes have changed
|
||||
if (model_object.sla_drain_holes != model_object_new.sla_drain_holes)
|
||||
{
|
||||
@@ -629,15 +629,15 @@ StringObjectException SLAPrint::validate(StringObjectException *exception, Polyg
|
||||
sla::SupportTreeConfig cfg = make_support_cfg(po->config());
|
||||
|
||||
double elv = cfg.object_elevation_mm;
|
||||
|
||||
|
||||
sla::PadConfig padcfg = make_pad_cfg(po->config());
|
||||
sla::PadConfig::EmbedObject &builtinpad = padcfg.embed_object;
|
||||
|
||||
|
||||
if(supports_en && !builtinpad.enabled && elv < cfg.head_fullwidth())
|
||||
return {L(
|
||||
"Elevation is too low for object. Use the \"Pad around "
|
||||
"object\" feature to print the object without elevation."), po};
|
||||
|
||||
|
||||
if(supports_en && builtinpad.enabled &&
|
||||
cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) {
|
||||
return {L(
|
||||
@@ -646,7 +646,7 @@ StringObjectException SLAPrint::validate(StringObjectException *exception, Polyg
|
||||
"distance' has to be greater than the 'Pad object gap' "
|
||||
"parameter to avoid this."), po};
|
||||
}
|
||||
|
||||
|
||||
std::string pval = padcfg.validate();
|
||||
if (!pval.empty()) return {pval, po};
|
||||
}
|
||||
@@ -686,7 +686,7 @@ bool SLAPrint::invalidate_step(SLAPrintStep step)
|
||||
return invalidated;
|
||||
}
|
||||
|
||||
void SLAPrint::process()
|
||||
void SLAPrint::process(bool use_cache)
|
||||
{
|
||||
if (m_objects.empty())
|
||||
return;
|
||||
@@ -695,7 +695,7 @@ void SLAPrint::process()
|
||||
|
||||
// Assumption: at this point the print objects should be populated only with
|
||||
// the model objects we have to process and the instances are also filtered
|
||||
|
||||
|
||||
Steps printsteps(this);
|
||||
|
||||
// We want to first process all objects...
|
||||
@@ -709,7 +709,7 @@ void SLAPrint::process()
|
||||
};
|
||||
|
||||
SLAPrintStep print_steps[] = { slapsMergeSlicesAndEval, slapsRasterize };
|
||||
|
||||
|
||||
double st = Steps::min_objstatus;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Start slicing process.";
|
||||
@@ -749,7 +749,7 @@ void SLAPrint::process()
|
||||
throw_if_canceled();
|
||||
po->set_done(step);
|
||||
}
|
||||
|
||||
|
||||
incr = printsteps.progressrange(step);
|
||||
}
|
||||
}
|
||||
@@ -760,7 +760,7 @@ void SLAPrint::process()
|
||||
|
||||
// this would disable the rasterization step
|
||||
// std::fill(m_stepmask.begin(), m_stepmask.end(), false);
|
||||
|
||||
|
||||
st = Steps::max_objstatus;
|
||||
for(SLAPrintStep currentstep : print_steps) {
|
||||
throw_if_canceled();
|
||||
@@ -774,7 +774,7 @@ void SLAPrint::process()
|
||||
throw_if_canceled();
|
||||
set_done(currentstep);
|
||||
}
|
||||
|
||||
|
||||
st += printsteps.progressrange(currentstep);
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ const TriangleMesh& SLAPrintObject::support_mesh() const
|
||||
{
|
||||
if(m_config.supports_enable.getBool() && m_supportdata)
|
||||
return m_supportdata->tree_mesh;
|
||||
|
||||
|
||||
return EMPTY_MESH;
|
||||
}
|
||||
|
||||
@@ -1149,7 +1149,7 @@ const indexed_triangle_set &SLAPrintObject::hollowed_interior_mesh() const
|
||||
if (m_hollowing_data && m_hollowing_data->interior &&
|
||||
m_config.hollowing_enable.getBool())
|
||||
return sla::get_mesh(*m_hollowing_data->interior);
|
||||
|
||||
|
||||
return EMPTY_TRIANGLE_SET;
|
||||
}
|
||||
|
||||
@@ -1174,7 +1174,7 @@ sla::SupportPoints SLAPrintObject::transformed_support_points() const
|
||||
for (sla::SupportPoint& suppt : spts) {
|
||||
suppt.pos = tr * suppt.pos;
|
||||
}
|
||||
|
||||
|
||||
return spts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user