mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Use mesh boolean in the backend to drill holes.
This commit is contained in:
parent
ef30270048
commit
6b0af43665
4 changed files with 39 additions and 40 deletions
|
@ -1,5 +1,5 @@
|
|||
#include <libslic3r/SLAPrintSteps.hpp>
|
||||
|
||||
#include <libslic3r/MeshBoolean.hpp>
|
||||
|
||||
// Need the cylinder method for the the drainholes in hollowing step
|
||||
#include <libslic3r/SLA/SupportTreeBuilder.hpp>
|
||||
|
@ -99,6 +99,23 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||
|
||||
if (po.m_hollowing_data->interior.empty())
|
||||
BOOST_LOG_TRIVIAL(warning) << "Hollowed interior is empty!";
|
||||
|
||||
auto &hollowed_mesh = po.m_hollowing_data->hollow_mesh_with_holes;
|
||||
hollowed_mesh = po.transformed_mesh();
|
||||
hollowed_mesh.merge(po.m_hollowing_data->interior);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
|
||||
sla::DrainHoles drainholes = po.transformed_drainhole_points();
|
||||
|
||||
TriangleMesh holes_mesh;
|
||||
|
||||
for (const sla::DrainHole &holept : drainholes)
|
||||
holes_mesh.merge(sla::to_triangle_mesh(holept.to_mesh()));
|
||||
|
||||
holes_mesh.require_shared_vertices();
|
||||
MeshBoolean::minus(hollowed_mesh, holes_mesh);
|
||||
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
|
||||
// The slicing will be performed on an imaginary 1D grid which starts from
|
||||
|
@ -111,18 +128,8 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||
// same imaginary grid (the height vector argument to TriangleMeshSlicer).
|
||||
void SLAPrint::Steps::slice_model(SLAPrintObject &po)
|
||||
{
|
||||
TriangleMesh hollowed_mesh;
|
||||
|
||||
bool is_hollowing = po.m_config.hollowing_enable.getBool() && po.m_hollowing_data;
|
||||
|
||||
if (is_hollowing) {
|
||||
hollowed_mesh = po.transformed_mesh();
|
||||
hollowed_mesh.merge(po.m_hollowing_data->interior);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
|
||||
const TriangleMesh &mesh = is_hollowing ? hollowed_mesh : po.transformed_mesh();
|
||||
|
||||
const TriangleMesh &mesh = po.get_mesh_to_print();
|
||||
|
||||
// We need to prepare the slice index...
|
||||
|
||||
double lhd = m_print->m_objects.front()->m_config.layer_height.getFloat();
|
||||
|
@ -168,8 +175,8 @@ void SLAPrint::Steps::slice_model(SLAPrintObject &po)
|
|||
auto &slice_grid = po.m_model_height_levels;
|
||||
slicer.slice(slice_grid, closing_r, &po.m_model_slices, thr);
|
||||
|
||||
sla::DrainHoles drainholes = po.transformed_drainhole_points();
|
||||
cut_drainholes(po.m_model_slices, slice_grid, closing_r, drainholes, thr);
|
||||
// sla::DrainHoles drainholes = po.transformed_drainhole_points();
|
||||
// cut_drainholes(po.m_model_slices, slice_grid, closing_r, drainholes, thr);
|
||||
|
||||
auto mit = slindex_it;
|
||||
double doffs = m_print->m_printer_config.absolute_correction.getFloat();
|
||||
|
@ -199,16 +206,7 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po)
|
|||
// If supports are disabled, we can skip the model scan.
|
||||
if(!po.m_config.supports_enable.getBool()) return;
|
||||
|
||||
bool is_hollowing = po.m_config.hollowing_enable.getBool() && po.m_hollowing_data;
|
||||
|
||||
TriangleMesh hollowed_mesh;
|
||||
if (is_hollowing) {
|
||||
hollowed_mesh = po.transformed_mesh();
|
||||
hollowed_mesh.merge(po.m_hollowing_data->interior);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
|
||||
const TriangleMesh &mesh = is_hollowing ? hollowed_mesh : po.transformed_mesh();
|
||||
const TriangleMesh &mesh = po.get_mesh_to_print();
|
||||
|
||||
if (!po.m_supportdata)
|
||||
po.m_supportdata.reset(new SLAPrintObject::SupportData(mesh));
|
||||
|
@ -229,7 +227,7 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po)
|
|||
// Tell the mesh where drain holes are. Although the points are
|
||||
// calculated on slices, the algorithm then raycasts the points
|
||||
// so they actually lie on the mesh.
|
||||
po.m_supportdata->emesh.load_holes(po.transformed_drainhole_points());
|
||||
// po.m_supportdata->emesh.load_holes(po.transformed_drainhole_points());
|
||||
|
||||
throw_if_canceled();
|
||||
sla::SupportPointGenerator::Config config;
|
||||
|
@ -298,7 +296,7 @@ void SLAPrint::Steps::support_tree(SLAPrintObject &po)
|
|||
po.m_supportdata->emesh.ground_level_offset(pcfg.wall_thickness_mm);
|
||||
|
||||
po.m_supportdata->cfg = make_support_cfg(po.m_config);
|
||||
po.m_supportdata->emesh.load_holes(po.transformed_drainhole_points());
|
||||
// po.m_supportdata->emesh.load_holes(po.transformed_drainhole_points());
|
||||
|
||||
// scaling for the sub operations
|
||||
double d = objectstep_scale * OBJ_STEP_LEVELS[slaposSupportTree] / 100.0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue