]> OCCT Git - occt.git/commitdiff
0031786: Data Exchange - After the importing STEP file the free shape is empty
authorsshutina <sshutina@opencascade.com>
Fri, 25 Sep 2020 07:25:47 +0000 (10:25 +0300)
committerbugmaster <bugmaster@opencascade.com>
Mon, 28 Sep 2020 07:46:03 +0000 (10:46 +0300)
 - Fixed the exception
 - Added the test

src/STEPCAFControl/STEPCAFControl_Reader.cxx
tests/bugs/step/bug31786 [new file with mode: 0644]

index eb88fd3f55f1930931b4f55ba09c5ffce675b2c0..06c7befa6ffe7857930fe3e7a03867361ad017e4 100644 (file)
@@ -4421,8 +4421,10 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
     for (; anIter.More(); anIter.Next()) {
       if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
         Handle(StepRepr_MappedItem) anItem = Handle(StepRepr_MappedItem)::DownCast(anIter.Value());
-        Handle(StepRepr_Representation) aRepr = anItem->MappingSource()->MappedRepresentation();
-        collectViewShapes(theWS, theDoc, aRepr, aShapes);
+        if (Handle(StepRepr_Representation) aRepr = anItem->MappingSource()->MappedRepresentation())
+        {
+          collectViewShapes(theWS, theDoc, aRepr, aShapes);
+        }
       }
       else if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)) ||
         anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout))) {
diff --git a/tests/bugs/step/bug31786 b/tests/bugs/step/bug31786
new file mode 100644 (file)
index 0000000..d40daea
--- /dev/null
@@ -0,0 +1,15 @@
+puts "======="
+puts "0031786: Data Exchange - After the importing STEP file the free shape is empty"
+puts "======="
+puts ""
+
+pload ALL
+
+ReadStep D [locate_data_file bug31786_InternalUseOnly_714-236074-105_NXMBD_A_PNL_SIDE_ENCL_AC_DC_242.stp]
+XGetOneShape result D
+
+vinit
+vdisplay result
+vfit
+
+vdump $imagedir/${casename}.png
\ No newline at end of file