Skip to content

Commit

Permalink
0033410: Data Exchange, Step Import - TRIANGULATED_FACE from STEP whe…
Browse files Browse the repository at this point in the history
…re there are no pnval entries

Problem fixed by using array of nodes in case when aPnindices is empty.
  • Loading branch information
ir-ch authored and dpasukhi committed Mar 31, 2024
1 parent 392377a commit 44cbb3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ namespace {
// ============================================================================
static void SetNodes(const Handle(Poly_Triangulation)& theMesh,
Handle(TColgp_HArray1OfXYZ)& theNodes,
const Standard_Integer theNumPnindex,
Handle(TColStd_HArray1OfInteger)& thePnindices,
const Standard_Real theLengthFactor)
{
for (Standard_Integer aPnIndex = 1; aPnIndex <= theMesh->NbNodes(); ++aPnIndex)
{
const gp_XYZ& aPoint = theNodes->Value(thePnindices->Value(aPnIndex));
const gp_XYZ& aPoint = theNodes->Value((theNumPnindex > 0) ? thePnindices->Value(aPnIndex) : aPnIndex);
theMesh->SetNode(aPnIndex, theLengthFactor * aPoint);
}
}
Expand Down Expand Up @@ -326,10 +327,11 @@ namespace {

const Standard_Boolean aHasUVNodes = Standard_False;
const Standard_Boolean aHasNormals = (aNormNum > 0);
const Standard_Integer aNbNodes = (aNumPnindex > 0) ? aNumPnindex : aNodes->Length();

if (aTrianStripsNum == 0 && aTrianFansNum == 0)
{
aMesh = new Poly_Triangulation(aNumPnindex, aTrianNum, aHasUVNodes, aHasNormals);
aMesh = new Poly_Triangulation(aNbNodes, aTrianNum, aHasUVNodes, aHasNormals);
}
else
{
Expand Down Expand Up @@ -359,14 +361,14 @@ namespace {
aNbTriaFans += aTriangleFan->Length() - 2;
}

aMesh = new Poly_Triangulation(aNumPnindex, aNbTriaStrips + aNbTriaFans, aHasUVNodes, aHasNormals);
aMesh = new Poly_Triangulation(aNbNodes, aNbTriaStrips + aNbTriaFans, aHasUVNodes, aHasNormals);
}

SetNodes(aMesh, aNodes, aPnindices, theLocalFactors.LengthFactor());
SetNodes(aMesh, aNodes, aNumPnindex, aPnindices, theLocalFactors.LengthFactor());

if (aHasNormals)
{
SetNormals(aMesh, aNormals, aNormNum, aNumPnindex);
SetNormals(aMesh, aNormals, aNormNum, aNbNodes);
}

SetTriangles(aMesh, aTriangles, aTrianStripsNum, aTriaStrips, aTrianFansNum, aTriaFans);
Expand Down
12 changes: 12 additions & 0 deletions tests/bugs/step/bug33410
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
puts "========================"
puts "0033410: Data Exchange, Step Import - TRIANGULATED_FACE from STEP where there are no pnval entries"
puts "========================"

pload OCAF

# Read file
ReadStep D [locate_data_file bug33410.step]
XGetOneShape sh D
checktrinfo sh -face 1 -nod 81 -tri 128

Close D

0 comments on commit 44cbb3d

Please sign in to comment.