\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).
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.);
}
}
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.;
}
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;