From d5bcd33386e6ceca6b724aa34a0d1b2e5755332f Mon Sep 17 00:00:00 2001 From: ichesnok Date: Fri, 8 Mar 2024 13:38:18 +0000 Subject: [PATCH] 0033631: Data Exchange, Step import - Crash by reading STEP file Creating Poly_Triangulation from ComplexTriangulatedSurfaceSet was fixed. --- src/STEPCAFControl/STEPCAFControl_Reader.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 9c61aa1f85..0dd16f6189 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -2018,7 +2018,7 @@ Handle(Poly_Triangulation) createMesh(const Handle(StepVisual_ComplexTriangulate const Standard_Integer aNbNormals = theTriangulatedSufaceSet->NbNormals(); // Number of pairs (Point, Normal). It is possible for one point to have multiple normals. This is // useful when the underlying surface is not C1 continuous. - const Standard_Integer aNbPairs = aNbNormals > 1 ? theTriangulatedSufaceSet->NbPnindex() : aNodes->Length(); + const Standard_Integer aNbPairs = aNbNormals > 1 ? theTriangulatedSufaceSet->Pnmax() : aNodes->Length(); const Standard_Boolean aHasNormals = aNbNormals > 0; // Counting number of triangles in the triangle strips list. @@ -2043,7 +2043,7 @@ Handle(Poly_Triangulation) createMesh(const Handle(StepVisual_ComplexTriangulate for (Standard_Integer j = 1; j <= aNbPairs; ++j) { - const gp_XYZ& aPoint = aNodes->Value(aNbNormals > 1 ? theTriangulatedSufaceSet->PnindexValue(j) : j); + const gp_XYZ& aPoint = aNodes->Value((aNbNormals > 1 && theTriangulatedSufaceSet->NbPnindex() > 0) ? theTriangulatedSufaceSet->PnindexValue(j) : j); aMesh->SetNode(j, theFact * aPoint); }