From 404504b2341b242d367f9d7b04a905a465220c41 Mon Sep 17 00:00:00 2001 From: abv Date: Mon, 11 Mar 2019 21:28:52 +0300 Subject: [PATCH] 0030544: Data Exchange - IGES import fails on specific file 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 | 26 ++++++++++++---------- src/IGESToBRep/IGESToBRep_IGESBoundary.cxx | 2 +- src/XSMessage/XSMessage_XSTEP_us.pxx | 2 +- src/XSMessage/XSTEP.fr | 2 +- src/XSMessage/XSTEP.us | 2 +- tests/bugs/iges/bug30544 | 9 ++++++++ 6 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 tests/bugs/iges/bug30544 diff --git a/src/IGESToBRep/IGESToBRep_BRepEntity.cxx b/src/IGESToBRep/IGESToBRep_BRepEntity.cxx index 5f4b0604f1..22b45f6ee1 100644 --- a/src/IGESToBRep/IGESToBRep_BRepEntity.cxx +++ b/src/IGESToBRep/IGESToBRep_BRepEntity.cxx @@ -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(); diff --git a/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx b/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx index e07ba0e88a..0afd25a328 100644 --- a/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx +++ b/src/IGESToBRep/IGESToBRep_IGESBoundary.cxx @@ -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 } //======================================================================= diff --git a/src/XSMessage/XSMessage_XSTEP_us.pxx b/src/XSMessage/XSMessage_XSTEP_us.pxx index 2d5bef6dbe..79cca7b145 100644 --- a/src/XSMessage/XSMessage_XSTEP_us.pxx +++ b/src/XSMessage/XSMessage_XSTEP_us.pxx @@ -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" diff --git a/src/XSMessage/XSTEP.fr b/src/XSMessage/XSTEP.fr index 217482b882..0950a37235 100755 --- a/src/XSMessage/XSTEP.fr +++ b/src/XSMessage/XSTEP.fr @@ -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. diff --git a/src/XSMessage/XSTEP.us b/src/XSMessage/XSTEP.us index 9dff5b33ab..2ed80d8105 100755 --- a/src/XSMessage/XSTEP.us +++ b/src/XSMessage/XSTEP.us @@ -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 index 0000000000..4c865894e5 --- /dev/null +++ b/tests/bugs/iges/bug30544 @@ -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