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

0022820: OCCT IGES writer loses plane information

added writing planes in Type 108 not like BSplines
pcurves for planes not writing
add parameter for choice between writing planes in BSplines and Planes
0022820: OCCT IGES writer loses plane information

pcurves were prohibited also for BRep mode
Adding test case for this fix
This commit is contained in:
ika 2012-12-28 18:30:58 +04:00
parent 1a7dfdb719
commit a8fcd8d07e
4 changed files with 90 additions and 38 deletions

View File

@ -31,6 +31,7 @@
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf.hxx>
#include <gp_Trsf2d.hxx>
@ -42,6 +43,7 @@
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_ToroidalSurface.hxx>
@ -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;

View File

@ -75,6 +75,7 @@
#include <IGESSolid_PlaneSurface.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
#include <gce_MakeLin.hxx>
@ -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;
}
}

View File

@ -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
// -----------------

30
tests/bugs/iges/bug22820 Executable file
View File

@ -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"
}