// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <GEOMImpl_ShapeDriver.hxx>
#include <Standard_TypeMismatch.hxx>
#include <Standard_ConstructionError.hxx>
+//modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
+//static
+// void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
+// const Handle(TopTools_HSequenceOfShape)& aWires);
+//modified by NIZNHY-PKV Wed Dec 28 13:48:23 2011t
+
//=======================================================================
//function : GetID
//purpose :
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
+ TCollection_AsciiString aWarning;
+
BRep_Builder B;
if (aType == WIRE_EDGES) {
Standard_NullObject::Raise
("Shape for face construction is neither a wire nor a closed edge");
}
- GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
+ aWarning = GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
if (aShape.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed");
}
Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
/*shared*/Standard_False, aSeqWiresOut);
+ //modified by NIZNHY-PKV Wed Dec 28 13:46:55 2011f
+ //KeepEdgesOrder(aSeqEdgesIn, aSeqWiresOut);
+ //modified by NIZNHY-PKV Wed Dec 28 13:46:59 2011t
// 3. Separate closed wires
Handle(TopTools_HSequenceOfShape) aSeqClosedWires = new TopTools_HSequenceOfShape;
// 4.a. Basic face
TopoDS_Shape aFFace;
TopoDS_Wire aW1 = TopoDS::Wire(aSeqClosedWires->Value(1));
- GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace);
+ aWarning = GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace);
if (aFFace.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed");
}
aShape = C;
}
+ /*
else if (aType == REVERSE_ORIENTATION) {
Handle(GEOM_Function) aRefShape = aCI.GetBase();
TopoDS_Shape aShape_i = aRefShape->GetValue();
aShape = tds;
}
}
+ */
else if (aType == EDGE_WIRE) {
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aWire = aRefBase->GetValue();
TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex;
+ Standard_Boolean FinalReverse = Standard_False;
BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next())
LparSeq.Append(lpar);
CurType = aType;
FirstVertex = wexp.CurrentVertex();
+ if (anEdge.Orientation() == TopAbs_REVERSED)
+ FinalReverse = Standard_True;
}
else
{
NewFpar = ElCLib::Parameter(PrevCircle, P1);
NewLpar = ElCLib::Parameter(PrevCircle, P2);
if (NewLpar < NewFpar)
- NewLpar += 2.*PI;
+ NewLpar += 2.*M_PI;
//Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar;
if (ConnectByOrigin == TopAbs_FORWARD)
ElCLib::AdjustPeriodic(FparSeq.Last(),
- FparSeq.Last() + 2.*PI,
+ FparSeq.Last() + 2.*M_PI,
Precision::PConfusion(), NewFpar, NewLpar);
else
- ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*PI,
+ ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
FparSeq.Last(),
Precision::PConfusion(), NewFpar, NewLpar);
Done = Standard_True;
NewFpar = ElCLib::Parameter(PrevEllipse, P1);
NewLpar = ElCLib::Parameter(PrevEllipse, P2);
if (NewLpar < NewFpar)
- NewLpar += 2.*PI;
+ NewLpar += 2.*M_PI;
if (ConnectByOrigin == TopAbs_FORWARD)
ElCLib::AdjustPeriodic(FparSeq.Last(),
- FparSeq.Last() + 2.*PI,
+ FparSeq.Last() + 2.*M_PI,
Precision::PConfusion(), NewFpar, NewLpar);
else
- ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*PI,
+ ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
FparSeq.Last(),
Precision::PConfusion(), NewFpar, NewLpar);
Done = Standard_True;
LastVertex = wexp.CurrentVertex();
TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
+ TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex;
+ FirstVtx_final.Orientation(TopAbs_FORWARD);
+ TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex;
+ LastVtx_final.Orientation(TopAbs_REVERSED);
+
if (!CurveSeq.IsEmpty())
{
Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built");
}
ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
- FirstVertex, LastVertex);
+ FirstVtx_final, LastVtx_final,
+ concatcurve->Value(concatcurve->Lower())->FirstParameter(),
+ concatcurve->Value(concatcurve->Lower())->LastParameter());
}
else
{
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
- CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve();
+ CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
ResEdge = BRepLib_MakeEdge(CurveSeq(1),
- FirstVertex, LastVertex,
+ FirstVtx_final, LastVtx_final,
FparSeq(1), LparSeq(1));
}
}
+ if (FinalReverse)
+ ResEdge.Reverse();
+
aShape = ResEdge;
}
else if (aType == EDGE_CURVE_LENGTH) {
// Get the point by length
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
- GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
+ GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
Standard_Real aParam = anAbsPnt.Parameter();
if (AdapCurve.IsClosed() && aLength < 0.0) {
log.SetTouched(Label());
+ if (!aWarning.IsEmpty())
+ Standard_Failure::Raise(aWarning.ToCString());
+
return 1;
}
return _anOtherObject;
}
+
+//modified by NIZNHY-PKV Wed Dec 28 13:48:31 2011f
+#include <TopoDS_Iterator.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <ShapeAnalysis_FreeBounds.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapOfOrientedShape.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Wire.hxx>
+
+//=======================================================================
+//function : KeepEdgesOrder
+//purpose :
+//=======================================================================
+/*
+void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
+ const Handle(TopTools_HSequenceOfShape)& aWires)
+{
+ Standard_Integer aNbWires, aNbEdges;
+ //
+ if (aEdges.IsNull()) {
+ return;
+ }
+ //
+ if (aWires.IsNull()) {
+ return;
+ }
+ //
+ aNbEdges=aEdges->Length();
+ aNbWires=aWires->Length();
+ if (!aNbEdges || !aNbWires) {
+ return;
+ }
+ //-----
+ Standard_Boolean bClosed;
+ Standard_Integer i, j;
+ TopoDS_Wire aWy;
+ TopoDS_Iterator aIt;
+ BRep_Builder aBB;
+ TopTools_MapOfOrientedShape aMEx;
+ //
+ for (i=1; i<=aNbWires; ++i) {
+ const TopoDS_Shape& aWx=aWires->Value(i);
+ //
+ aMEx.Clear();
+ aIt.Initialize (aWx);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aEx=aIt.Value();
+ aMEx.Add(aEx);
+ }
+ // aWy
+ aBB.MakeWire (aWy);
+ for (j=1; j<=aNbEdges; ++j) {
+ const TopoDS_Shape& aE=aEdges->Value(j);
+ if (aMEx.Contains(aE)) {
+ aBB.Add(aWy, aE);
+ }
+ }
+ //
+ bClosed=aWx.Closed();
+ aWy.Closed(bClosed);
+ //
+ aWires->Append(aWy);
+ }// for (i=1; i<=aNbWires; ++i) {
+ //
+ aWires->Remove(1, aNbWires);
+}
+*/
+//modified by NIZNHY-PKV Wed Dec 28 13:48:34 2011t