From ae58f70718a089f84178d45a1bf9bee586d52d80 Mon Sep 17 00:00:00 2001 From: ika Date: Mon, 18 May 2020 16:21:22 +0300 Subject: [PATCH] 0031568: Data Exchange - invalid model produced after STEP import Add protection against reference to reference in STEP import. --- src/STEPCAFControl/STEPCAFControl_Reader.cxx | 4 +++- tests/bugs/step/bug31568 | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/bugs/step/bug31568 diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 487c991812..77dcf0de30 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -810,7 +810,9 @@ TDF_Label STEPCAFControl_Reader::AddShape(const TopoDS_Shape &S, TDF_Label subL = AddShape(Sub0, STool, NewShapesMap, ShapePDMap, PDFileMap, ShapeLabelMap); if (!subL.IsNull()) { TDF_Label instL = STool->AddComponent(L, subL, it.Value().Location()); - ShapeLabelMap.Bind(it.Value(), instL); + if (!ShapeLabelMap.IsBound(it.Value())) { + ShapeLabelMap.Bind(it.Value(), instL); + } } } if (SHAS.Length() > 0) STool->SetExternRefs(L, SHAS); diff --git a/tests/bugs/step/bug31568 b/tests/bugs/step/bug31568 new file mode 100644 index 0000000000..67eb6a7a14 --- /dev/null +++ b/tests/bugs/step/bug31568 @@ -0,0 +1,13 @@ +puts "=================================================================" +puts "0031568: Data Exchange - invalid model produced after STEP import" +puts "=================================================================" + +pload DCAF + +ReadStep D [locate_data_file bug31568_Konecranes_Sample_3D.stp] +set ref [XGetReferredShape D 0:1:1:41:11] +if {$ref != "0:1:1:23"} { + puts "Error: wrong reference in data model" +} + +Close D