From efe960751c1c6abf077870b477aa15e8676c4d71 Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Mon, 20 Feb 2023 12:45:48 +0000 Subject: [PATCH] 0033331: Data Exchange, Step Import - Unsupported Representation Items Fixed problem with iteration on Null RI --- src/STEPCAFControl/STEPCAFControl_Reader.cxx | 13 ++++++++++--- tests/bugs/step/bug33331 | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/step/bug33331 diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index a211ebbb94..cae2a1bf28 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -4692,9 +4692,16 @@ void collectRepresentationItems(const Interface_Graph& theGraph, const Handle(StepShape_ShapeRepresentation)& theRepresentation, NCollection_Sequence& theItems) { - Handle(StepRepr_HArray1OfRepresentationItem) aReprItems = theRepresentation->Items(); - for (Standard_Integer itemIt = aReprItems->Lower(); itemIt <= aReprItems->Upper(); itemIt++) - theItems.Append(aReprItems->Value(itemIt)); + for (StepRepr_HArray1OfRepresentationItem::Iterator anIter(theRepresentation->Items()->Array1()); + anIter.More(); anIter.Next()) + { + const Handle(StepRepr_RepresentationItem)& anReprItem = anIter.Value(); + if (anReprItem.IsNull()) + { + continue; + } + theItems.Append(anReprItem); + } Interface_EntityIterator entIt = theGraph.TypedSharings(theRepresentation, STANDARD_TYPE(StepRepr_RepresentationRelationship)); for (entIt.Start(); entIt.More(); entIt.Next()) diff --git a/tests/bugs/step/bug33331 b/tests/bugs/step/bug33331 new file mode 100644 index 0000000000..73cc77d328 --- /dev/null +++ b/tests/bugs/step/bug33331 @@ -0,0 +1,14 @@ +puts "====================================" +puts "0033331: Data Exchange, Step Import - Unsupported Representation Items" +puts "====================================" +puts "" + +pload DCAF +catch {Close D} + +param "read.stepcaf.subshapes.name" 1 + +ReadStep D [locate_data_file bug33331.stp] + +param "read.stepcaf.subshapes.name" 0 +Close D