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