From: dmv Date: Thu, 23 Jul 2009 14:10:57 +0000 (+0000) Subject: IPAL21270 Repair > Change Orientation for 1D. It seems as Invert object has same... X-Git-Tag: V5_1_3rc1~69 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d85c68a11fa99458486e2ab4791e57fabc68871d;p=modules%2Fgeom.git IPAL21270 Repair > Change Orientation for 1D. It seems as Invert object has same orientation as initial one. --- diff --git a/doc/salome/gui/GEOM/input/change_orientation_operation.doc b/doc/salome/gui/GEOM/input/change_orientation_operation.doc index ecb01031c..9a0fc3191 100644 --- a/doc/salome/gui/GEOM/input/change_orientation_operation.doc +++ b/doc/salome/gui/GEOM/input/change_orientation_operation.doc @@ -4,7 +4,7 @@ \n To Change Orientation in the Main Menu select Repair - > Change Orientation. \n This operation reverses the normals of selected faces or the normal -of faces composing composing the selected opened shell. +of faces composing the selected opened shell. Or, reverses the edge or wire orientation (direction). \n TUI Command: geompy.ChangeOrientation(shape) \n Arguments: Name + one or several objects (face(s)), opened shell(s). diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index f7ce2534f..35bb40d42 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -217,14 +217,23 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent double fp,lp; gp_Vec aDirVec; Handle(Geom_Curve) C = BRep_Tool::Curve(anEdgeE,fp,lp); - C->D1(lp, aP2, aDirVec); + if ( anEdgeE.Orientation() == TopAbs_FORWARD ) + C->D1(lp, aP2, aDirVec); + else { + C->D1(fp, aP1, aDirVec); + aP2 = aP1; + } GeomAdaptor_Curve aAdC; aAdC.Load(C, fp, lp); Standard_Real aDist = GCPnts_AbscissaPoint::Length(aAdC, fp, lp); if (aDist > gp::Resolution()) { - gp_Dir aDir (aDirVec); + gp_Dir aDir; + if ( anEdgeE.Orientation() == TopAbs_FORWARD ) + aDir = aDirVec; + else + aDir = -aDirVec; Prs3d_Arrow::Draw(aPrs, aP2, aDir, PI/180.*5., aDist/10.); } } diff --git a/src/OBJECT/GEOM_EdgeSource.cxx b/src/OBJECT/GEOM_EdgeSource.cxx index 754f38c09..ed1102b4b 100755 --- a/src/OBJECT/GEOM_EdgeSource.cxx +++ b/src/OBJECT/GEOM_EdgeSource.cxx @@ -174,14 +174,24 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, double fp,lp; gp_Vec aDirVec; Handle(Geom_Curve) C = BRep_Tool::Curve(theEdge,fp,lp); - C->D1(lp, aP2, aDirVec); + if ( theEdge.Orientation() == TopAbs_FORWARD ) { + C->D1(lp, aP2, aDirVec); + } else { + C->D1(fp, aP1, aDirVec); + aP2 = aP1; + } GeomAdaptor_Curve aAdC; aAdC.Load(C, fp, lp); Standard_Real aDist = GCPnts_AbscissaPoint::Length(aAdC, fp, lp); if (aDist < gp::Resolution()) return; - gp_Dir aDirection (aDirVec); + gp_Dir aDirection; + + if ( theEdge.Orientation() == TopAbs_FORWARD ) + aDirection = aDirVec; + else + aDirection = -aDirVec; Standard_Real anAngle = PI/180.*5.; Standard_Real aLength = aDist/10.; diff --git a/src/ShHealOper/ShHealOper_ChangeOrientation.cxx b/src/ShHealOper/ShHealOper_ChangeOrientation.cxx index 8be204945..6df93ee2b 100644 --- a/src/ShHealOper/ShHealOper_ChangeOrientation.cxx +++ b/src/ShHealOper/ShHealOper_ChangeOrientation.cxx @@ -73,11 +73,14 @@ Standard_Boolean ShHealOper_ChangeOrientation::Perform() } myResultShape.Reverse(); } - else if (myInitShape.ShapeType() == TopAbs_WIRE) { - myResultShape = myInitShape.Reversed(); - } - else if (myInitShape.ShapeType() == TopAbs_EDGE) { - myResultShape = myInitShape.Reversed(); + else if ( myInitShape.ShapeType() == TopAbs_WIRE || myInitShape.ShapeType() == TopAbs_EDGE) { + myResultShape = myInitShape.EmptyCopied(); + TopoDS_Iterator itr(myInitShape); + while (itr.More()) { + B.Add(myResultShape,itr.Value()); + itr.Next(); + } + myResultShape.Reverse(); } else { return false;