]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
IPAL21270 Repair > Change Orientation for 1D. It seems as Invert object has same...
authordmv <dmv@opencascade.com>
Thu, 23 Jul 2009 14:10:57 +0000 (14:10 +0000)
committerdmv <dmv@opencascade.com>
Thu, 23 Jul 2009 14:10:57 +0000 (14:10 +0000)
doc/salome/gui/GEOM/input/change_orientation_operation.doc
src/OBJECT/GEOM_AISShape.cxx
src/OBJECT/GEOM_EdgeSource.cxx
src/ShHealOper/ShHealOper_ChangeOrientation.cxx

index ecb01031c4d6fa3101e1380e2528e761acedff87..9a0fc3191f6eb71c8f66047ef9ba9e723145b732 100644 (file)
@@ -4,7 +4,7 @@
 
 \n To <b>Change Orientation</b> in the <b>Main Menu</b> select <b>Repair - > Change Orientation</b>.
 \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 <b>TUI Command:</b> <em>geompy.ChangeOrientation(shape)</em>
 \n <b>Arguments:</b> Name + one or several objects (face(s)), opened shell(s).
index f7ce2534f0aa07a6be4ab4f22554735676b71c65..35bb40d4224bdc7131dedecbf035c1064ee7a0fa 100644 (file)
@@ -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.);
       }
     }
index 754f38c09299a327514fe21330a73a80af14169a..ed1102b4bfcc49d902c0ffb4dd0c198b7d116cbf 100755 (executable)
@@ -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.;
index 8be204945f5d98bc617269ac0b0653f5a56e6771..6df93ee2b7ef32015555efbf49530adb5ea92760 100644 (file)
@@ -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;