0022715: Incorrect faces of the filleted cube after import from iges file
authorika <ika@opencascade.com>
Fri, 28 Dec 2012 13:59:09 +0000 (17:59 +0400)
committerika <ika@opencascade.com>
Fri, 28 Dec 2012 13:59:09 +0000 (17:59 +0400)
Writing and reading tabulated cylinders in IGES were changed in accordance of Type 122 (parametrization [0,1]x[0,1]

some cosmetic changes
Adding test cases for this fix

src/BRepToIGES/BRepToIGES_BRWire.cxx
src/IGESToBRep/IGESToBRep_TopoSurface.cxx
tests/bugs/iges/bug22715_1 [new file with mode: 0755]
tests/bugs/iges/bug22715_2 [new file with mode: 0755]

index ffb102a..6c8b357 100755 (executable)
@@ -445,17 +445,10 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge&
 //      trans.SetScale(gp_Pnt2d(0,0),1./Vlast);
 
       Standard_Real du = 1.;
-      Handle(Geom_SurfaceOfLinearExtrusion) LE =
-        Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(Surf);
-      if(LE->BasisCurve()->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
-        Handle(Geom_TrimmedCurve) tc =
-          Handle(Geom_TrimmedCurve)::DownCast(LE->BasisCurve());
-        if(tc->BasisCurve()->IsKind(STANDARD_TYPE(Geom_Line))) {
-          Standard_Real us1,us2,vs1,vs2;
-          Surf->Bounds(us1,us2,vs1,vs2);
-          du = us2-us1;
-        }
-      }
+      Standard_Real us1,us2,vs1,vs2;
+      //scaling parameterization to [0,1]
+      Surf->Bounds(us1,us2,vs1,vs2);
+      du = us2-us1;
       //emv: changed for bug OCC22126 17.12.2010
       uFact = (Vlast - Vfirst)/du;
       //uFact = aDiv/du;
@@ -475,7 +468,11 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge&
     if(Surf->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
       //emv: changed for bug OCC22126 17.12.2010
       gp_Trsf2d trans1;
-      trans1.SetTranslation(gp_Vec2d(0.,-Vfirst/(Vlast-Vfirst)));
+      Standard_Real us1,us2,vs1,vs2,du;
+      //computing shift of pcurves
+      Surf->Bounds(us1,us2,vs1,vs2);
+      du = us2-us1;
+      trans1.SetTranslation(gp_Vec2d(-us1/du,-Vfirst/(Vlast-Vfirst)));
       Curve2d = sbe.TransformPCurve(Curve2d,trans1,1.,First,Last);
     }
 
index ea324d1..06cd795 100755 (executable)
@@ -899,16 +899,6 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferTabulatedCylinder
   try {
     OCC_CATCH_SIGNALS
     if (extractCurve3d(directrix, aBasisCurve)) {
-      // PTV 29.08.2002 OCC663 file D44-11325-6.igs, entity 4640
-      if (igesDirectrix->IsKind(STANDARD_TYPE(IGESGeom_ConicArc))) {
-        // PTV 30.08.2002 remove regression on xloop k1.brep in face and brep mode.
-        Standard_Real tmpF, tmpL, tmpToler;
-        tmpF = aBasisCurve->FirstParameter();
-        tmpL = aBasisCurve->LastParameter();
-        tmpToler = Precision::PConfusion();
-        if ( (fabs(tmpF) >= tmpToler) && (fabs(tmpL - 2*M_PI) >= tmpToler) )
-          reparamBSpline (aBasisCurve, tmpF, tmpL);
-      }
       gp_Vec dir (pt1, pt2);
       Handle(Geom_Surface) aResultSurf = 
         new Geom_SurfaceOfLinearExtrusion(aBasisCurve, dir);
@@ -1804,15 +1794,13 @@ TopoDS_Shape IGESToBRep_TopoSurface::ParamSurface(const Handle(IGESData_IGESEnti
     Handle(IGESGeom_TabulatedCylinder) igtc = Handle(IGESGeom_TabulatedCylinder)::DownCast(isrf);
     Handle(IGESData_IGESEntity) idie = igtc->Directrix();
     Standard_Real uln=1;
-    if(idie->TypeNumber()==110) {
-      Handle(IGESGeom_Line) igl = Handle(IGESGeom_Line)::DownCast(idie);
-      gp_Pnt SP = igl->StartPoint();
-      gp_Pnt EP = igl->EndPoint();
-      // PTV OCC659 
-      // PTV file D44-11325-6.igs. Faces with parametric curves need * GetUnitFactor();
-      uln=SP.Distance(EP) * GetUnitFactor();
-    }
+    Standard_Real Umin,Umax,Vmin,Vmax;
+    //scaling parameterization from [0,1]
+    Surf->Bounds(Umin,Umax,Vmin,Vmax);
+    uln = Abs(Umax-Umin);
+    //computing shift of pcurves
     uscale = uln/cscale;
+    paramu = Umin/uln;
   }
   
   if (isrf->IsKind(STANDARD_TYPE(IGESSolid_CylindricalSurface))||
diff --git a/tests/bugs/iges/bug22715_1 b/tests/bugs/iges/bug22715_1
new file mode 100755 (executable)
index 0000000..74dc4d1
--- /dev/null
@@ -0,0 +1,45 @@
+puts "============"
+puts "OCC22715"
+puts "============"
+puts ""
+#######################################################################
+# Incorrect faces of the filleted cube after import from iges file
+#######################################################################
+
+readstep [locate_data_file bug22715_cube.stp] s1 *
+puts [whatis s1]
+explode s1 F
+
+checkshape s1_1
+checkshape s1_2
+checkshape s1_3
+checkshape s1_4
+checkshape s1_5
+checkshape s1_6
+checkshape s1_7
+checkshape s1_8
+checkshape s1_9
+checkshape s1_10
+checkshape s1_12
+checkshape s1_13
+checkshape s1_14
+checkshape s1_15
+checkshape s1_16
+checkshape s1_17
+checkshape s1_18
+checkshape s1_19
+checkshape s1_20
+checkshape s1_21
+checkshape s1_22
+checkshape s1_23
+checkshape s1_24
+checkshape s1_25
+checkshape s1_26
+
+renamevar s1 result
+
+set check_square 1
+
+set square 49245
+
+set 3dviewer 1
diff --git a/tests/bugs/iges/bug22715_2 b/tests/bugs/iges/bug22715_2
new file mode 100755 (executable)
index 0000000..eaf7a48
--- /dev/null
@@ -0,0 +1,46 @@
+puts "============"
+puts "OCC22715"
+puts "============"
+puts ""
+#######################################################################
+# Incorrect faces of the filleted cube after import from iges file
+#######################################################################
+
+igesbrep [locate_data_file bug22715_cube.igs] s2 *
+puts [whatis s2]
+explode s2 F
+explode s2
+
+checkshape s2_1
+checkshape s2_2
+checkshape s2_3
+checkshape s2_4
+checkshape s2_5
+checkshape s2_6
+checkshape s2_7
+checkshape s2_8
+checkshape s2_9
+checkshape s2_10
+checkshape s2_12
+checkshape s2_13
+checkshape s2_14
+checkshape s2_15
+checkshape s2_16
+checkshape s2_17
+checkshape s2_18
+checkshape s2_19
+checkshape s2_20
+checkshape s2_21
+checkshape s2_22
+checkshape s2_23
+checkshape s2_24
+checkshape s2_25
+checkshape s2_26
+
+renamevar s2 result
+
+set check_square 1
+
+set square 49245
+
+set 3dviewer 1