mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 20:15:59 +08:00
Move minimal area into configuration to be able modify it from UI (in my opinion it is necessary)
This commit is contained in:
parent
f2df4793af
commit
728adb99d0
@ -122,7 +122,7 @@ void SupportPointGenerator::project_onto_mesh(std::vector<sla::SupportPoint>& po
|
|||||||
|
|
||||||
static std::vector<SupportPointGenerator::MyLayer> make_layers(
|
static std::vector<SupportPointGenerator::MyLayer> make_layers(
|
||||||
const std::vector<ExPolygons>& slices, const std::vector<float>& heights,
|
const std::vector<ExPolygons>& slices, const std::vector<float>& heights,
|
||||||
std::function<void(void)> throw_on_cancel)
|
std::function<void(void)> throw_on_cancel, const sla::SupportPointGenerator::Config& config)
|
||||||
{
|
{
|
||||||
assert(slices.size() == heights.size());
|
assert(slices.size() == heights.size());
|
||||||
|
|
||||||
@ -132,13 +132,8 @@ static std::vector<SupportPointGenerator::MyLayer> make_layers(
|
|||||||
for (size_t i = 0; i < slices.size(); ++ i)
|
for (size_t i = 0; i < slices.size(); ++ i)
|
||||||
layers.emplace_back(i, heights[i]);
|
layers.emplace_back(i, heights[i]);
|
||||||
|
|
||||||
// FIXME: calculate actual pixel area from printer config:
|
|
||||||
//const float pixel_area = pow(wxGetApp().preset_bundle->project_config.option<ConfigOptionFloat>("display_width") / wxGetApp().preset_bundle->project_config.option<ConfigOptionInt>("display_pixels_x"), 2.f); //
|
|
||||||
// Minimal island Area to print - TODO: Should be modifiable from UI
|
|
||||||
const float pixel_area = pow(0.047f, 2.f);
|
|
||||||
|
|
||||||
execution::for_each(ex_tbb, size_t(0), layers.size(),
|
execution::for_each(ex_tbb, size_t(0), layers.size(),
|
||||||
[&layers, &slices, pixel_area, throw_on_cancel](size_t layer_id)
|
[&layers, &slices, min_area = config.minimal_island_area, throw_on_cancel](size_t layer_id)
|
||||||
{
|
{
|
||||||
if ((layer_id % 8) == 0)
|
if ((layer_id % 8) == 0)
|
||||||
// Don't call the following function too often as it flushes
|
// Don't call the following function too often as it flushes
|
||||||
@ -150,10 +145,12 @@ static std::vector<SupportPointGenerator::MyLayer> make_layers(
|
|||||||
layer.islands.reserve(islands.size());
|
layer.islands.reserve(islands.size());
|
||||||
for (const ExPolygon &island : islands) {
|
for (const ExPolygon &island : islands) {
|
||||||
float area = float(island.area() * SCALING_FACTOR * SCALING_FACTOR);
|
float area = float(island.area() * SCALING_FACTOR * SCALING_FACTOR);
|
||||||
if (area >= pixel_area)
|
|
||||||
// FIXME this is not a correct centroid of a polygon with holes.
|
// Skip too small islands (non-printable)
|
||||||
// But suction of uncured resin is still there
|
if (area < min_area)
|
||||||
layer.islands.emplace_back(layer, island, get_extents(island.contour), area);
|
continue;
|
||||||
|
|
||||||
|
layer.islands.emplace_back(layer, island, get_extents(island.contour), area);
|
||||||
}
|
}
|
||||||
}, 32 /*gransize*/);
|
}, 32 /*gransize*/);
|
||||||
|
|
||||||
@ -236,7 +233,7 @@ void SupportPointGenerator::process(const std::vector<ExPolygons>& slices, const
|
|||||||
std::vector<std::pair<ExPolygon, coord_t>> islands;
|
std::vector<std::pair<ExPolygon, coord_t>> islands;
|
||||||
#endif /* SLA_SUPPORTPOINTGEN_DEBUG */
|
#endif /* SLA_SUPPORTPOINTGEN_DEBUG */
|
||||||
|
|
||||||
std::vector<SupportPointGenerator::MyLayer> layers = make_layers(slices, heights, m_throw_on_cancel);
|
std::vector<SupportPointGenerator::MyLayer> layers = make_layers(slices, heights, m_throw_on_cancel, m_config);
|
||||||
|
|
||||||
PointGrid3D point_grid;
|
PointGrid3D point_grid;
|
||||||
point_grid.cell_size = Vec3f(10.f, 10.f, 10.f);
|
point_grid.cell_size = Vec3f(10.f, 10.f, 10.f);
|
||||||
|
@ -43,6 +43,11 @@ public:
|
|||||||
// Originally calibrated to 7.7f, reduced density by Tamas to 70% which is 11.1 (7.7 / 0.7) to adjust for new algorithm changes in tm_suppt_gen_improve
|
// Originally calibrated to 7.7f, reduced density by Tamas to 70% which is 11.1 (7.7 / 0.7) to adjust for new algorithm changes in tm_suppt_gen_improve
|
||||||
inline float support_force() const { return 11.1f / density_relative; } // a force one point can support (arbitrary force unit)
|
inline float support_force() const { return 11.1f / density_relative; } // a force one point can support (arbitrary force unit)
|
||||||
inline float tear_pressure() const { return 1.f; } // pressure that the display exerts (the force unit per mm2)
|
inline float tear_pressure() const { return 1.f; } // pressure that the display exerts (the force unit per mm2)
|
||||||
|
|
||||||
|
// FIXME: calculate actual pixel area from printer config:
|
||||||
|
//const float pixel_area = pow(wxGetApp().preset_bundle->project_config.option<ConfigOptionFloat>("display_width") / wxGetApp().preset_bundle->project_config.option<ConfigOptionInt>("display_pixels_x"), 2.f); //
|
||||||
|
// Minimal island Area to print - TODO: Should be modifiable from UI
|
||||||
|
const float minimal_island_area = pow(0.047f, 2.f); // [in mm^2] pixel_area
|
||||||
};
|
};
|
||||||
|
|
||||||
SupportPointGenerator(const AABBMesh& emesh, const std::vector<ExPolygons>& slices,
|
SupportPointGenerator(const AABBMesh& emesh, const std::vector<ExPolygons>& slices,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user