1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0022731: Error on attempt to write in IGES 5.3 the attached brep model

This commit is contained in:
GKA 2012-01-27 14:48:21 +00:00 committed by bugmaster
parent 86eff19ec7
commit 572db63c30
2 changed files with 16 additions and 4 deletions

View File

@ -161,6 +161,8 @@ void BRepToIGESBRep_Entity::TransferVertexList()
{ {
Standard_Integer nbvertices = myVertices.Extent(); Standard_Integer nbvertices = myVertices.Extent();
if(!nbvertices)
return;
Handle(TColgp_HArray1OfXYZ) vertices= new TColgp_HArray1OfXYZ(1,nbvertices); Handle(TColgp_HArray1OfXYZ) vertices= new TColgp_HArray1OfXYZ(1,nbvertices);
Standard_Real Unit = GetUnit(); Standard_Real Unit = GetUnit();
Standard_Real X,Y,Z; Standard_Real X,Y,Z;
@ -222,6 +224,8 @@ void BRepToIGESBRep_Entity::TransferEdgeList()
Handle(IGESSolid_VertexList) myendlist; Handle(IGESSolid_VertexList) myendlist;
Standard_Integer nbedges = myEdges.Extent(); Standard_Integer nbedges = myEdges.Extent();
if(!nbedges)
return;
Handle(IGESData_HArray1OfIGESEntity) Curves= Handle(IGESData_HArray1OfIGESEntity) Curves=
new IGESData_HArray1OfIGESEntity(1,nbedges); new IGESData_HArray1OfIGESEntity(1,nbedges);
Handle(IGESSolid_HArray1OfVertexList) startVertexList = Handle(IGESSolid_HArray1OfVertexList) startVertexList =
@ -349,6 +353,8 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferShape
// error message // error message
} }
} }
if(res.IsNull())
return res;
TransferVertexList(); TransferVertexList();
TransferEdgeList(); TransferEdgeList();
@ -785,7 +791,7 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompSolid (const Topo
if (nbsolids == 1) { if (nbsolids == 1) {
myent = ISolid; myent = ISolid;
} }
else { else if(nbsolids > 1 ){
Handle(IGESBasic_Group) IGroup = new IGESBasic_Group; Handle(IGESBasic_Group) IGroup = new IGESBasic_Group;
IGroup->Init(Tab); IGroup->Init(Tab);
myent = IGroup; myent = IGroup;
@ -880,11 +886,11 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferCompound (const TopoD
Tab->SetValue(itab,item); Tab->SetValue(itab,item);
} }
} }
if (nbshapes == 1) { if (nbshapes == 1) {
res = IShape; res = IShape;
} }
else { else if(nbshapes > 1) {
Handle(IGESBasic_Group) IGroup = new IGESBasic_Group; Handle(IGESBasic_Group) IGroup = new IGESBasic_Group;
IGroup->Init(Tab); IGroup->Init(Tab);
res = IGroup; res = IGroup;

View File

@ -110,6 +110,9 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape)
BRepToIGESBRep_Entity B1; B1.SetTransferProcess(theTP); B1.SetModel(themod); BRepToIGESBRep_Entity B1; B1.SetTransferProcess(theTP); B1.SetModel(themod);
if (thecr) ent = B1.TransferShape(Shape); if (thecr) ent = B1.TransferShape(Shape);
else ent = B0.TransferShape(Shape); else ent = B0.TransferShape(Shape);
if(ent.IsNull())
return Standard_False;
// modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___ // modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___
XSAlgo::AlgoContainer()->MergeTransferInfo(theTP, info); XSAlgo::AlgoContainer()->MergeTransferInfo(theTP, info);
// modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___ // modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___
@ -226,9 +229,12 @@ Standard_Boolean IGESControl_Writer::Write
{ {
if (!S) return Standard_False; if (!S) return Standard_False;
ComputeModel(); ComputeModel();
Standard_Integer nbEnt = themod->NbEntities();
#ifdef DEBUG #ifdef DEBUG
cout<<" IGES Write : "<<themod->NbEntities()<<" ent.s"<< flush; cout<<" IGES Write : "<<nbEnt<<" ent.s"<< flush;
#endif #endif
if(!nbEnt)
return Standard_False;
IGESData_IGESWriter IW (themod); IGESData_IGESWriter IW (themod);
// ne pas oublier le mode fnes ... a transmettre a IW // ne pas oublier le mode fnes ... a transmettre a IW
IW.SendModel (IGESSelect_WorkLibrary::DefineProtocol()); IW.SendModel (IGESSelect_WorkLibrary::DefineProtocol());