0030544: Data Exchange - IGES import fails on specific file
authorabv <abv@opencascade.com>
Mon, 11 Mar 2019 18:28:52 +0000 (21:28 +0300)
committerapn <apn@opencascade.com>
Mon, 18 Mar 2019 16:45:07 +0000 (19:45 +0300)
Method IGESToBRep_BRepEntity::TransferEdge() is fixed to record result even if it is wire rather than edge.
This allows translation of EdgeLoop entities referring to CompositeCurve items in EdgeList entities.
Curves that fail to translate are recorded in result as Null shapes (rather than skipping them) to keep indexation of curves in EdgeList valid for remaining ones.

Method IGESToBRep_BRepEntity::TransferLoop() is improved to skip failed edges thus avoiding exception and allowing translation to complete for transferable entities.

Warning messages are corrected to be more meaningful.
Added test bugs iges bug30544

src/IGESToBRep/IGESToBRep_BRepEntity.cxx
src/IGESToBRep/IGESToBRep_IGESBoundary.cxx
src/XSMessage/XSMessage_XSTEP_us.pxx
src/XSMessage/XSTEP.fr
src/XSMessage/XSTEP.us
tests/bugs/iges/bug30544 [new file with mode: 0644]

index 5f4b060..22b45f6 100644 (file)
@@ -179,8 +179,7 @@ TopoDS_Vertex IGESToBRep_BRepEntity::TransferVertex
   if ( Sh.IsNull()) { 
     Message_Msg Msg1156("IGES_1156"); //"the Vertex number %d is a null object." FAIL!!!
     Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(start);
-    Msg1156.Arg("vertex %d");
-    Msg1156.Arg(index);
+    Msg1156.Arg("vertex");
     Msg1156.Arg(label);
     SendWarning(start,Msg1156);
   }
@@ -227,7 +226,7 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferEdge
         Msg1306.Arg(inum);
        SendWarning(start,Msg1306);
        TopoDS_Edge Sh;
-       AddShapeResult(start,Sh);
+        AddShapeResult(start,Sh); // add null shape to avoid shift of indexing
       }
       else {
        TopoDS_Shape Sh = TC.TransferTopoCurve(thecurve);
@@ -285,11 +284,11 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferEdge
          }
          else if (Sh.ShapeType() == TopAbs_WIRE) {
            // pas traite 
-           Message_Msg Msg1325("IGES_1325"); //"Edge : result of TransferTopoCurve is WIRE"
+           Message_Msg Msg1325("IGES_1325"); //"Item %d of EdgeList cannot be represented by single edge (non-continuous or composite curve)."
            Msg1325.Arg(inum);
            SendWarning(start,Msg1325);
-           //AddWarning(start,"Edge : result of TransferTopoCurve is WIRE");
-         }
+            AddShapeResult(start,Sh);
+          }
        }
        else {
          Message_Msg Msg1156("IGES_1156");
@@ -297,7 +296,8 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferEdge
          Msg1156.Arg("underlying curve");
          Msg1156.Arg(label);
          SendWarning(start,Msg1156);       
-       }
+          AddShapeResult(start,Sh); // add null shape to avoid shift of indexing
+        }
       }
     }
   }
@@ -306,8 +306,7 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferEdge
   if ( Sh.IsNull()) {
     Message_Msg Msg1156("IGES_1156"); 
     Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(start);
-    Msg1156.Arg("edge %d");
-    Msg1156.Arg(index);
+    Msg1156.Arg("edge");
     Msg1156.Arg(label);
     SendWarning(start,Msg1156);
   }
@@ -371,14 +370,17 @@ TopoDS_Shape IGESToBRep_BRepEntity::TransferLoop(const Handle(IGESSolid_Loop)& s
         else if (( itype == 0) && (theedge ->IsKind(STANDARD_TYPE(IGESSolid_EdgeList)))) {
          DeclareAndCast(IGESSolid_EdgeList,thelist,theedge);
          TopoDS_Shape Sh = TransferEdge(thelist,indexlist);
-         curve3d->Add (Sh);
-       }
+          if (Sh.IsNull())
+          {
+            continue; // skip non-translated edge hoping for the best; warning is already generated by TransferEdge()
+          }
+          curve3d->Add(Sh);
+        }
        else { 
          Message_Msg Msg1365("IGES_1365"); //"Improper type for the edge"
          Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(start);
          Msg1365.Arg(iedge);
          SendWarning(start,Msg1365);
-         //AddWarning (start, "Improper type for the edge");   
          continue;
        }
        if (!orientation) curve3d->Reverse();
index e07ba0e..0afd25a 100644 (file)
@@ -125,7 +125,7 @@ IGESToBRep_IGESBoundary::IGESToBRep_IGESBoundary(const IGESToBRep_CurveAndSurfac
 
  void IGESToBRep_IGESBoundary::Check(const Standard_Boolean,const Standard_Boolean,const Standard_Boolean,const Standard_Boolean) 
 {
-  // Implemented in Advanced Data Exchange
+  // Implemented in IGESControl_IGESBoundary, subject to refactoring
 }
 
 //=======================================================================
index 2d5bef6..79cca7b 100644 (file)
@@ -877,7 +877,7 @@ static const char XSMessage_XSTEP_us[] =
   " Parameter data : parameter 3 or 4 (degree of basis function) is less than one or greater than maximum degree.\n"
   "!\n"
   ".IGES_1325\n"
-  " Resulting geometry not C0-continuous : TopoDS_Edge %d cannot be constructed.\n"
+  " Item %d of EdgeList cannot be represented by single edge (non-continuous or composite curve).\n"
   "!\n"
   ".IGES_1345\n"
   " Parameter data : parameter %d (parameter space curve) is incorrect.\n"
index 217482b..0950a37 100755 (executable)
@@ -873,7 +873,7 @@ L'equation polynomiale est incorrecte.
  Parameter data : le parametre 3 or 4 (degree of basis function) est inferieur a 1 ou superieur a max degree.
 !
 .IGES_1325
La geometrie resultante n'est pas continue en C0 : la construction du TopoDS_Edge %d est impossible.
Item %d of EdgeList cannot be represented by single edge (non-continuous or composite curve).
 !
 .IGES_1345
  Parameter data : le parametre %d (parameter space curve) est incorrect.
index 9dff5b3..2ed80d8 100755 (executable)
@@ -874,7 +874,7 @@ Exception during loading entity %s
  Parameter data : parameter 3 or 4 (degree of basis function) is less than one or greater than maximum degree.
 !
 .IGES_1325
Resulting geometry not C0-continuous : TopoDS_Edge %d cannot be constructed.
Item %d of EdgeList cannot be represented by single edge (non-continuous or composite curve).
 !
 .IGES_1345
  Parameter data : parameter %d (parameter space curve) is incorrect.
diff --git a/tests/bugs/iges/bug30544 b/tests/bugs/iges/bug30544
new file mode 100644 (file)
index 0000000..4c86589
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "0030544: Data Exchange - IGES import  f a i l s  on specific file"
+puts "============"
+
+igesbrep [locate_data_file bug30544_deferry_normal.igs] a *
+
+checkshape a
+checkmaxtol a -ref 0.072
+checknbshapes a -face 18