0026342: No materials are read from STEP
authorink <ink@opencascade.com>
Thu, 2 Jul 2015 11:30:42 +0000 (14:30 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 2 Jul 2015 11:32:01 +0000 (14:32 +0300)
Changed number of  arguments for descriptive_representation_item (for the case when description is absent).

Test case for issue CR26342

src/RWStepRepr/RWStepRepr_RWDescriptiveRepresentationItem.cxx
tests/bugs/step/bug26342 [new file with mode: 0755]

index 31ab0b4..82e8596 100644 (file)
@@ -12,6 +12,7 @@
 // commercial license or contractual agreement.
 
 #include <RWStepRepr_RWDescriptiveRepresentationItem.ixx>
+#include <TCollection_HAsciiString.hxx>
 
 
 RWStepRepr_RWDescriptiveRepresentationItem::RWStepRepr_RWDescriptiveRepresentationItem () {}
@@ -26,7 +27,17 @@ void RWStepRepr_RWDescriptiveRepresentationItem::ReadStep
 
        // --- Number of Parameter Control ---
 
-       if (!data->CheckNbParams(num,2,ach,"descriptive_representation_item")) return;
+       //if (!data->CheckNbParams(num,2,ach,"descriptive_representation_item")) return;
+  // for the case when description is absent
+  if (data->NbParams(num) != 2 && data->NbParams(num) != 1)
+  {
+    Handle(TCollection_HAsciiString) errmess = new TCollection_HAsciiString(
+      "Count of Parameters is not 1 or 2 for descriptive_representation_item");
+    Handle(TCollection_HAsciiString) errmesso = new TCollection_HAsciiString(
+      "Count of Parameters is not %d or %d for %s");
+    ach->AddFail (errmess->ToCString(),errmesso->ToCString());
+    return;
+  }
 
        // --- inherited field : name ---
 
diff --git a/tests/bugs/step/bug26342 b/tests/bugs/step/bug26342
new file mode 100755 (executable)
index 0000000..0441618
--- /dev/null
@@ -0,0 +1,22 @@
+puts "============"
+puts "OCC26342"
+puts "============"
+puts ""
+
+#######################################################################
+# No materials are read from STEP
+#######################################################################
+
+pload DCAF
+
+ReadStep D [locate_data_file OCC23251-dm1-oc-214.stp] res
+
+set dump_info [ XDumpDF D ]
+
+set XCAFDoc_Material_ID "efd212f8-6dfd-11d4-b9c8-0060b0ee281b"
+
+if { [regexp ${XCAFDoc_Material_ID} ${dump_info}] == 1  } {
+    puts "OK: materials are read from STEP"
+} else {
+    puts "Error : No materials are read from STEP"
+}