mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 11:40:33 +05:00
Mantis issue 0021399: Cant' build an edge from a wire. A fix by JGV.
This commit is contained in:
parent
93be6bd2e6
commit
c9cbee8d01
@ -495,6 +495,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
TColStd_SequenceOfReal TolSeq;
|
TColStd_SequenceOfReal TolSeq;
|
||||||
GeomAbs_CurveType CurType;
|
GeomAbs_CurveType CurType;
|
||||||
TopoDS_Vertex FirstVertex, LastVertex;
|
TopoDS_Vertex FirstVertex, LastVertex;
|
||||||
|
Standard_Boolean FinalReverse = Standard_False;
|
||||||
|
|
||||||
BRepTools_WireExplorer wexp(theWire) ;
|
BRepTools_WireExplorer wexp(theWire) ;
|
||||||
for (; wexp.More(); wexp.Next())
|
for (; wexp.More(); wexp.Next())
|
||||||
@ -526,6 +527,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
LparSeq.Append(lpar);
|
LparSeq.Append(lpar);
|
||||||
CurType = aType;
|
CurType = aType;
|
||||||
FirstVertex = wexp.CurrentVertex();
|
FirstVertex = wexp.CurrentVertex();
|
||||||
|
if (anEdge.Orientation() == TopAbs_REVERSED)
|
||||||
|
FinalReverse = Standard_True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -728,6 +731,11 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
LastVertex = wexp.CurrentVertex();
|
LastVertex = wexp.CurrentVertex();
|
||||||
TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
|
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())
|
if (!CurveSeq.IsEmpty())
|
||||||
{
|
{
|
||||||
Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
|
Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
|
||||||
@ -795,20 +803,25 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built");
|
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()),
|
ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
|
||||||
FirstVertex, LastVertex);
|
FirstVtx_final, LastVtx_final,
|
||||||
|
concatcurve->Value(concatcurve->Lower())->FirstParameter(),
|
||||||
|
concatcurve->Value(concatcurve->Lower())->LastParameter());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
|
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());
|
CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
|
||||||
ResEdge = BRepLib_MakeEdge(CurveSeq(1),
|
ResEdge = BRepLib_MakeEdge(CurveSeq(1),
|
||||||
FirstVertex, LastVertex,
|
FirstVtx_final, LastVtx_final,
|
||||||
FparSeq(1), LparSeq(1));
|
FparSeq(1), LparSeq(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FinalReverse)
|
||||||
|
ResEdge.Reverse();
|
||||||
|
|
||||||
aShape = ResEdge;
|
aShape = ResEdge;
|
||||||
}
|
}
|
||||||
else if (aType == EDGE_CURVE_LENGTH) {
|
else if (aType == EDGE_CURVE_LENGTH) {
|
||||||
@ -873,7 +886,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
// Get the point by length
|
// Get the point by length
|
||||||
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
|
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
|
||||||
GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
|
GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
|
||||||
Standard_Real aParam = anAbsPnt.Parameter();
|
Standard_Real aParam = anAbsPnt.Parameter();
|
||||||
|
|
||||||
if (AdapCurve.IsClosed() && aLength < 0.0) {
|
if (AdapCurve.IsClosed() && aLength < 0.0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user