mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-04-24 06:59:41 +08:00
Iteractive tune of point density
This commit is contained in:
parent
0c53d53b20
commit
2dbc2f938a
@ -26,6 +26,7 @@
|
||||
|
||||
#include "PrintBase.hpp"
|
||||
#include "SLA/SupportTree.hpp"
|
||||
#include "SLA/SupportPointGenerator.hpp" // SupportPointGeneratorData
|
||||
#include "Point.hpp"
|
||||
#include "Format/SLAArchiveWriter.hpp"
|
||||
#include "libslic3r/GCode/ThumbnailData.hpp"
|
||||
@ -367,6 +368,9 @@ private:
|
||||
|
||||
std::vector<float> m_model_height_levels;
|
||||
|
||||
// Precalculated data needed for interactive automatic support placement.
|
||||
sla::SupportPointGeneratorData m_support_point_generator_data;
|
||||
|
||||
struct SupportData
|
||||
{
|
||||
sla::SupportableMesh input; // the input
|
||||
|
@ -469,6 +469,26 @@ template<class Cont> BoundingBoxf3 csgmesh_positive_bb(const Cont &csg)
|
||||
return bb3d;
|
||||
}
|
||||
|
||||
void SLAPrint::Steps::prepare_for_generate_supports(SLAPrintObject &po) {
|
||||
using namespace sla;
|
||||
std::vector<ExPolygons> slices = po.get_model_slices(); // copy
|
||||
const std::vector<float> &heights = po.m_model_height_levels;
|
||||
const PrepareSupportConfig &prepare_cfg = SampleConfigFactory::get_sample_config().prepare_config;
|
||||
ThrowOnCancel cancel = [this]() { throw_if_canceled(); };
|
||||
|
||||
// scaling for the sub operations
|
||||
double d = objectstep_scale * OBJ_STEP_LEVELS[slaposSupportPoints] / 200.0;
|
||||
double init = current_status();
|
||||
StatusFunction status = [this, d, init](unsigned st) {
|
||||
double current = init + st * d;
|
||||
if (std::round(current_status()) < std::round(current))
|
||||
report_status(current, OBJ_STEP_LABELS(slaposSupportPoints));
|
||||
};
|
||||
|
||||
po.m_support_point_generator_data =
|
||||
prepare_generator_data(std::move(slices), heights, prepare_cfg, cancel, status);
|
||||
}
|
||||
|
||||
// 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 first layer which is usually thicker will be part of the supports
|
||||
@ -543,6 +563,8 @@ void SLAPrint::Steps::slice_model(SLAPrintObject &po)
|
||||
// We apply the printer correction offset here.
|
||||
apply_printer_corrections(po, soModel);
|
||||
|
||||
// We need to prepare data in previous step to create interactive support point generation
|
||||
prepare_for_generate_supports(po);
|
||||
// po.m_preview_meshes[slaposObjectSlice] = po.get_mesh_to_print();
|
||||
// report_status(-2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
|
||||
}
|
||||
@ -677,17 +699,11 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po)
|
||||
// TODO: filter small unprintable islands in slices
|
||||
// (Island with area smaller than 1 pixel was skipped in support generator)
|
||||
|
||||
std::vector<ExPolygons> slices = po.get_model_slices(); // copy
|
||||
const std::vector<float>& heights = po.m_model_height_levels;
|
||||
ThrowOnCancel cancel = [this]() { throw_if_canceled(); };
|
||||
StatusFunction status = statuscb;
|
||||
|
||||
const PrepareSupportConfig &prepare_cfg = config.island_configuration.prepare_config;
|
||||
SupportPointGeneratorData data =
|
||||
prepare_generator_data(std::move(slices), heights, prepare_cfg, cancel, status);
|
||||
|
||||
LayerSupportPoints layer_support_points =
|
||||
generate_support_points(data, config, cancel, status);
|
||||
generate_support_points(po.m_support_point_generator_data, config, cancel, status);
|
||||
|
||||
const AABBMesh& emesh = po.m_supportdata->input.emesh;
|
||||
// Maximal move of support point to mesh surface,
|
||||
|
@ -56,6 +56,8 @@ private:
|
||||
void generate_preview(SLAPrintObject &po, SLAPrintObjectStep step);
|
||||
indexed_triangle_set generate_preview_vdb(SLAPrintObject &po, SLAPrintObjectStep step);
|
||||
|
||||
void prepare_for_generate_supports(SLAPrintObject &po);
|
||||
|
||||
public:
|
||||
explicit Steps(SLAPrint *print);
|
||||
|
||||
|
@ -709,6 +709,7 @@ RENDER_AGAIN:
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Support parameter change"));
|
||||
mo->config.set(support_points_density, (int) density);
|
||||
wxGetApp().obj_list()->update_and_show_object_settings_item();
|
||||
auto_generate();
|
||||
}
|
||||
|
||||
const sla::SupportPoints &supports = m_normal_cache;
|
||||
|
Loading…
x
Reference in New Issue
Block a user