mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-26 04:12:07 +00:00
Fix:step mesh using boost thread
github: #5304 Change-Id: I4afc5978b00eed20c46a1bf4100c9a0f0328daf8 (cherry picked from commit 151f40ad4dbf871576937f9674ac532c32df27d0)
This commit is contained in:
@@ -464,25 +464,30 @@ void Step::clean_mesh_data()
|
||||
unsigned int Step::get_triangle_num(double linear_defletion, double angle_defletion)
|
||||
{
|
||||
unsigned int tri_num = 0;
|
||||
Handle(StepProgressIncdicator) progress = new StepProgressIncdicator(m_stop_mesh);
|
||||
clean_mesh_data();
|
||||
IMeshTools_Parameters param;
|
||||
param.Deflection = linear_defletion;
|
||||
param.Angle = angle_defletion;
|
||||
param.InParallel = true;
|
||||
for (int i = 0; i < m_name_solids.size(); ++i) {
|
||||
BRepMesh_IncrementalMesh mesh(m_name_solids[i].solid, param, progress->Start());
|
||||
for (TopExp_Explorer anExpSF(m_name_solids[i].solid, TopAbs_FACE); anExpSF.More(); anExpSF.Next()) {
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(TopoDS::Face(anExpSF.Current()), aLoc);
|
||||
if (!aTriangulation.IsNull()) {
|
||||
tri_num += aTriangulation->NbTriangles();
|
||||
try {
|
||||
Handle(StepProgressIncdicator) progress = new StepProgressIncdicator(m_stop_mesh);
|
||||
clean_mesh_data();
|
||||
IMeshTools_Parameters param;
|
||||
param.Deflection = linear_defletion;
|
||||
param.Angle = angle_defletion;
|
||||
param.InParallel = true;
|
||||
for (int i = 0; i < m_name_solids.size(); ++i) {
|
||||
BRepMesh_IncrementalMesh mesh(m_name_solids[i].solid, param, progress->Start());
|
||||
for (TopExp_Explorer anExpSF(m_name_solids[i].solid, TopAbs_FACE); anExpSF.More(); anExpSF.Next()) {
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(TopoDS::Face(anExpSF.Current()), aLoc);
|
||||
if (!aTriangulation.IsNull()) {
|
||||
tri_num += aTriangulation->NbTriangles();
|
||||
}
|
||||
}
|
||||
if (m_stop_mesh.load()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (m_stop_mesh.load()) {
|
||||
return 0;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return tri_num;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user