mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0030785: Mesh - protect BRepMesh_IncrementalMesh::Perform from raising exception
IMeshTools_ModelAlgo and IMeshTools_ModelBuilder have been changed to provide exception protected interfaces for performing the operations. Protect single Edge/Face discretization methods from raising exceptions to skip broken Edges/Faces and allow mesh construction on the whole model.
This commit is contained in:
parent
fe525c6f7c
commit
c2a25d522b
@ -65,7 +65,7 @@ void BRepMesh_BaseMeshAlgo::Perform(
|
|||||||
commitSurfaceTriangulation();
|
commitSurfaceTriangulation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Standard_Failure& /*theExeption*/)
|
catch (Standard_Failure const& /*theExeption*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellation
|
|||||||
// Function: Perform
|
// Function: Perform
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean BRepMesh_EdgeDiscret::Perform (
|
Standard_Boolean BRepMesh_EdgeDiscret::performInternal (
|
||||||
const Handle (IMeshData_Model)& theModel,
|
const Handle (IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters)
|
const IMeshTools_Parameters& theParameters)
|
||||||
{
|
{
|
||||||
@ -108,6 +108,10 @@ Standard_Boolean BRepMesh_EdgeDiscret::Perform (
|
|||||||
void BRepMesh_EdgeDiscret::process (const Standard_Integer theEdgeIndex) const
|
void BRepMesh_EdgeDiscret::process (const Standard_Integer theEdgeIndex) const
|
||||||
{
|
{
|
||||||
const IMeshData::IEdgeHandle& aDEdge = myModel->GetEdge (theEdgeIndex);
|
const IMeshData::IEdgeHandle& aDEdge = myModel->GetEdge (theEdgeIndex);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
BRepMesh_Deflection::ComputeDeflection (aDEdge, myModel->GetMaxSize (), myParameters);
|
BRepMesh_Deflection::ComputeDeflection (aDEdge, myModel->GetMaxSize (), myParameters);
|
||||||
|
|
||||||
Handle (IMeshTools_CurveTessellator) aEdgeTessellator;
|
Handle (IMeshTools_CurveTessellator) aEdgeTessellator;
|
||||||
@ -173,6 +177,11 @@ void BRepMesh_EdgeDiscret::process (const Standard_Integer theEdgeIndex) const
|
|||||||
Tessellate2d(aDEdge, Standard_True);
|
Tessellate2d(aDEdge, Standard_True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Standard_Failure const&)
|
||||||
|
{
|
||||||
|
aDEdge->SetStatus (IMeshData_Failure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function: checkExistingPolygonAndUpdateStatus
|
// Function: checkExistingPolygonAndUpdateStatus
|
||||||
|
@ -52,11 +52,6 @@ public:
|
|||||||
const IMeshData::IEdgeHandle& theDEdge,
|
const IMeshData::IEdgeHandle& theDEdge,
|
||||||
const IMeshData::IFaceHandle& theDFace);
|
const IMeshData::IFaceHandle& theDFace);
|
||||||
|
|
||||||
//! Performs processing of edges of the given model.
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Perform (
|
|
||||||
const Handle (IMeshData_Model)& theModel,
|
|
||||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Functor API to discretize the given edge.
|
//! Functor API to discretize the given edge.
|
||||||
inline void operator() (const Standard_Integer theEdgeIndex) const {
|
inline void operator() (const Standard_Integer theEdgeIndex) const {
|
||||||
process (theEdgeIndex);
|
process (theEdgeIndex);
|
||||||
@ -75,6 +70,13 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
|
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! Performs processing of edges of the given model.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||||
|
const Handle (IMeshData_Model)& theModel,
|
||||||
|
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Checks existing discretization of the edge and updates data model.
|
//! Checks existing discretization of the edge and updates data model.
|
||||||
|
@ -43,7 +43,7 @@ BRepMesh_FaceDiscret::~BRepMesh_FaceDiscret()
|
|||||||
// Function: Perform
|
// Function: Perform
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean BRepMesh_FaceDiscret::Perform(
|
Standard_Boolean BRepMesh_FaceDiscret::performInternal(
|
||||||
const Handle(IMeshData_Model)& theModel,
|
const Handle(IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters)
|
const IMeshTools_Parameters& theParameters)
|
||||||
{
|
{
|
||||||
@ -73,6 +73,10 @@ void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
Handle(IMeshTools_MeshAlgo) aMeshingAlgo =
|
Handle(IMeshTools_MeshAlgo) aMeshingAlgo =
|
||||||
myAlgoFactory->GetAlgo(aDFace->GetSurface()->GetType(), myParameters);
|
myAlgoFactory->GetAlgo(aDFace->GetSurface()->GetType(), myParameters);
|
||||||
|
|
||||||
@ -84,3 +88,8 @@ void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
|
|||||||
|
|
||||||
aMeshingAlgo->Perform(aDFace, myParameters);
|
aMeshingAlgo->Perform(aDFace, myParameters);
|
||||||
}
|
}
|
||||||
|
catch (Standard_Failure const&)
|
||||||
|
{
|
||||||
|
aDFace->SetStatus (IMeshData_Failure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
//! Class implements functionality starting triangulation of model's faces.
|
//! Class implements functionality starting triangulation of model's faces.
|
||||||
//! Each face is processed separately and can be executed in parallel mode.
|
//! Each face is processed separately and can be executed in parallel mode.
|
||||||
//! Uses mesh algo factory passed as initializer to create instace of triangulation
|
//! Uses mesh algo factory passed as initializer to create instance of triangulation
|
||||||
//! algorithm according to type of surface of target face.
|
//! algorithm according to type of surface of target face.
|
||||||
class BRepMesh_FaceDiscret : public IMeshTools_ModelAlgo
|
class BRepMesh_FaceDiscret : public IMeshTools_ModelAlgo
|
||||||
{
|
{
|
||||||
@ -36,11 +36,6 @@ public:
|
|||||||
//! Destructor.
|
//! Destructor.
|
||||||
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
|
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
|
||||||
|
|
||||||
//! Performs processing of edges of the given model.
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Perform(
|
|
||||||
const Handle(IMeshData_Model)& theModel,
|
|
||||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Functor API to discretize the given edge.
|
//! Functor API to discretize the given edge.
|
||||||
inline void operator() (const Standard_Integer theFaceIndex) const {
|
inline void operator() (const Standard_Integer theFaceIndex) const {
|
||||||
process(theFaceIndex);
|
process(theFaceIndex);
|
||||||
@ -48,6 +43,13 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
|
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! Performs processing of faces of the given model.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||||
|
const Handle(IMeshData_Model)& theModel,
|
||||||
|
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Checks existing discretization of the face and updates data model.
|
//! Checks existing discretization of the face and updates data model.
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include <BRepMesh_ShapeVisitor.hxx>
|
#include <BRepMesh_ShapeVisitor.hxx>
|
||||||
#include <BRepMesh_ShapeTool.hxx>
|
#include <BRepMesh_ShapeTool.hxx>
|
||||||
#include <IMeshTools_ShapeExplorer.hxx>
|
#include <IMeshTools_ShapeExplorer.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx>
|
|
||||||
|
|
||||||
#include <Bnd_Box.hxx>
|
#include <Bnd_Box.hxx>
|
||||||
#include <BRepBndLib.hxx>
|
#include <BRepBndLib.hxx>
|
||||||
@ -43,16 +42,11 @@ BRepMesh_ModelBuilder::~BRepMesh_ModelBuilder ()
|
|||||||
// Function: Perform
|
// Function: Perform
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Handle (IMeshData_Model) BRepMesh_ModelBuilder::Perform (
|
Handle (IMeshData_Model) BRepMesh_ModelBuilder::performInternal (
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const IMeshTools_Parameters& theParameters)
|
const IMeshTools_Parameters& theParameters)
|
||||||
{
|
{
|
||||||
ClearStatus ();
|
|
||||||
|
|
||||||
Handle (BRepMeshData_Model) aModel;
|
Handle (BRepMeshData_Model) aModel;
|
||||||
try
|
|
||||||
{
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
|
|
||||||
Bnd_Box aBox;
|
Bnd_Box aBox;
|
||||||
BRepBndLib::Add (theShape, aBox, Standard_False);
|
BRepBndLib::Add (theShape, aBox, Standard_False);
|
||||||
@ -85,11 +79,6 @@ Handle (IMeshData_Model) BRepMesh_ModelBuilder::Perform (
|
|||||||
{
|
{
|
||||||
SetStatus (Message_Fail1);
|
SetStatus (Message_Fail1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Standard_Failure&)
|
|
||||||
{
|
|
||||||
SetStatus (Message_Fail2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return aModel;
|
return aModel;
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,15 @@ public:
|
|||||||
//! Destructor.
|
//! Destructor.
|
||||||
Standard_EXPORT virtual ~BRepMesh_ModelBuilder ();
|
Standard_EXPORT virtual ~BRepMesh_ModelBuilder ();
|
||||||
|
|
||||||
|
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
//! Creates discrete model for the given shape.
|
//! Creates discrete model for the given shape.
|
||||||
//! Returns nullptr in case of failure.
|
//! Returns nullptr in case of failure.
|
||||||
Standard_EXPORT virtual Handle (IMeshData_Model) Perform (
|
Standard_EXPORT virtual Handle (IMeshData_Model) performInternal (
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -115,7 +115,7 @@ BRepMesh_ModelHealer::~BRepMesh_ModelHealer()
|
|||||||
// Function: Perform
|
// Function: Perform
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean BRepMesh_ModelHealer::Perform(
|
Standard_Boolean BRepMesh_ModelHealer::performInternal(
|
||||||
const Handle(IMeshData_Model)& theModel,
|
const Handle(IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters)
|
const IMeshTools_Parameters& theParameters)
|
||||||
{
|
{
|
||||||
@ -226,6 +226,10 @@ Standard_Boolean BRepMesh_ModelHealer::popEdgesToUpdate(
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepMesh_ModelHealer::process(const IMeshData::IFaceHandle& theDFace) const
|
void BRepMesh_ModelHealer::process(const IMeshData::IFaceHandle& theDFace) const
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
Handle(IMeshData::MapOfIEdgePtr)& aIntersections = myFaceIntersectingEdges->ChangeFind(theDFace.get());
|
Handle(IMeshData::MapOfIEdgePtr)& aIntersections = myFaceIntersectingEdges->ChangeFind(theDFace.get());
|
||||||
aIntersections.Nullify();
|
aIntersections.Nullify();
|
||||||
|
|
||||||
@ -243,6 +247,11 @@ void BRepMesh_ModelHealer::process(const IMeshData::IFaceHandle& theDFace) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Standard_Failure const&)
|
||||||
|
{
|
||||||
|
theDFace->SetStatus (IMeshData_Failure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function: fixFaceBoundaries
|
// Function: fixFaceBoundaries
|
||||||
|
@ -44,11 +44,6 @@ public:
|
|||||||
//! Destructor.
|
//! Destructor.
|
||||||
Standard_EXPORT virtual ~BRepMesh_ModelHealer();
|
Standard_EXPORT virtual ~BRepMesh_ModelHealer();
|
||||||
|
|
||||||
//! Performs processing of edges of the given model.
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Perform(
|
|
||||||
const Handle(IMeshData_Model)& theModel,
|
|
||||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
|
||||||
|
|
||||||
//! Functor API to discretize the given edge.
|
//! Functor API to discretize the given edge.
|
||||||
inline void operator() (const Standard_Integer theEdgeIndex) const {
|
inline void operator() (const Standard_Integer theEdgeIndex) const {
|
||||||
process(theEdgeIndex);
|
process(theEdgeIndex);
|
||||||
@ -61,6 +56,13 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
|
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! Performs processing of edges of the given model.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||||
|
const Handle(IMeshData_Model)& theModel,
|
||||||
|
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Checks existing discretization of the face and updates data model.
|
//! Checks existing discretization of the face and updates data model.
|
||||||
|
@ -177,7 +177,7 @@ BRepMesh_ModelPostProcessor::~BRepMesh_ModelPostProcessor()
|
|||||||
// Function: Perform
|
// Function: Perform
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean BRepMesh_ModelPostProcessor::Perform(
|
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
|
||||||
const Handle(IMeshData_Model)& theModel,
|
const Handle(IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& /*theParameters*/)
|
const IMeshTools_Parameters& /*theParameters*/)
|
||||||
{
|
{
|
||||||
|
@ -32,12 +32,14 @@ public:
|
|||||||
//! Destructor.
|
//! Destructor.
|
||||||
Standard_EXPORT virtual ~BRepMesh_ModelPostProcessor();
|
Standard_EXPORT virtual ~BRepMesh_ModelPostProcessor();
|
||||||
|
|
||||||
|
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
//! Performs processing of edges of the given model.
|
//! Performs processing of edges of the given model.
|
||||||
Standard_EXPORT virtual Standard_Boolean Perform(
|
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||||
const Handle(IMeshData_Model)& theModel,
|
const Handle(IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -242,7 +242,7 @@ BRepMesh_ModelPreProcessor::~BRepMesh_ModelPreProcessor()
|
|||||||
// Function: Perform
|
// Function: Perform
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean BRepMesh_ModelPreProcessor::Perform(
|
Standard_Boolean BRepMesh_ModelPreProcessor::performInternal(
|
||||||
const Handle(IMeshData_Model)& theModel,
|
const Handle(IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters)
|
const IMeshTools_Parameters& theParameters)
|
||||||
{
|
{
|
||||||
|
@ -33,12 +33,14 @@ public:
|
|||||||
//! Destructor.
|
//! Destructor.
|
||||||
Standard_EXPORT virtual ~BRepMesh_ModelPreProcessor();
|
Standard_EXPORT virtual ~BRepMesh_ModelPreProcessor();
|
||||||
|
|
||||||
|
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
//! Performs processing of edges of the given model.
|
//! Performs processing of edges of the given model.
|
||||||
Standard_EXPORT virtual Standard_Boolean Perform(
|
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||||
const Handle(IMeshData_Model)& theModel,
|
const Handle(IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
#include <BRepMesh_OrientedEdge.hxx>
|
#include <BRepMesh_OrientedEdge.hxx>
|
||||||
#include <BRepMesh_Vertex.hxx>
|
#include <BRepMesh_Vertex.hxx>
|
||||||
|
#include <Standard_OutOfRange.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function: Constructor
|
// Function: Constructor
|
||||||
@ -74,6 +75,9 @@ void BRepMeshData_PCurve::AddPoint (
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
gp_Pnt2d& BRepMeshData_PCurve::GetPoint (const Standard_Integer theIndex)
|
gp_Pnt2d& BRepMeshData_PCurve::GetPoint (const Standard_Integer theIndex)
|
||||||
{
|
{
|
||||||
|
Standard_OutOfRange_Raise_if (
|
||||||
|
theIndex < 0 || theIndex >= static_cast<Standard_Integer>(myPoints2d.size()),
|
||||||
|
"BRepMeshData_PCurve::GetPoint");
|
||||||
return myPoints2d[theIndex];
|
return myPoints2d[theIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +87,9 @@ gp_Pnt2d& BRepMeshData_PCurve::GetPoint (const Standard_Integer theIndex)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer& BRepMeshData_PCurve::GetIndex(const Standard_Integer theIndex)
|
Standard_Integer& BRepMeshData_PCurve::GetIndex(const Standard_Integer theIndex)
|
||||||
{
|
{
|
||||||
|
Standard_OutOfRange_Raise_if (
|
||||||
|
theIndex < 0 || theIndex >= static_cast<Standard_Integer>(myIndices.size()),
|
||||||
|
"BRepMeshData_PCurve::GetIndex");
|
||||||
return myIndices[theIndex];
|
return myIndices[theIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +99,9 @@ Standard_Integer& BRepMeshData_PCurve::GetIndex(const Standard_Integer theIndex)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Real& BRepMeshData_PCurve::GetParameter (const Standard_Integer theIndex)
|
Standard_Real& BRepMeshData_PCurve::GetParameter (const Standard_Integer theIndex)
|
||||||
{
|
{
|
||||||
|
Standard_OutOfRange_Raise_if (
|
||||||
|
theIndex < 0 || theIndex >= ParametersNb(),
|
||||||
|
"BRepMeshData_PCurve::GetParameter");
|
||||||
return myParameters[theIndex];
|
return myParameters[theIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#ifndef _IMeshTools_ModelAlgo_HeaderFile
|
#ifndef _IMeshTools_ModelAlgo_HeaderFile
|
||||||
#define _IMeshTools_ModelAlgo_HeaderFile
|
#define _IMeshTools_ModelAlgo_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
#include <Standard_Failure.hxx>
|
||||||
#include <Standard_Transient.hxx>
|
#include <Standard_Transient.hxx>
|
||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
|
|
||||||
@ -32,10 +34,22 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Performs processing of edges of the given model.
|
//! Exceptions protected processing of the given model.
|
||||||
Standard_EXPORT virtual Standard_Boolean Perform (
|
Standard_Boolean Perform (
|
||||||
const Handle (IMeshData_Model)& theModel,
|
const Handle (IMeshData_Model)& theModel,
|
||||||
const IMeshTools_Parameters& theParameters) = 0;
|
const IMeshTools_Parameters& theParameters)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
|
return performInternal (theModel, theParameters);
|
||||||
|
}
|
||||||
|
catch (Standard_Failure const&)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelAlgo, Standard_Transient)
|
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelAlgo, Standard_Transient)
|
||||||
|
|
||||||
@ -45,6 +59,11 @@ protected:
|
|||||||
Standard_EXPORT IMeshTools_ModelAlgo()
|
Standard_EXPORT IMeshTools_ModelAlgo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Performs processing of the given model.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||||
|
const Handle (IMeshData_Model)& theModel,
|
||||||
|
const IMeshTools_Parameters& theParameters) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -17,6 +17,8 @@
|
|||||||
#define _IMeshTools_ModelBuilder_HeaderFile
|
#define _IMeshTools_ModelBuilder_HeaderFile
|
||||||
|
|
||||||
#include <Message_Algorithm.hxx>
|
#include <Message_Algorithm.hxx>
|
||||||
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
#include <Standard_Failure.hxx>
|
||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
@ -38,11 +40,26 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Creates discrete model for the given shape.
|
//! Exceptions protected method to create discrete model for the given shape.
|
||||||
//! Returns nullptr in case of failure.
|
//! Returns nullptr in case of failure.
|
||||||
Standard_EXPORT virtual Handle (IMeshData_Model) Perform (
|
Handle (IMeshData_Model) Perform (
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const IMeshTools_Parameters& theParameters) = 0;
|
const IMeshTools_Parameters& theParameters)
|
||||||
|
{
|
||||||
|
ClearStatus ();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
|
return performInternal (theShape, theParameters);
|
||||||
|
}
|
||||||
|
catch (Standard_Failure const&)
|
||||||
|
{
|
||||||
|
SetStatus (Message_Fail2);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelBuilder, Message_Algorithm)
|
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_ModelBuilder, Message_Algorithm)
|
||||||
|
|
||||||
@ -52,6 +69,12 @@ protected:
|
|||||||
Standard_EXPORT IMeshTools_ModelBuilder()
|
Standard_EXPORT IMeshTools_ModelBuilder()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Creates discrete model for the given shape.
|
||||||
|
//! Returns nullptr in case of failure.
|
||||||
|
Standard_EXPORT virtual Handle (IMeshData_Model) performInternal (
|
||||||
|
const TopoDS_Shape& theShape,
|
||||||
|
const IMeshTools_Parameters& theParameters) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
15
tests/bugs/mesh/bug30785
Normal file
15
tests/bugs/mesh/bug30785
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
puts "========="
|
||||||
|
puts "0030785: Mesh - protect BRepMesh_IncrementalMesh::Perform from crash"
|
||||||
|
puts "========="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
puts "REQUIRED All: Failure"
|
||||||
|
|
||||||
|
restore [locate_data_file bug30785.brep] s
|
||||||
|
|
||||||
|
# just check if the exception is not raised
|
||||||
|
if {[catch {incmesh s 0.1}]} {
|
||||||
|
puts "Error: Exception is raised by BRepMesh_IncrementalMesh"
|
||||||
|
}
|
||||||
|
|
||||||
|
checktrinfo s -tri
|
Loading…
x
Reference in New Issue
Block a user