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

always call ShapeFix_Wire.FixReorder() in OCCFace setup: while for...

always call ShapeFix_Wire.FixReorder() in OCCFace setup: while for non-periodic surfaces GEdgeLoop would correct it, for periodic surfaces the location of degenerate edges linking 2 sides of the parametric space is crucial and cannot be deternined by GEdgeLoop
parent 4de2d74b
Branches
Tags
No related merge requests found
// Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
// //
// See the LICENSE.txt file in the Gmsh root directory for license information. // See the LICENSE.txt file in the Gmsh root directory for license information.
// Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues. // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <Geom_ToroidalSurface.hxx> #include <Geom_ToroidalSurface.hxx>
#include <IntTools_Context.hxx> #include <IntTools_Context.hxx>
#include <ShapeAnalysis.hxx> #include <ShapeAnalysis.hxx>
#include <ShapeFix_Wire.hxx>
#include <Standard_Version.hxx> #include <Standard_Version.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
...@@ -60,6 +61,15 @@ void OCCFace::_setup() ...@@ -60,6 +61,15 @@ void OCCFace::_setup()
for(exp2.Init(_s.Oriented(TopAbs_FORWARD), TopAbs_WIRE); exp2.More(); for(exp2.Init(_s.Oriented(TopAbs_FORWARD), TopAbs_WIRE); exp2.More();
exp2.Next()) { exp2.Next()) {
TopoDS_Wire wire = TopoDS::Wire(exp2.Current()); TopoDS_Wire wire = TopoDS::Wire(exp2.Current());
// it is crucial that the edges in the wire are ordered and oriented
// correctly (for non-periodic surfaces GEdgeLoop would correct it; but for
// periodic surfaces the location of degenerate edges linking 2 sides of the
// parametric space is crucial) - so always make sure to reorder the edges
ShapeFix_Wire sfw(wire, _s, CTX::instance()->geom.tolerance);
sfw.FixReorder();
wire = sfw.Wire();
Msg::Debug("OCC surface %d - new wire", tag()); Msg::Debug("OCC surface %d - new wire", tag());
GEdgeLoop el; GEdgeLoop el;
...@@ -88,14 +98,12 @@ void OCCFace::_setup() ...@@ -88,14 +98,12 @@ void OCCFace::_setup()
} }
if(!el.check()) { if(!el.check()) {
el.reverse(); // check other orientation // should not happen, since ShapeFix_Wire has been called before
if(!el.check()) { Msg::Warning("Recomputing incorrect OpenCASCADE wire in surface %d", tag());
Msg::Info("Recomputing incorrect OpenCASCADE wire in surface %d", tag());
std::vector<GEdge*> edges; std::vector<GEdge*> edges;
el.getEdges(edges); el.getEdges(edges);
el.recompute(edges); el.recompute(edges);
} }
}
for(GEdgeLoop::citer it = el.begin(); it != el.end(); ++it) { for(GEdgeLoop::citer it = el.begin(); it != el.end(); ++it) {
l_edges.push_back(it->getEdge()); l_edges.push_back(it->getEdge());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment