1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

Werth 606: Import of STEP file crashes at the very end when visualizing the boundary curves.

When an edge (BRepMeshData_Edge) has multiple PCurve curves (IMeshData_PCurve) with different orientations, the index array is filled for only one PCurve curve.
This would cause problems later, so a fix was made to fill index arrays for curves with another orientation.
This commit is contained in:
mzernova 2023-01-18 09:55:16 +00:00 committed by ika
parent 8573cc5994
commit f67b0c9fec
4 changed files with 48 additions and 25 deletions

View File

@ -101,14 +101,19 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure()
{ {
const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge (aEdgeIt); const IMeshData::IEdgeHandle aDEdge = aDWire->GetEdge (aEdgeIt);
const IMeshData::ICurveHandle& aCurve = aDEdge->GetCurve(); const IMeshData::ICurveHandle& aCurve = aDEdge->GetCurve();
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve( const IMeshData::ListOfInteger& aListOfPCurves = aDEdge->GetPCurves (myDFace.get());
myDFace.get(), aDWire->GetEdgeOrientation(aEdgeIt));
for (IMeshData::ListOfInteger::Iterator aPCurveIt(aListOfPCurves); aPCurveIt.More(); aPCurveIt.Next())
{
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve (aPCurveIt.Value());
const TopAbs_Orientation aOri = fixSeamEdgeOrientation(aDEdge, aPCurve); const TopAbs_Orientation aOri = fixSeamEdgeOrientation(aDEdge, aPCurve);
Standard_Integer aPrevNodeIndex = -1; Standard_Integer aPrevNodeIndex = -1;
const Standard_Integer aLastPoint = aPCurve->ParametersNb() - 1; const Standard_Integer aLastPoint = aPCurve->ParametersNb() - 1;
for (Standard_Integer aPointIt = 0; aPointIt <= aLastPoint; ++aPointIt)
Standard_Integer aPointIt = 0;
for (; aPointIt <= aLastPoint; ++aPointIt)
{ {
const Standard_Integer aNodeIndex = registerNode( const Standard_Integer aNodeIndex = registerNode(
aCurve->GetPoint(aPointIt), aCurve->GetPoint(aPointIt),
@ -134,6 +139,7 @@ Standard_Boolean BRepMesh_BaseMeshAlgo::initDataStructure()
} }
} }
} }
}
return Standard_True; return Standard_True;
} }

View File

@ -91,6 +91,15 @@ const IMeshData::IPCurveHandle& BRepMeshData_Edge::GetPCurve (
myPCurves (aListOfPCurves.Last ()); myPCurves (aListOfPCurves.Last ());
} }
//=======================================================================
// Function: GetPCurves
// Purpose :
//=======================================================================
const IMeshData::ListOfInteger& BRepMeshData_Edge::GetPCurves (const IMeshData::IFacePtr& theDFace) const
{
return myPCurvesMap.Find (theDFace);
}
//======================================================================= //=======================================================================
// Function: GetPCurve // Function: GetPCurve
// Purpose : // Purpose :

View File

@ -48,6 +48,10 @@ public:
const IMeshData::IFacePtr& theDFace, const IMeshData::IFacePtr& theDFace,
const TopAbs_Orientation theOrientation) const Standard_OVERRIDE; const TopAbs_Orientation theOrientation) const Standard_OVERRIDE;
//! Returns an array of pcurves indices for the specified discrete face.
Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves(
const IMeshData::IFacePtr& theDFace) const Standard_OVERRIDE;
//! Returns pcurve with the given index. //! Returns pcurve with the given index.
Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve ( Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
const Standard_Integer theIndex) const Standard_OVERRIDE; const Standard_Integer theIndex) const Standard_OVERRIDE;

View File

@ -52,6 +52,10 @@ public:
const IMeshData::IFacePtr& theDFace, const IMeshData::IFacePtr& theDFace,
const TopAbs_Orientation theOrientation) const = 0; const TopAbs_Orientation theOrientation) const = 0;
//! Returns an array of pcurves indices for the specified discrete face.
Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves (
const IMeshData::IFacePtr& theDFace) const = 0;
//! Returns pcurve with the given index. //! Returns pcurve with the given index.
Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve ( Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
const Standard_Integer theIndex) const = 0; const Standard_Integer theIndex) const = 0;