mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0026555: Modeling Algorithms - Exception-safe status reporting in BRepOffset_MakeOffset
Set safe exit status for: Standard_NullObject exception, Standard_NullObject: BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt, BRep_Tool: no parameter on edge, BRepOffset_MakeOffset::TrimEdge no projection
This commit is contained in:
parent
453103d191
commit
3e85dfc5e5
@ -1264,35 +1264,35 @@ Standard_Real BRep_Tool::Tolerance(const TopoDS_Vertex& V)
|
|||||||
//purpose : Returns the parameter of <V> on <E>.
|
//purpose : Returns the parameter of <V> on <E>.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
|
Standard_Boolean BRep_Tool::Parameter (const TopoDS_Vertex& theV,
|
||||||
const TopoDS_Edge& E)
|
const TopoDS_Edge& theE,
|
||||||
|
Standard_Real& theParam)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Search the vertex in the edge
|
// Search the vertex in the edge
|
||||||
|
|
||||||
Standard_Boolean rev = Standard_False;
|
Standard_Boolean rev = Standard_False;
|
||||||
TopoDS_Shape VF;
|
TopoDS_Shape VF;
|
||||||
TopAbs_Orientation orient = TopAbs_INTERNAL;
|
TopAbs_Orientation orient = TopAbs_INTERNAL;
|
||||||
|
|
||||||
TopoDS_Iterator itv(E.Oriented(TopAbs_FORWARD));
|
TopoDS_Iterator itv(theE.Oriented(TopAbs_FORWARD));
|
||||||
|
|
||||||
// if the edge has no vertices
|
// if the edge has no vertices
|
||||||
// and is degenerated use the vertex orientation
|
// and is degenerated use the vertex orientation
|
||||||
// RLE, june 94
|
// RLE, june 94
|
||||||
|
|
||||||
if (!itv.More() && Degenerated(E)) {
|
if (!itv.More() && BRep_Tool::Degenerated(theE)) {
|
||||||
orient = V.Orientation();
|
orient = theV.Orientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (itv.More()) {
|
while (itv.More()) {
|
||||||
const TopoDS_Shape& Vcur = itv.Value();
|
const TopoDS_Shape& Vcur = itv.Value();
|
||||||
if (V.IsSame(Vcur)) {
|
if (theV.IsSame(Vcur)) {
|
||||||
if (VF.IsNull()) {
|
if (VF.IsNull()) {
|
||||||
VF = Vcur;
|
VF = Vcur;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rev = E.Orientation() == TopAbs_REVERSED;
|
rev = theE.Orientation() == TopAbs_REVERSED;
|
||||||
if (Vcur.Orientation() == V.Orientation()) {
|
if (Vcur.Orientation() == theV.Orientation()) {
|
||||||
VF = Vcur;
|
VF = Vcur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1302,46 +1302,57 @@ Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
|
|||||||
|
|
||||||
if (!VF.IsNull()) orient = VF.Orientation();
|
if (!VF.IsNull()) orient = VF.Orientation();
|
||||||
|
|
||||||
Standard_Real f,l;
|
Standard_Real f, l;
|
||||||
|
|
||||||
if (orient == TopAbs_FORWARD) {
|
if (orient == TopAbs_FORWARD) {
|
||||||
BRep_Tool::Range(E,f,l);
|
BRep_Tool::Range(theE, f, l);
|
||||||
return (rev) ? l : f;
|
theParam = (rev) ? l : f;
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (orient == TopAbs_REVERSED) {
|
else if (orient == TopAbs_REVERSED) {
|
||||||
BRep_Tool::Range(E,f,l);
|
BRep_Tool::Range(theE, f, l);
|
||||||
return (rev) ? f : l;
|
theParam = (rev) ? f : l;
|
||||||
}
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
TopLoc_Location L;
|
TopLoc_Location L;
|
||||||
const Handle(Geom_Curve)& C = BRep_Tool::Curve(E,L,f,l);
|
const Handle(Geom_Curve)& C = BRep_Tool::Curve(theE, L, f, l);
|
||||||
L = L.Predivided(V.Location());
|
L = L.Predivided(theV.Location());
|
||||||
if (!C.IsNull() || Degenerated(E)) {
|
if (!C.IsNull() || BRep_Tool::Degenerated(theE)) {
|
||||||
const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
|
const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(theV.TShape().get());
|
||||||
BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
|
BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
|
||||||
|
|
||||||
while (itpr.More()) {
|
while (itpr.More()) {
|
||||||
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
||||||
if (pr->IsPointOnCurve(C,L)) {
|
if (pr->IsPointOnCurve(C, L)) {
|
||||||
Standard_Real p = pr->Parameter();
|
Standard_Real p = pr->Parameter();
|
||||||
Standard_Real res = p;// SVV 4 nov 99 - to avoid warnings on Linux
|
Standard_Real res = p;// SVV 4 nov 99 - to avoid warnings on Linux
|
||||||
if (!C.IsNull()) {
|
if (!C.IsNull()) {
|
||||||
// Closed curves RLE 16 june 94
|
// Closed curves RLE 16 june 94
|
||||||
if (Precision::IsNegativeInfinite(f)) return pr->Parameter();//p;
|
if (Precision::IsNegativeInfinite(f))
|
||||||
if (Precision::IsPositiveInfinite(l)) return pr->Parameter();//p;
|
{
|
||||||
|
theParam = pr->Parameter();//p;
|
||||||
|
return Standard_True;
|
||||||
|
};
|
||||||
|
if (Precision::IsPositiveInfinite(l))
|
||||||
|
{
|
||||||
|
theParam = pr->Parameter();//p;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
gp_Pnt Pf = C->Value(f).Transformed(L.Transformation());
|
gp_Pnt Pf = C->Value(f).Transformed(L.Transformation());
|
||||||
gp_Pnt Pl = C->Value(l).Transformed(L.Transformation());
|
gp_Pnt Pl = C->Value(l).Transformed(L.Transformation());
|
||||||
Standard_Real tol = BRep_Tool::Tolerance(V);
|
Standard_Real tol = BRep_Tool::Tolerance(theV);
|
||||||
if (Pf.Distance(Pl) < tol) {
|
if (Pf.Distance(Pl) < tol) {
|
||||||
if (Pf.Distance(BRep_Tool::Pnt(V)) < tol) {
|
if (Pf.Distance(BRep_Tool::Pnt(theV)) < tol) {
|
||||||
if (V.Orientation() == TopAbs_FORWARD) res = f;//p = f;
|
if (theV.Orientation() == TopAbs_FORWARD) res = f;//p = f;
|
||||||
else res = l;//p = l;
|
else res = l;//p = l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;//p;
|
theParam = res;//p;
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
itpr.Next();
|
itpr.Next();
|
||||||
}
|
}
|
||||||
@ -1351,30 +1362,44 @@ Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
|
|||||||
// let us try with the first pcurve
|
// let us try with the first pcurve
|
||||||
Handle(Geom2d_Curve) PC;
|
Handle(Geom2d_Curve) PC;
|
||||||
Handle(Geom_Surface) S;
|
Handle(Geom_Surface) S;
|
||||||
BRep_Tool::CurveOnSurface(E,PC,S,L,f,l);
|
BRep_Tool::CurveOnSurface(theE, PC, S, L, f, l);
|
||||||
L = L.Predivided(V.Location());
|
L = L.Predivided(theV.Location());
|
||||||
const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(V.TShape().get());
|
const BRep_TVertex* TV = static_cast<const BRep_TVertex*>(theV.TShape().get());
|
||||||
BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
|
BRep_ListIteratorOfListOfPointRepresentation itpr(TV->Points());
|
||||||
|
|
||||||
while (itpr.More()) {
|
while (itpr.More()) {
|
||||||
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
const Handle(BRep_PointRepresentation)& pr = itpr.Value();
|
||||||
if (pr->IsPointOnCurveOnSurface(PC,S,L)) {
|
if (pr->IsPointOnCurveOnSurface(PC, S, L)) {
|
||||||
Standard_Real p = pr->Parameter();
|
Standard_Real p = pr->Parameter();
|
||||||
// Closed curves RLE 16 june 94
|
// Closed curves RLE 16 june 94
|
||||||
if (PC->IsClosed()) {
|
if (PC->IsClosed()) {
|
||||||
if ((p == PC->FirstParameter()) ||
|
if ((p == PC->FirstParameter()) ||
|
||||||
(p == PC->LastParameter())) {
|
(p == PC->LastParameter())) {
|
||||||
if (V.Orientation() == TopAbs_FORWARD) p = PC->FirstParameter();
|
if (theV.Orientation() == TopAbs_FORWARD) p = PC->FirstParameter();
|
||||||
else p = PC->LastParameter();
|
else p = PC->LastParameter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p;
|
theParam = p;
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
itpr.Next();
|
itpr.Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Parameter
|
||||||
|
//purpose : Returns the parameter of <V> on <E>.
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Real BRep_Tool::Parameter(const TopoDS_Vertex& V,
|
||||||
|
const TopoDS_Edge& E)
|
||||||
|
{
|
||||||
|
Standard_Real p;
|
||||||
|
if (Parameter(V, E, p)) return p;
|
||||||
throw Standard_NoSuchObject("BRep_Tool:: no parameter on edge");
|
throw Standard_NoSuchObject("BRep_Tool:: no parameter on edge");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,17 @@ public:
|
|||||||
//! Returns the tolerance.
|
//! Returns the tolerance.
|
||||||
Standard_EXPORT static Standard_Real Tolerance (const TopoDS_Vertex& V);
|
Standard_EXPORT static Standard_Real Tolerance (const TopoDS_Vertex& V);
|
||||||
|
|
||||||
|
//! Finds the parameter of <theV> on <theE>.
|
||||||
|
//! @param theV [in] input vertex
|
||||||
|
//! @param theE [in] input edge
|
||||||
|
//! @param theParam [out] calculated parameter on the curve
|
||||||
|
//! @return TRUE if done
|
||||||
|
Standard_EXPORT static Standard_Boolean Parameter (const TopoDS_Vertex& theV,
|
||||||
|
const TopoDS_Edge& theE,
|
||||||
|
Standard_Real &theParam);
|
||||||
|
|
||||||
//! Returns the parameter of <V> on <E>.
|
//! Returns the parameter of <V> on <E>.
|
||||||
|
//! Throws Standard_NoSuchObject if no parameter on edge
|
||||||
Standard_EXPORT static Standard_Real Parameter (const TopoDS_Vertex& V, const TopoDS_Edge& E);
|
Standard_EXPORT static Standard_Real Parameter (const TopoDS_Vertex& V, const TopoDS_Edge& E);
|
||||||
|
|
||||||
//! Returns the parameters of the vertex on the
|
//! Returns the parameters of the vertex on the
|
||||||
|
@ -20,12 +20,15 @@
|
|||||||
|
|
||||||
enum BRepOffset_Error
|
enum BRepOffset_Error
|
||||||
{
|
{
|
||||||
BRepOffset_NoError,
|
BRepOffset_NoError,
|
||||||
BRepOffset_UnknownError,
|
BRepOffset_UnknownError,
|
||||||
BRepOffset_BadNormalsOnGeometry,
|
BRepOffset_BadNormalsOnGeometry,
|
||||||
BRepOffset_C0Geometry,
|
BRepOffset_C0Geometry,
|
||||||
BRepOffset_NullOffset,
|
BRepOffset_NullOffset,
|
||||||
BRepOffset_NotConnectedShell
|
BRepOffset_NotConnectedShell,
|
||||||
|
BRepOffset_CannotTrimEdges, //!< exception while trim edges
|
||||||
|
BRepOffset_CannotFuseVertices, //!< exception while fuse vertices
|
||||||
|
BRepOffset_CannotExtentEdge //!< exception while extent edges
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _BRepOffset_Error_HeaderFile
|
#endif // _BRepOffset_Error_HeaderFile
|
||||||
|
@ -923,7 +923,7 @@ static Standard_Boolean ExtendPCurve(const Handle(Geom2d_Curve)& aPCurve,
|
|||||||
|
|
||||||
// Modified by skv - Fri Dec 26 17:00:55 2003 OCC4455 Begin
|
// Modified by skv - Fri Dec 26 17:00:55 2003 OCC4455 Begin
|
||||||
//static void ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE)
|
//static void ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE)
|
||||||
void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const Standard_Real theOffset)
|
Standard_Boolean BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const Standard_Real theOffset)
|
||||||
{
|
{
|
||||||
//BRepLib::BuildCurve3d(E);
|
//BRepLib::BuildCurve3d(E);
|
||||||
|
|
||||||
@ -1261,13 +1261,19 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!C3d.IsNull() && FirstParOnPC < LastParOnPC)
|
||||||
Handle(Geom2d_Curve) ProjPCurve =
|
{
|
||||||
GeomProjLib::Curve2d( C3d, FirstParOnPC, LastParOnPC, theSurf );
|
Handle(Geom2d_Curve) ProjPCurve =
|
||||||
if (ProjPCurve.IsNull())
|
GeomProjLib::Curve2d(C3d, FirstParOnPC, LastParOnPC, theSurf);
|
||||||
ProjectionSuccess = Standard_False;
|
if (ProjPCurve.IsNull())
|
||||||
|
ProjectionSuccess = Standard_False;
|
||||||
|
else
|
||||||
|
CurveRep->PCurve(ProjPCurve);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
CurveRep->PCurve( ProjPCurve );
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1311,7 +1317,7 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const
|
|||||||
aSegment = new Geom_TrimmedCurve(aLin, 0, aDelta);
|
aSegment = new Geom_TrimmedCurve(aLin, 0, aDelta);
|
||||||
|
|
||||||
if (!aCompCurve.Add(aSegment, aTol))
|
if (!aCompCurve.Add(aSegment, aTol))
|
||||||
return;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LastPar < anEl + a2Offset) {
|
if (LastPar < anEl + a2Offset) {
|
||||||
@ -1321,7 +1327,7 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const
|
|||||||
aSegment = new Geom_TrimmedCurve(aLin, 0, aDelta);
|
aSegment = new Geom_TrimmedCurve(aLin, 0, aDelta);
|
||||||
|
|
||||||
if (!aCompCurve.Add(aSegment, aTol))
|
if (!aCompCurve.Add(aSegment, aTol))
|
||||||
return;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
C3d = aCompCurve.BSplineCurve();
|
C3d = aCompCurve.BSplineCurve();
|
||||||
@ -1341,6 +1347,7 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const
|
|||||||
|
|
||||||
BB.Range( NE, FirstPar, LastPar );
|
BB.Range( NE, FirstPar, LastPar );
|
||||||
}
|
}
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
// Modified by skv - Fri Dec 26 17:00:57 2003 OCC4455 End
|
// Modified by skv - Fri Dec 26 17:00:57 2003 OCC4455 End
|
||||||
|
|
||||||
@ -1455,7 +1462,7 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
|
|||||||
//function : ConnexIntByInt
|
//function : ConnexIntByInt
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepOffset_Inter2d::ConnexIntByInt
|
Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
|
||||||
(const TopoDS_Face& FI,
|
(const TopoDS_Face& FI,
|
||||||
BRepOffset_Offset& OFI,
|
BRepOffset_Offset& OFI,
|
||||||
TopTools_DataMapOfShapeShape& MES,
|
TopTools_DataMapOfShapeShape& MES,
|
||||||
@ -1493,7 +1500,10 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
|||||||
TopoDS_Shape aLocalShape = OFI.Generated(EI);
|
TopoDS_Shape aLocalShape = OFI.Generated(EI);
|
||||||
const TopoDS_Edge& OE = TopoDS::Edge(aLocalShape);
|
const TopoDS_Edge& OE = TopoDS::Edge(aLocalShape);
|
||||||
if (!MES.IsBound(OE) && !Build.IsBound(EI)) {
|
if (!MES.IsBound(OE) && !Build.IsBound(EI)) {
|
||||||
ExtentEdge(OE,NE, Offset);
|
if (!ExtentEdge(OE, NE, Offset))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
MES.Bind (OE,NE);
|
MES.Bind (OE,NE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1615,6 +1625,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
|||||||
ToReverse1 = ToReverse2;
|
ToReverse1 = ToReverse2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1783,8 +1794,8 @@ static void MakeChain(const TopoDS_Shape& theV,
|
|||||||
//function : FuseVertices
|
//function : FuseVertices
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepOffset_Inter2d::FuseVertices(const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||||
const Handle(BRepAlgo_AsDes)& theAsDes)
|
const Handle(BRepAlgo_AsDes)& theAsDes)
|
||||||
{
|
{
|
||||||
BRep_Builder aBB;
|
BRep_Builder aBB;
|
||||||
TopTools_MapOfShape aMVDone;
|
TopTools_MapOfShape aMVDone;
|
||||||
@ -1817,11 +1828,16 @@ void BRepOffset_Inter2d::FuseVertices(const TopTools_IndexedDataMapOfShapeListOf
|
|||||||
for (; aItLE.More(); aItLE.Next()) {
|
for (; aItLE.More(); aItLE.Next()) {
|
||||||
const TopoDS_Edge& aE = TopoDS::Edge(aItLE.Value());
|
const TopoDS_Edge& aE = TopoDS::Edge(aItLE.Value());
|
||||||
Standard_Real aTolE = BRep_Tool::Tolerance(aE);
|
Standard_Real aTolE = BRep_Tool::Tolerance(aE);
|
||||||
Standard_Real aT = BRep_Tool::Parameter(aVOldInt, aE);
|
Standard_Real aT;
|
||||||
|
if (!BRep_Tool::Parameter(aVOldInt, aE, aT))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
aBB.UpdateVertex(aVNewInt, aT, aE, aTolE);
|
aBB.UpdateVertex(aVNewInt, aT, aE, aTolE);
|
||||||
}
|
}
|
||||||
// and replace the vertex
|
// and replace the vertex
|
||||||
theAsDes->Replace(aVOld, aVNew);
|
theAsDes->Replace(aVOld, aVNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
@ -57,7 +57,7 @@ public:
|
|||||||
//! When all faces of the shape are treated the intersection vertices
|
//! When all faces of the shape are treated the intersection vertices
|
||||||
//! have to be fused using the FuseVertices method.
|
//! have to be fused using the FuseVertices method.
|
||||||
//! theDMVV contains the vertices that should be fused.
|
//! theDMVV contains the vertices that should be fused.
|
||||||
Standard_EXPORT static void ConnexIntByInt (const TopoDS_Face& FI,
|
Standard_EXPORT static Standard_Boolean ConnexIntByInt (const TopoDS_Face& FI,
|
||||||
BRepOffset_Offset& OFI,
|
BRepOffset_Offset& OFI,
|
||||||
TopTools_DataMapOfShapeShape& MES,
|
TopTools_DataMapOfShapeShape& MES,
|
||||||
const TopTools_DataMapOfShapeShape& Build,
|
const TopTools_DataMapOfShapeShape& Build,
|
||||||
@ -87,12 +87,12 @@ public:
|
|||||||
//! Fuses the chains of vertices in the theDMVV
|
//! Fuses the chains of vertices in the theDMVV
|
||||||
//! and updates AsDes by replacing the old vertices
|
//! and updates AsDes by replacing the old vertices
|
||||||
//! with the new ones.
|
//! with the new ones.
|
||||||
Standard_EXPORT static void FuseVertices(const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
Standard_EXPORT static Standard_Boolean FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||||
const Handle(BRepAlgo_AsDes)& theAsDes);
|
const Handle(BRepAlgo_AsDes)& theAsDes);
|
||||||
//! extents the edge
|
//! extents the edge
|
||||||
Standard_EXPORT static void ExtentEdge(const TopoDS_Edge& E,
|
Standard_EXPORT static Standard_Boolean ExtentEdge (const TopoDS_Edge& E,
|
||||||
TopoDS_Edge& NE,
|
TopoDS_Edge& NE,
|
||||||
const Standard_Real theOffset);
|
const Standard_Real theOffset);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -284,23 +284,23 @@ static
|
|||||||
Standard_Boolean IsPlanar(const TopoDS_Shape& theS);
|
Standard_Boolean IsPlanar(const TopoDS_Shape& theS);
|
||||||
|
|
||||||
static
|
static
|
||||||
void TrimEdge(TopoDS_Edge& NE,
|
Standard_Boolean TrimEdge(TopoDS_Edge& NE,
|
||||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||||
Handle(BRepAlgo_AsDes)& AsDes,
|
Handle(BRepAlgo_AsDes)& AsDes,
|
||||||
TopTools_DataMapOfShapeShape& theETrimEInf);
|
TopTools_DataMapOfShapeShape& theETrimEInf);
|
||||||
|
|
||||||
static
|
static
|
||||||
void TrimEdges(const TopoDS_Shape& theShape,
|
Standard_Boolean TrimEdges(const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theOffset,
|
const Standard_Real theOffset,
|
||||||
const BRepOffset_Analyse& Analyse,
|
const BRepOffset_Analyse& Analyse,
|
||||||
BRepOffset_DataMapOfShapeOffset& theMapSF,
|
BRepOffset_DataMapOfShapeOffset& theMapSF,
|
||||||
TopTools_DataMapOfShapeShape& theMES,
|
TopTools_DataMapOfShapeShape& theMES,
|
||||||
TopTools_DataMapOfShapeShape& theBuild,
|
TopTools_DataMapOfShapeShape& theBuild,
|
||||||
Handle(BRepAlgo_AsDes)& theAsDes,
|
Handle(BRepAlgo_AsDes)& theAsDes,
|
||||||
Handle(BRepAlgo_AsDes)& theAsDes2d,
|
Handle(BRepAlgo_AsDes)& theAsDes2d,
|
||||||
TopTools_IndexedMapOfShape& theNewEdges,
|
TopTools_IndexedMapOfShape& theNewEdges,
|
||||||
TopTools_DataMapOfShapeShape& theETrimEInf,
|
TopTools_DataMapOfShapeShape& theETrimEInf,
|
||||||
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins);
|
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins);
|
||||||
|
|
||||||
static
|
static
|
||||||
void AppendToList(TopTools_ListOfShape& theL,
|
void AppendToList(TopTools_ListOfShape& theL,
|
||||||
@ -797,7 +797,7 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
|
|||||||
// Check Error() method.
|
// Check Error() method.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
myError = BRepOffset_NoError;
|
||||||
TopAbs_State Side = TopAbs_IN;
|
TopAbs_State Side = TopAbs_IN;
|
||||||
if (myOffset < 0.) Side = TopAbs_OUT;
|
if (myOffset < 0.) Side = TopAbs_OUT;
|
||||||
|
|
||||||
@ -826,6 +826,10 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
|
|||||||
BuildOffsetByArc();
|
BuildOffsetByArc();
|
||||||
else if (myJoin == GeomAbs_Intersection)
|
else if (myJoin == GeomAbs_Intersection)
|
||||||
BuildOffsetByInter();
|
BuildOffsetByInter();
|
||||||
|
if (myError != BRepOffset_NoError)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
//-----------------
|
//-----------------
|
||||||
// Auto unwinding.
|
// Auto unwinding.
|
||||||
//-----------------
|
//-----------------
|
||||||
@ -1149,15 +1153,17 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
|||||||
TopTools_ListOfShape aLFaces;
|
TopTools_ListOfShape aLFaces;
|
||||||
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next())
|
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next())
|
||||||
aLFaces.Append (Exp.Current());
|
aLFaces.Append (Exp.Current());
|
||||||
|
|
||||||
for (TopTools_ListOfShape::Iterator it (myAnalyse.NewFaces()); it.More(); it.Next())
|
for (TopTools_ListOfShape::Iterator it (myAnalyse.NewFaces()); it.More(); it.Next())
|
||||||
aLFaces.Append (it.Value());
|
aLFaces.Append (it.Value());
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
// Extension of neighbor edges of new edges and intersection between neighbors.
|
// Extension of neighbor edges of new edges and intersection between neighbors.
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes();
|
Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes();
|
||||||
IntersectEdges(aLFaces, MapSF, MES, Build, AsDes, AsDes2d);
|
IntersectEdges(aLFaces, MapSF, MES, Build, AsDes, AsDes2d);
|
||||||
|
if (myError != BRepOffset_NoError)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// Great restriction of new edges and update of AsDes.
|
// Great restriction of new edges and update of AsDes.
|
||||||
//------------------------------------------ ----------------
|
//------------------------------------------ ----------------
|
||||||
@ -1168,7 +1174,11 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
|||||||
//Map of edges obtained after FACE-FACE (offsetted) intersection.
|
//Map of edges obtained after FACE-FACE (offsetted) intersection.
|
||||||
//Key1 is edge trimmed by intersection points with other edges;
|
//Key1 is edge trimmed by intersection points with other edges;
|
||||||
//Item is not-trimmed edge.
|
//Item is not-trimmed edge.
|
||||||
TrimEdges(myShape, myOffset, myAnalyse, MapSF, MES, Build, AsDes, AsDes2d, NewEdges, aETrimEInf, anEdgesOrigins);
|
if (!TrimEdges(myShape, myOffset, myAnalyse, MapSF, MES, Build, AsDes, AsDes2d, NewEdges, aETrimEInf, anEdgesOrigins))
|
||||||
|
{
|
||||||
|
myError = BRepOffset_CannotTrimEdges;
|
||||||
|
return;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
//---------------------------------
|
//---------------------------------
|
||||||
// Intersection 2D on //
|
// Intersection 2D on //
|
||||||
@ -3904,8 +3914,12 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
|
|||||||
{
|
{
|
||||||
const TopoDS_Face& aF = TopoDS::Face (it.Value());
|
const TopoDS_Face& aF = TopoDS::Face (it.Value());
|
||||||
aTolF = BRep_Tool::Tolerance (aF);
|
aTolF = BRep_Tool::Tolerance (aF);
|
||||||
BRepOffset_Inter2d::ConnexIntByInt
|
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes2d,
|
||||||
(aF, theMapSF (aF), theMES, theBuild, theAsDes2d, myOffset, aTolF, myAnalyse, aMFV, aDMVV);
|
myOffset, aTolF, myAnalyse, aMFV, aDMVV))
|
||||||
|
{
|
||||||
|
myError = BRepOffset_CannotExtentEdge;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// intersect edges created from vertices
|
// intersect edges created from vertices
|
||||||
Standard_Integer i, aNbF = aMFV.Extent();
|
Standard_Integer i, aNbF = aMFV.Extent();
|
||||||
@ -3917,24 +3931,28 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
// fuse vertices on edges
|
// fuse vertices on edges
|
||||||
BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d);
|
if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d))
|
||||||
|
{
|
||||||
|
myError = BRepOffset_CannotFuseVertices;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : TrimEdges
|
//function : TrimEdges
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void TrimEdges(const TopoDS_Shape& theShape,
|
Standard_Boolean TrimEdges(const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theOffset,
|
const Standard_Real theOffset,
|
||||||
const BRepOffset_Analyse& Analyse,
|
const BRepOffset_Analyse& Analyse,
|
||||||
BRepOffset_DataMapOfShapeOffset& theMapSF,
|
BRepOffset_DataMapOfShapeOffset& theMapSF,
|
||||||
TopTools_DataMapOfShapeShape& theMES,
|
TopTools_DataMapOfShapeShape& theMES,
|
||||||
TopTools_DataMapOfShapeShape& theBuild,
|
TopTools_DataMapOfShapeShape& theBuild,
|
||||||
Handle(BRepAlgo_AsDes)& theAsDes,
|
Handle(BRepAlgo_AsDes)& theAsDes,
|
||||||
Handle(BRepAlgo_AsDes)& theAsDes2d,
|
Handle(BRepAlgo_AsDes)& theAsDes2d,
|
||||||
TopTools_IndexedMapOfShape& theNewEdges,
|
TopTools_IndexedMapOfShape& theNewEdges,
|
||||||
TopTools_DataMapOfShapeShape& theETrimEInf,
|
TopTools_DataMapOfShapeShape& theETrimEInf,
|
||||||
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins)
|
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins)
|
||||||
{
|
{
|
||||||
TopExp_Explorer Exp,Exp2,ExpC;
|
TopExp_Explorer Exp,Exp2,ExpC;
|
||||||
TopoDS_Shape NE;
|
TopoDS_Shape NE;
|
||||||
@ -3992,7 +4010,8 @@ void TrimEdges(const TopoDS_Shape& theShape,
|
|||||||
// trim edges
|
// trim edges
|
||||||
if (NE.ShapeType() == TopAbs_EDGE) {
|
if (NE.ShapeType() == TopAbs_EDGE) {
|
||||||
if (theNewEdges.Add(NE)) {
|
if (theNewEdges.Add(NE)) {
|
||||||
TrimEdge (TopoDS::Edge(NE),theAsDes2d,theAsDes, theETrimEInf);
|
if (!TrimEdge (TopoDS::Edge(NE),theAsDes2d,theAsDes, theETrimEInf))
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4005,7 +4024,8 @@ void TrimEdges(const TopoDS_Shape& theShape,
|
|||||||
TopoDS_Edge NEC = TopoDS::Edge(ExpC.Current());
|
TopoDS_Edge NEC = TopoDS::Edge(ExpC.Current());
|
||||||
if (theNewEdges.Add(NEC)) {
|
if (theNewEdges.Add(NEC)) {
|
||||||
if (!theAsDes2d->Descendant(NEC).IsEmpty()) {
|
if (!theAsDes2d->Descendant(NEC).IsEmpty()) {
|
||||||
TrimEdge (NEC,theAsDes2d, theAsDes, theETrimEInf);
|
if(!TrimEdge (NEC,theAsDes2d, theAsDes, theETrimEInf))
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (theAsDes->HasAscendant(NEC)) {
|
if (theAsDes->HasAscendant(NEC)) {
|
||||||
@ -4037,7 +4057,8 @@ void TrimEdges(const TopoDS_Shape& theShape,
|
|||||||
NE = theMES(NE);
|
NE = theMES(NE);
|
||||||
NE.Orientation(aS.Orientation());
|
NE.Orientation(aS.Orientation());
|
||||||
if (theNewEdges.Add(NE)) {
|
if (theNewEdges.Add(NE)) {
|
||||||
TrimEdge (TopoDS::Edge(NE), theAsDes2d, theAsDes, theETrimEInf);
|
if (!TrimEdge (TopoDS::Edge(NE), theAsDes2d, theAsDes, theETrimEInf))
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4053,6 +4074,7 @@ void TrimEdges(const TopoDS_Shape& theShape,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -4060,7 +4082,7 @@ void TrimEdges(const TopoDS_Shape& theShape,
|
|||||||
//purpose : Trim the edge of the largest of descendants in AsDes2d.
|
//purpose : Trim the edge of the largest of descendants in AsDes2d.
|
||||||
// Order in AsDes two vertices that have trimmed the edge.
|
// Order in AsDes two vertices that have trimmed the edge.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void TrimEdge(TopoDS_Edge& NE,
|
Standard_Boolean TrimEdge(TopoDS_Edge& NE,
|
||||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||||
Handle(BRepAlgo_AsDes)& AsDes,
|
Handle(BRepAlgo_AsDes)& AsDes,
|
||||||
TopTools_DataMapOfShapeShape& theETrimEInf)
|
TopTools_DataMapOfShapeShape& theETrimEInf)
|
||||||
@ -4098,7 +4120,9 @@ void TrimEdge(TopoDS_Edge& NE,
|
|||||||
gp_Pnt thePoint = BRep_Tool::Pnt(V);
|
gp_Pnt thePoint = BRep_Tool::Pnt(V);
|
||||||
GeomAPI_ProjectPointOnCurve Projector(thePoint, theCurve);
|
GeomAPI_ProjectPointOnCurve Projector(thePoint, theCurve);
|
||||||
if (Projector.NbPoints() == 0)
|
if (Projector.NbPoints() == 0)
|
||||||
return;
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
U = Projector.LowerDistanceParameter();
|
U = Projector.LowerDistanceParameter();
|
||||||
}
|
}
|
||||||
if (U < UMin) {
|
if (U < UMin) {
|
||||||
@ -4110,7 +4134,7 @@ void TrimEdge(TopoDS_Edge& NE,
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (V1.IsNull() || V2.IsNull()) {
|
if (V1.IsNull() || V2.IsNull()) {
|
||||||
throw Standard_ConstructionError("BRepOffset_MakeOffset::TrimEdge");
|
return Standard_False;
|
||||||
}
|
}
|
||||||
if (!V1.IsSame(V2)) {
|
if (!V1.IsSame(V2)) {
|
||||||
NE.Free( Standard_True );
|
NE.Free( Standard_True );
|
||||||
@ -4147,6 +4171,7 @@ void TrimEdge(TopoDS_Edge& NE,
|
|||||||
theETrimEInf.Bind(NE, aSourceEdge);
|
theETrimEInf.Bind(NE, aSourceEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -380,6 +380,21 @@ static void reportOffsetState(Draw_Interpretor& theCommands,
|
|||||||
theCommands << "ERROR. Incorrect set of faces to remove, the remaining shell is not connected.";
|
theCommands << "ERROR. Incorrect set of faces to remove, the remaining shell is not connected.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BRepOffset_CannotTrimEdges:
|
||||||
|
{
|
||||||
|
theCommands << "ERROR. Can not trim edges.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BRepOffset_CannotFuseVertices:
|
||||||
|
{
|
||||||
|
theCommands << "ERROR. Can not fuse vertices.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BRepOffset_CannotExtentEdge:
|
||||||
|
{
|
||||||
|
theCommands << "ERROR. Can not extent edge.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
theCommands << "ERROR. offsetperform operation not done.";
|
theCommands << "ERROR. offsetperform operation not done.";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
puts "TODO OCC26577 All: Error : is WRONG because number of EDGE entities in shape"
|
puts "TODO OCC26528 All:ERROR. Can not trim edges."
|
||||||
puts "TODO OCC26577 All: Error : is WRONG because number of SHELL entities in shape"
|
puts "TODO OCC26528 All:Error : command \\\"nbshapes result\\\" gives an empty result"
|
||||||
|
puts "TODO OCC26528 All:TEST INCOMPLETE"
|
||||||
restore [locate_data_file bug26663_test_offset_J9.brep] s
|
restore [locate_data_file bug26663_test_offset_J9.brep] s
|
||||||
OFFSETSHAPE ${off_param} {} ${calcul} ${type}
|
OFFSETSHAPE ${off_param} {} ${calcul} ${type}
|
||||||
checknbshapes result -ref [lrange [nbshapes s] 8 19]
|
checknbshapes result -ref [lrange [nbshapes s] 8 19]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user