From c6ef1937620cec7baca351267fe254d92d21f4b4 Mon Sep 17 00:00:00 2001 From: barate Date: Tue, 5 Apr 2011 09:00:50 +0000 Subject: [PATCH] Simplified detection of reversed edges when building structural elements --- src/GEOM_PY/structelem/parts.py | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/src/GEOM_PY/structelem/parts.py b/src/GEOM_PY/structelem/parts.py index 0781f6d83..c4e2f8fe7 100644 --- a/src/GEOM_PY/structelem/parts.py +++ b/src/GEOM_PY/structelem/parts.py @@ -254,34 +254,10 @@ class Beam(StructuralElementPart): orientation is different than the orientation of the underlying OCC object. """ - fParam = 0. - lParam = 1. - fPoint = self.geom.MakeVertexOnCurve(path, fParam) - lPoint = self.geom.MakeVertexOnCurve(path, lParam) - - fNormal = self.geom.MakeTangentOnCurve(path, fParam) - lNormal = self.geom.MakeTangentOnCurve(path, lParam) - - fCircle = self.geom.MakeCircle(fPoint, fNormal, 10) - lCircle = self.geom.MakeCircle(lPoint, lNormal, 10) - - try: - pipe = self.geom.MakePipeWithDifferentSections([fCircle, lCircle], - [fPoint, lPoint], - path, False, False) - except RuntimeError, e: - # This dirty trick is needed if the wire is not oriented in the - # direction corresponding to parameters 0.0 -> 1.0. In this case, - # we catch the error and invert the ends of the wire. This trick - # will be removed when the function giving the orientation of an - # edge will be added in geompy (see issue 1144 in PAL bugtracker). - if (str(e) == "MakePipeWithDifferentSections : First location " - "shapes is not coincided with first vertex of " - "aWirePath"): - return True - else: - raise - return False + p1 = self.geom.MakeVertexOnCurve(path, 0.0) + p2 = self.geom.GetFirstVertex(path) + dist = self.geom.MinDistance(p1, p2) + return dist != 0.0 def _getVertexAndTangentOnOrientedWire(self, path, param): """ -- 2.39.2