Skip to content
Snippets Groups Projects
Commit 6581e72e authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

only add closed wires as edge loops

parent 8c97de4e
No related branches found
No related tags found
No related merge requests found
......@@ -30,45 +30,51 @@ extern Context_T CTX;
OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape &emap)
: GFace(m, num), s(_s)
{
TopExp_Explorer exp0, exp01, exp1, exp2, exp3;
TopExp_Explorer exp2, exp3;
for(exp2.Init(s, TopAbs_WIRE); exp2.More(); exp2.Next()){
TopoDS_Shape wire = exp2.Current();
Msg::Debug("OCC Face %d - New Wire", num);
std::list<GEdge*> l_wire;
for(exp3.Init(wire, TopAbs_EDGE); exp3.More(); exp3.Next()){
TopoDS_Edge edge = TopoDS::Edge(exp3.Current());
int index = emap.FindIndex(edge);
GEdge *e = m->getEdgeByTag(index);
if(e){
l_wire.push_back(e);
Msg::Debug("Edge %d ori %d", e->tag(), edge.Orientation());
e->addFace(this);
if(!e->is3D()){
OCCEdge *occe = (OCCEdge*)e;
occe->setTrimmed(this);
}
}
else{
Msg::Error("Unknown edge %d in face %d", index, num);
}
}
GEdgeLoop el(l_wire);
TopoDS_Wire wire = TopoDS::Wire(exp2.Current());
ShapeAnalysis_Wire check(wire, s, 0.);
// only add closed wires (yes, the test is correct: CheckClosed
// returns false when the wire is closed)
if(check.CheckClosed()){
Msg::Debug("OCC Face %d - Skipping open Wire", num);
}
else{
Msg::Debug("OCC Face %d - New Wire", num);
std::list<GEdge*> l_wire;
for(exp3.Init(wire, TopAbs_EDGE); exp3.More(); exp3.Next()){
TopoDS_Edge edge = TopoDS::Edge(exp3.Current());
int index = emap.FindIndex(edge);
GEdge *e = m->getEdgeByTag(index);
if(e){
l_wire.push_back(e);
Msg::Debug("Edge %d ori %d", e->tag(), edge.Orientation());
e->addFace(this);
if(!e->is3D()){
OCCEdge *occe = (OCCEdge*)e;
occe->setTrimmed(this);
}
}
else{
Msg::Error("Unknown edge %d in face %d", index, num);
}
}
for(GEdgeLoop::citer it = el.begin(); it != el.end(); ++it){
l_edges.push_back(it->ge);
l_dirs.push_back(it->_sign);
if (el.count() == 2){
it->ge->meshAttributes.minimumMeshSegments =
std::max(it->ge->meshAttributes.minimumMeshSegments,2);
}
if (el.count() == 1){
it->ge->meshAttributes.minimumMeshSegments =
std::max(it->ge->meshAttributes.minimumMeshSegments,3);
GEdgeLoop el(l_wire);
for(GEdgeLoop::citer it = el.begin(); it != el.end(); ++it){
l_edges.push_back(it->ge);
l_dirs.push_back(it->_sign);
if (el.count() == 2){
it->ge->meshAttributes.minimumMeshSegments =
std::max(it->ge->meshAttributes.minimumMeshSegments,2);
}
if (el.count() == 1){
it->ge->meshAttributes.minimumMeshSegments =
std::max(it->ge->meshAttributes.minimumMeshSegments,3);
}
}
edgeLoops.push_back(el);
}
edgeLoops.push_back(el);
}
BRepAdaptor_Surface surface( s );
_periodic[0] = surface.IsUPeriodic();
......
......@@ -93,6 +93,7 @@ using std::iostream;
#include "ShapeAnalysis_ShapeContents.hxx"
#include "ShapeAnalysis_CheckSmallFace.hxx"
#include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
#include "ShapeAnalysis_Wire.hxx"
#include "BRepAlgoAPI_Fuse.hxx"
#include "BRepCheck_Analyzer.hxx"
#include "BRepLib.hxx"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment