Merge branch 'master' into V7_5_BR

This commit is contained in:
vsr 2014-11-12 13:01:21 +03:00
commit b50d958f35

View File

@ -212,6 +212,10 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
} }
if (aSeqEdgesIn->IsEmpty()) {
Standard_ConstructionError::Raise("No edges given");
}
// 2. Connect edges to wires of maximum length // 2. Connect edges to wires of maximum length
Handle(TopTools_HSequenceOfShape) aSeqWiresOut; Handle(TopTools_HSequenceOfShape) aSeqWiresOut;
ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(), ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdgesIn, Precision::Confusion(),
@ -649,6 +653,7 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
TColStd_SequenceOfReal TolSeq; TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType; GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex; TopoDS_Vertex FirstVertex, LastVertex;
Standard_Real aPntShiftDist = 0.;
BRepTools_WireExplorer wexp(theWire) ; BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next()) for (; wexp.More(); wexp.Next())
@ -726,6 +731,18 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
gp_Pnt P2 = ElCLib::Value(lpar, aLine); gp_Pnt P2 = ElCLib::Value(lpar, aLine);
NewFpar = ElCLib::Parameter(PrevLine, P1); NewFpar = ElCLib::Parameter(PrevLine, P1);
NewLpar = ElCLib::Parameter(PrevLine, P2); NewLpar = ElCLib::Parameter(PrevLine, P2);
// Compute shift
if (ConnectByOrigin == TopAbs_FORWARD) {
gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevLine);
aPntShiftDist += P2.Distance(aNewP2);
} else {
gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevLine);
aPntShiftDist += P1.Distance(aNewP1);
}
if (NewLpar < NewFpar) if (NewLpar < NewFpar)
{ {
Standard_Real MemNewFpar = NewFpar; Standard_Real MemNewFpar = NewFpar;
@ -745,6 +762,8 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol && Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol)) aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol))
{ {
const Standard_Boolean isFwd = ConnectByOrigin == TopAbs_FORWARD;
if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.) if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.)
{ {
Standard_Real memfpar = fpar; Standard_Real memfpar = fpar;
@ -756,6 +775,18 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
gp_Pnt P2 = ElCLib::Value(lpar, aCircle); gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
NewFpar = ElCLib::Parameter(PrevCircle, P1); NewFpar = ElCLib::Parameter(PrevCircle, P1);
NewLpar = ElCLib::Parameter(PrevCircle, P2); NewLpar = ElCLib::Parameter(PrevCircle, P2);
// Compute shift
if (isFwd) {
gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevCircle);
aPntShiftDist += P2.Distance(aNewP2);
} else {
gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevCircle);
aPntShiftDist += P1.Distance(aNewP1);
}
if (NewLpar < NewFpar) if (NewLpar < NewFpar)
NewLpar += 2.*M_PI; NewLpar += 2.*M_PI;
//Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar; //Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar;
@ -781,6 +812,8 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol && Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol)) anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol))
{ {
const Standard_Boolean isFwd = ConnectByOrigin == TopAbs_FORWARD;
if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.) if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.)
{ {
Standard_Real memfpar = fpar; Standard_Real memfpar = fpar;
@ -792,6 +825,18 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
gp_Pnt P2 = ElCLib::Value(lpar, anEllipse); gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
NewFpar = ElCLib::Parameter(PrevEllipse, P1); NewFpar = ElCLib::Parameter(PrevEllipse, P1);
NewLpar = ElCLib::Parameter(PrevEllipse, P2); NewLpar = ElCLib::Parameter(PrevEllipse, P2);
// Compute shift
if (isFwd) {
gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevEllipse);
aPntShiftDist += P2.Distance(aNewP2);
} else {
gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevEllipse);
aPntShiftDist += P1.Distance(aNewP1);
}
if (NewLpar < NewFpar) if (NewLpar < NewFpar)
NewLpar += 2.*M_PI; NewLpar += 2.*M_PI;
if (ConnectByOrigin == TopAbs_FORWARD) if (ConnectByOrigin == TopAbs_FORWARD)
@ -820,6 +865,18 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
gp_Pnt P2 = ElCLib::Value(lpar, aHypr); gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
NewFpar = ElCLib::Parameter(PrevHypr, P1); NewFpar = ElCLib::Parameter(PrevHypr, P1);
NewLpar = ElCLib::Parameter(PrevHypr, P2); NewLpar = ElCLib::Parameter(PrevHypr, P2);
// Compute shift
if (ConnectByOrigin == TopAbs_FORWARD) {
gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevHypr);
aPntShiftDist += P2.Distance(aNewP2);
} else {
gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevHypr);
aPntShiftDist += P1.Distance(aNewP1);
}
if (NewLpar < NewFpar) if (NewLpar < NewFpar)
{ {
Standard_Real MemNewFpar = NewFpar; Standard_Real MemNewFpar = NewFpar;
@ -844,6 +901,18 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
gp_Pnt P2 = ElCLib::Value(lpar, aParab); gp_Pnt P2 = ElCLib::Value(lpar, aParab);
NewFpar = ElCLib::Parameter(PrevParab, P1); NewFpar = ElCLib::Parameter(PrevParab, P1);
NewLpar = ElCLib::Parameter(PrevParab, P2); NewLpar = ElCLib::Parameter(PrevParab, P2);
// Compute shift
if (ConnectByOrigin == TopAbs_FORWARD) {
gp_Pnt aNewP2 = ElCLib::Value(NewLpar, PrevParab);
aPntShiftDist += P2.Distance(aNewP2);
} else {
gp_Pnt aNewP1 = ElCLib::Value(NewFpar, PrevParab);
aPntShiftDist += P1.Distance(aNewP1);
}
if (NewLpar < NewFpar) if (NewLpar < NewFpar)
{ {
Standard_Real MemNewFpar = NewFpar; Standard_Real MemNewFpar = NewFpar;
@ -873,14 +942,15 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
LocSeq.Append(aLocShape); LocSeq.Append(aLocShape);
FparSeq.Append(fpar); FparSeq.Append(fpar);
LparSeq.Append(lpar); LparSeq.Append(lpar);
TolSeq.Append(BRep_Tool::Tolerance(CurVertex)); TolSeq.Append(aPntShiftDist + BRep_Tool::Tolerance(CurVertex));
aPntShiftDist = 0.;
CurType = aType; CurType = aType;
} }
} // end of else (CurveSeq.IsEmpty()) -> not first time } // end of else (CurveSeq.IsEmpty()) -> not first time
} // end for (; wexp.More(); wexp.Next()) } // end for (; wexp.More(); wexp.Next())
LastVertex = wexp.CurrentVertex(); LastVertex = wexp.CurrentVertex();
TolSeq.Append(BRep_Tool::Tolerance(LastVertex)); TolSeq.Append(aPntShiftDist + BRep_Tool::Tolerance(LastVertex));
FirstVertex.Orientation(TopAbs_FORWARD); FirstVertex.Orientation(TopAbs_FORWARD);
LastVertex.Orientation(TopAbs_REVERSED); LastVertex.Orientation(TopAbs_REVERSED);