diff --git a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx index 70be29f4e9..00c5d70272 100644 --- a/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx +++ b/src/BRepToIGESBRep/BRepToIGESBRep_Entity.cxx @@ -869,6 +869,11 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD for (Ex.Init(start, TopAbs_WIRE, TopAbs_FACE); Ex.More(); Ex.Next()) { TopoDS_Wire S = TopoDS::Wire(Ex.Current()); AddWarning(S," a Wire alone is not an IGESBRep entity : no Transfer"); + + BRepToIGES_BRWire BW(*this); + BW.SetModel(GetModel()); + IShape = BW.TransferWire(S); + if (!IShape.IsNull()) Seq->Append(IShape); } @@ -876,6 +881,11 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD for (Ex.Init(start, TopAbs_EDGE, TopAbs_WIRE); Ex.More(); Ex.Next()) { TopoDS_Edge S = TopoDS::Edge(Ex.Current()); AddWarning(S," a Edge alone is not an IGESBRep entity : no Transfer"); + + BRepToIGES_BRWire BW(*this); + BW.SetModel(GetModel()); + IShape = BW.TransferEdge(S, Standard_False); + if (!IShape.IsNull()) Seq->Append(IShape); } @@ -883,27 +893,27 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD for (Ex.Init(start, TopAbs_VERTEX, TopAbs_EDGE); Ex.More(); Ex.Next()) { TopoDS_Vertex S = TopoDS::Vertex(Ex.Current()); AddWarning(S," a Vertex alone is not an IGESBRep entity : no Transfer"); + + BRepToIGES_BRWire BW(*this); + BW.SetModel(GetModel()); + IShape = BW.TransferVertex(S); + if (!IShape.IsNull()) Seq->Append(IShape); } // construct the group Standard_Integer nbshapes = Seq->Length(); - Handle(IGESData_HArray1OfIGESEntity) Tab; - if (nbshapes > 1) { - Tab = new IGESData_HArray1OfIGESEntity(1,nbshapes); + if (nbshapes > 0) { + Handle(IGESData_HArray1OfIGESEntity) Tab = + new IGESData_HArray1OfIGESEntity(1,nbshapes); for (Standard_Integer itab = 1; itab <= nbshapes; itab++) { Handle(IGESData_IGESEntity) item = GetCasted(IGESData_IGESEntity, Seq->Value(itab)); Tab->SetValue(itab,item); } - } - - if (nbshapes == 1) { - res = IShape; - } - else if(nbshapes > 1) { + Handle(IGESBasic_Group) IGroup = new IGESBasic_Group; IGroup->Init(Tab); res = IGroup; - } + } SetShapeResult ( start, res ); diff --git a/tests/bugs/begin b/tests/bugs/begin index a479b20694..fa2889f5ee 100755 --- a/tests/bugs/begin +++ b/tests/bugs/begin @@ -169,14 +169,15 @@ proc checknbshapes { res nbshapes_expected_s count_locations message} { set EntityList {VERTEX EDGE WIRE FACE SHELL SOLID COMPSOLID COMPOUND SHAPE} + puts "Checking $message" foreach Entity ${EntityList} { set expr_string "${Entity} +: +(\[-0-9.+eE\]+)" if { [regexp "${expr_string}" ${nbshapes_expected_s} full nb_entity1] > 0 } { if { [regexp "${expr_string}" ${nb_info} full nb_entity2] > 0 } { if { ${nb_entity2} != ${nb_entity1} } { - puts "Error : ${message} is WRONG because number of ${Entity} entities is ${nb_entity2} while ${nb_entity1} is expected" + puts "Error: number of ${Entity} entities is wrong: ${nb_entity2} while ${nb_entity1} is expected" } else { - puts "OK : ${message} is GOOD because number of ${Entity} entities is equal to number of expected ${Entity} entities" + puts "OK: number of ${Entity} entities is as expected: ${nb_entity2}" } } } diff --git a/tests/bugs/iges/bug25816 b/tests/bugs/iges/bug25816 new file mode 100644 index 0000000000..c913a4ed62 --- /dev/null +++ b/tests/bugs/iges/bug25816 @@ -0,0 +1,17 @@ +# Test issue #25816: writing edges inside compound to IGES 5.3 + +pload MODELING DATAEXCHANGE + +# make compound containing one edge +circle c 0 0 0 0 0 1 1 +mkedge e c +compound e s + +# write to IGES in BREP mode +newmodel +param write.iges.brep.mode 1 +brepiges s ${imagedir}/${casename}.igs + +# read back and check similarity +igesbrep ${imagedir}/${casename}.igs a * +checknbshapes a [nbshapes s] t "Number of sub-shapes in result after saving to IGES and reading back"