diff --git a/src/BRepToIGES/BRepToIGES_BRWire.cxx b/src/BRepToIGES/BRepToIGES_BRWire.cxx index 6c8b35736d..b8d54213e7 100755 --- a/src/BRepToIGES/BRepToIGES_BRWire.cxx +++ b/src/BRepToIGES/BRepToIGES_BRWire.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -332,9 +334,7 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge& // returns the 2d curve associated to myedge in the parametric space of myface Standard_Real First, Last; - - Handle(Geom2d_Curve) Curve2d = BRep_Tool::CurveOnSurface - (myedge, myface, First, Last); + Handle(Geom2d_Curve) Curve2d = BRep_Tool::CurveOnSurface(myedge, myface, First, Last); Handle(IGESData_IGESEntity) ICurve2d; //#29 rln 19.10.98 @@ -347,6 +347,9 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge& TopLoc_Location L; Handle(Geom_Surface) st = BRep_Tool::Surface(myface, L); + if (st->IsKind(STANDARD_TYPE(Geom_Plane))){ + return res; + } Standard_Real Ufirst, Ulast, Vfirst, Vlast; BRepTools::UVBounds(myface, Ufirst, Ulast, Vfirst, Vlast); Handle(Geom_Surface) Surf; diff --git a/src/GeomToIGES/GeomToIGES_GeomSurface.cxx b/src/GeomToIGES/GeomToIGES_GeomSurface.cxx index 19999fb470..f70c843514 100755 --- a/src/GeomToIGES/GeomToIGES_GeomSurface.cxx +++ b/src/GeomToIGES/GeomToIGES_GeomSurface.cxx @@ -75,6 +75,7 @@ #include #include +#include #include @@ -505,45 +506,56 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle if (start.IsNull()) { return res; } + if (Interface_Static::IVal("write.iges.plane.mode") == 0){ + Handle(IGESGeom_Plane) aPlane = new IGESGeom_Plane; + Standard_Real A,B,C,D; + start->Coefficients(A,B,C,D); + D = -D;// because of difference in Geom_Plane class and Type 108 + gp_XYZ anAttach = start->Location().XYZ(); + aPlane->Init(A,B,C,D,0,anAttach,0); + res = aPlane; + return res; + } + else{ + Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface; + gp_Pnt P1 ,P2, P3, P4; + start->D0(Udeb, Vdeb, P1); + start->D0(Udeb, Vfin, P2); + start->D0(Ufin, Vdeb, P3); + start->D0(Ufin, Vfin, P4); + Handle(TColgp_HArray2OfXYZ) Poles = new TColgp_HArray2OfXYZ(0, 1, 0, 1); + Standard_Real X,Y,Z; + P1.Coord(X,Y,Z); + Poles->SetValue (0, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); + P2.Coord(X,Y,Z); + Poles->SetValue (0, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); + P3.Coord(X,Y,Z); + Poles->SetValue (1, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); + P4.Coord(X,Y,Z); + Poles->SetValue (1, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); - Handle(IGESGeom_BSplineSurface) BSpline = new IGESGeom_BSplineSurface; - gp_Pnt P1 ,P2, P3, P4; - start->D0(Udeb, Vdeb, P1); - start->D0(Udeb, Vfin, P2); - start->D0(Ufin, Vdeb, P3); - start->D0(Ufin, Vfin, P4); - Handle(TColgp_HArray2OfXYZ) Poles = new TColgp_HArray2OfXYZ(0, 1, 0, 1); - Standard_Real X,Y,Z; - P1.Coord(X,Y,Z); - Poles->SetValue (0, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); - P2.Coord(X,Y,Z); - Poles->SetValue (0, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); - P3.Coord(X,Y,Z); - Poles->SetValue (1, 0, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); - P4.Coord(X,Y,Z); - Poles->SetValue (1, 1, gp_XYZ(X/GetUnit(),Y/GetUnit(),Z/GetUnit())); + Handle(TColStd_HArray1OfReal) KnotsU = new TColStd_HArray1OfReal(-1,2); + KnotsU->SetValue(-1, Udeb); + KnotsU->SetValue(0, Udeb); + KnotsU->SetValue(1, Ufin); + KnotsU->SetValue(2, Ufin); - Handle(TColStd_HArray1OfReal) KnotsU = new TColStd_HArray1OfReal(-1,2); - KnotsU->SetValue(-1, Udeb); - KnotsU->SetValue(0, Udeb); - KnotsU->SetValue(1, Ufin); - KnotsU->SetValue(2, Ufin); + Handle(TColStd_HArray1OfReal) KnotsV = new TColStd_HArray1OfReal(-1,2); + KnotsV->SetValue(-1, Vdeb); + KnotsV->SetValue(0, Vdeb); + KnotsV->SetValue(1, Vfin); + KnotsV->SetValue(2, Vfin); - Handle(TColStd_HArray1OfReal) KnotsV = new TColStd_HArray1OfReal(-1,2); - KnotsV->SetValue(-1, Vdeb); - KnotsV->SetValue(0, Vdeb); - KnotsV->SetValue(1, Vfin); - KnotsV->SetValue(2, Vfin); + Handle(TColStd_HArray2OfReal) Weights = + new TColStd_HArray2OfReal(0, 1, 0, 1, 1.); - Handle(TColStd_HArray2OfReal) Weights = - new TColStd_HArray2OfReal(0, 1, 0, 1, 1.); - - //#32 rln 19.10.98 - BSpline-> Init ( 1, 1, 1, 1, Standard_False , Standard_False, Standard_True, - Standard_False, Standard_False, - KnotsU, KnotsV, Weights, Poles, Udeb, Ufin, Vdeb, Vfin); - res = BSpline; - return res; + //#32 rln 19.10.98 + BSpline-> Init ( 1, 1, 1, 1, Standard_False , Standard_False, Standard_True, + Standard_False, Standard_False, + KnotsU, KnotsV, Weights, Poles, Udeb, Ufin, Vdeb, Vfin); + res = BSpline; + return res; + } } diff --git a/src/IGESData/IGESData.cxx b/src/IGESData/IGESData.cxx index e670d76c12..06e812fd33 100755 --- a/src/IGESData/IGESData.cxx +++ b/src/IGESData/IGESData.cxx @@ -125,6 +125,13 @@ static Handle(IGESData_DefaultSpecific) speci; Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval Off"); Interface_Static::Init ("XSTEP","read.iges.faulty.entities",'&',"eval On"); Interface_Static::SetIVal ("read.iges.faulty.entities",0); + + //ika added parameter for writing planes mode 2.11.2012 + Interface_Static::Init ("XSTEP","write.iges.plane.mode",'e',""); + Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"ematch 0"); + Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"eval Plane"); + Interface_Static::Init ("XSTEP","write.iges.plane.mode",'&',"eval BSpline"); + Interface_Static::SetIVal ("write.iges.plane.mode",0); // Message File for IGES // ----------------- diff --git a/tests/bugs/iges/bug22820 b/tests/bugs/iges/bug22820 new file mode 100755 index 0000000000..116054e73d --- /dev/null +++ b/tests/bugs/iges/bug22820 @@ -0,0 +1,30 @@ +puts "================" +puts "OCC22820" +puts "================" +puts "" +####################################################################################### +# OCCT IGES writer loses plane information +###################################################################################### + +pload XDE + +box b 1 1 1 +set b_info [dump b] +if { [regexp BSplineSurface ${b_info}] } { + puts "Error in dump b" +} + +brepiges b 0 +igesbrep . bb * + +set types_info [listtypes] +puts "types_info=${types_info}" +if { [regexp BSplineSurface ${types_info}] } { + puts "Error in listtypes" +} + +igesbrep . bb * +set bb_info [dump bb] +if { [regexp BSplineSurface ${bb_info}] } { + puts "Error in dump bb" +}