]> OCCT Git - occt-copy.git/commitdiff
0026289: STEP import/export produces an empty shape
authorgka <gka@opencascade.com>
Thu, 20 Aug 2015 13:53:50 +0000 (16:53 +0300)
committerabv <abv@opencascade.com>
Wed, 2 Sep 2015 11:39:18 +0000 (14:39 +0300)
Exception is raised during reading step file containing p-curve having not-unique last knot.
Modification correcting misprint during computation new numbers of poles for such case was made in the file StepToGeom_MakeBSplineCurve.pxx
Protection against exception was made in the file StepToTopoDS/StepToTopoDS_TranslateEdge.cxx.
Warning message was added in the file StepToTopoDS_TranslateEdgeLoop.cxx.

Test case for issue CR26289

src/StepToGeom/StepToGeom_MakeBSplineCurve.pxx
src/StepToTopoDS/StepToTopoDS_TranslateEdge.cxx
src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx
tests/bugs/step/bug26289 [new file with mode: 0755]

index ee5f6ade4e2a4a5972fe0d51b94f20828af64c31..8b2aa773033cd66ad3d92201b626768ccefa469a 100644 (file)
@@ -75,7 +75,7 @@
     if (aCurrentVal > Deg + 1)
     {
       if (i == 1)       aFMulDiff = aCurrentVal - Deg - 1;
-      if (i == NbKnots) aLMulDiff = aCurrentVal - Deg - 1;
+      if (i == NbUniqueKnots) aLMulDiff = aCurrentVal - Deg - 1;
 #ifdef OCCT_DEBUG
       cout << "\nWrong multiplicity " << aCurrentVal <<  " on " << i 
            << " knot!" << "\nChanged to " << Deg + 1 << endl;
index 2078652d208ad734b92708d35b7004cfe992b937..c06fff169e3dbb754b7c9c790995043452f98347 100644 (file)
@@ -57,6 +57,7 @@
 #include <StepToGeom_MakeCurve2d.hxx>
 #include <StepRepr_DefinitionalRepresentation.hxx>
 #include <UnitsMethods.hxx>
+#include <Standard_Failure.hxx>
 
 //:d8
 #include <StepShape_VertexPoint.hxx>
@@ -504,11 +505,19 @@ Handle(Geom2d_Curve)  StepToTopoDS_TranslateEdge::MakePCurve
   const Handle(StepRepr_DefinitionalRepresentation) DRI = PCU->ReferenceToCurve();
   if( DRI.IsNull()) return C2d;
   const Handle(StepGeom_Curve) StepCurve = Handle(StepGeom_Curve)::DownCast(DRI->ItemsValue(1));
-  if (StepToGeom_MakeCurve2d::Convert(StepCurve,C2d)) {
+  try
+  {
+    if (StepToGeom_MakeCurve2d::Convert(StepCurve,C2d)) {
     // -- if the surface is a RectangularTrimmedSurface, 
     // -- send the BasisSurface.
     C2d = UnitsMethods::DegreeToRadian(C2d, ConvSurf);
   }
+    
+  }
+  catch(Standard_Failure)
+  {
+  return C2d;
+}
   return C2d;
 }
 
index bc4c0c71cdd02415890dd900a03428f33aaa3b9f..ac9f8ced4e6edf7791ed1d02003f57f62fbd0afd 100644 (file)
@@ -556,6 +556,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
          while (lastpcurve > 0) {
            C2d1 = myTranEdge.MakePCurve (StepPCurve,ConvSurf);
            if (C2d1.IsNull()) {
+         TP->AddWarning(EC,"Incorrect pcurve is not translated. Pcurve definition is not correct");
              hasPcurve = Standard_False;
              break;
            }
diff --git a/tests/bugs/step/bug26289 b/tests/bugs/step/bug26289
new file mode 100755 (executable)
index 0000000..3d4174c
--- /dev/null
@@ -0,0 +1,28 @@
+puts "============"
+puts "OCC26289"
+puts "============"
+puts ""
+#######################################################################
+# STEP import/export produces an empty shape
+#######################################################################
+
+restore [locate_data_file bug26289_solid_3.brep] a1
+
+set aFile ${imagedir}/bug26289.stp
+catch { file delete ${aFile} }
+
+stepwrite a a1 ${aFile}
+
+stepread ${aFile} b *
+
+checknbshapes b_1 -vertex 338 -edge 673 -wire 337 -face 337 -shell 1 -solid 1 -compsolid 0 -compound 0 -shape 1687 -m "Shape"
+
+vinit View1
+vdisplay a1
+vfit
+vdump ${imagedir}/${casename}_1.png
+
+vinit View2
+vdisplay b_1
+vfit
+vdump ${imagedir}/${casename}_2.png