IPAL21270 Repair > Change Orientation for 1D. It seems as Invert object has same orientation as initial one.

This commit is contained in:
dmv 2009-07-23 14:10:57 +00:00
parent a99792b9bd
commit d85c68a11f
4 changed files with 32 additions and 10 deletions

View 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).

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

View File

@ -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.;

View 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;