From 41b3001c72cfc134bf26d9528f26cd780feae7c8 Mon Sep 17 00:00:00 2001 From: bugmaster Date: Fri, 21 Dec 2012 16:01:04 +0400 Subject: [PATCH] 0023203: STEP import produces wrong surface of revolution on ellipse Checking of XAsis for ellipses was added. Adding test case for this fix --- .../StepToGeom_MakeSurfaceOfRevolution.cxx | 4 +- tests/bugs/step/bug23203 | 60 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100755 tests/bugs/step/bug23203 diff --git a/src/StepToGeom/StepToGeom_MakeSurfaceOfRevolution.cxx b/src/StepToGeom/StepToGeom_MakeSurfaceOfRevolution.cxx index 60eda839ca..75a5e8b4ae 100755 --- a/src/StepToGeom/StepToGeom_MakeSurfaceOfRevolution.cxx +++ b/src/StepToGeom/StepToGeom_MakeSurfaceOfRevolution.cxx @@ -57,7 +57,9 @@ Standard_Boolean StepToGeom_MakeSurfaceOfRevolution::Convert (const Handle(StepG if (rl.Distance(pc) < Precision::Confusion()) { //pc lies on A2 const gp_Dir dirline = A.Direction(); const gp_Dir norm = conic->Axis().Direction(); - if( dirline.IsNormal(norm,Precision::Angular()) ) { //A2 lies on plane of circle + const gp_Dir xAxis = conic->XAxis().Direction(); + //checking A2 lies on plane of circle + if( dirline.IsNormal(norm,Precision::Angular()) && (dirline.IsParallel(xAxis,Precision::Angular()) || C->IsKind(STANDARD_TYPE(Geom_Circle)))) { //change parametrization for trimming gp_Ax2 axnew(pc,norm,dirline.Reversed()); conic->SetPosition(axnew); diff --git a/tests/bugs/step/bug23203 b/tests/bugs/step/bug23203 new file mode 100755 index 0000000000..07525ad5dd --- /dev/null +++ b/tests/bugs/step/bug23203 @@ -0,0 +1,60 @@ +puts "========================" +puts "OCC23203" +puts "========================" +puts "" +####################################################################### +# STEP import produces wrong surface of revolution on ellipse +####################################################################### + +ellipse e 0 0 0 0 -1 0 1 0 -1 10 5 +revsurf re e 0 0 0 0 0 1 +mkface f re 0 3 0 1 +newmodel + +set aFile ${imagedir}/bug23203.stp +file delete ${aFile} +if { [file exists ${aFile}] } { + puts "Error : There is old ${aFile} file." +} + +stepwrite 0 f ${aFile} +stepread ${aFile} res * +file delete ${aFile} + +explode res_1 f +mksurface ress1 res_1_1 +set log [dump ress1] + +if {[regexp {Trimmed +curve} ${log}]} { + puts "Error: bad basis curve" +} else { + puts "OK: good basis curve" +} + +regexp {XAxis :([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} ${log} full XAxis1 XAxis2 XAxis3 +regexp {YAxis :([-0-9.+eE]+), +([-0-9.+eE]+), +([-0-9.+eE]+)} ${log} full YAxis1 YAxis2 YAxis3 + +set good_XAxis1 0.707106781186548 +set good_XAxis2 0 +set good_XAxis3 -0.707106781186548 +set good_YAxis1 0.707106781186548 +set good_YAxis2 0 +set good_YAxis3 0.707106781186548 + +set Precision 1.e6 + +if {[expr abs(${XAxis1} - ${good_XAxis1})] > ${Precision} || + [expr abs(${XAxis2} - ${good_XAxis2})] > ${Precision} || + [expr abs(${XAxis3} - ${good_XAxis3})] > ${Precision}} { + puts "Error : bad XAxis" +} else { + puts "OK : good XAxis" +} + +if {[expr abs(${YAxis1} - ${good_YAxis1})] > ${Precision} || + [expr abs(${YAxis2} - ${good_YAxis2})] > ${Precision} || + [expr abs(${YAxis3} - ${good_YAxis3})] > ${Precision}} { + puts "Error : bad YAxis" +} else { + puts "OK : good YAxis" +}