1 // Created on: 1993-07-05
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <StepToGeom_MakeSurfaceOfRevolution.ixx>
18 #include <StepGeom_SurfaceOfRevolution.hxx>
19 #include <Geom_SurfaceOfRevolution.hxx>
20 #include <Geom_Axis1Placement.hxx>
21 #include <StepToGeom_MakeAxis1Placement.hxx>
22 #include <Geom_Curve.hxx>
23 #include <Geom_Circle.hxx>
24 #include <Geom_Ellipse.hxx>
25 #include <Geom_TrimmedCurve.hxx>
26 #include <StepToGeom_MakeCurve.hxx>
31 #include <Geom_Conic.hxx>
33 //=============================================================================
34 // Creation d' une SurfaceOfRevolution de Geom a partir d' une
35 // SurfaceOfRevolution de Step
36 //=============================================================================
38 Standard_Boolean StepToGeom_MakeSurfaceOfRevolution::Convert (const Handle(StepGeom_SurfaceOfRevolution)& SS, Handle(Geom_SurfaceOfRevolution)& CS)
41 if (StepToGeom_MakeCurve::Convert(SS->SweptCurve(),C))
43 Handle(Geom_Axis1Placement) A1;
44 if (StepToGeom_MakeAxis1Placement::Convert(SS->AxisPosition(),A1))
46 const gp_Ax1 A( A1->Ax1() );
47 //skl for OCC952 (one bad case revolution of circle)
48 if ( C->IsKind(STANDARD_TYPE(Geom_Circle)) || C->IsKind(STANDARD_TYPE(Geom_Ellipse)) )
50 const Handle(Geom_Conic) conic = Handle(Geom_Conic)::DownCast(C);
51 const gp_Pnt pc = conic->Location();
53 if (rl.Distance(pc) < Precision::Confusion()) { //pc lies on A2
54 const gp_Dir dirline = A.Direction();
55 const gp_Dir norm = conic->Axis().Direction();
56 const gp_Dir xAxis = conic->XAxis().Direction();
57 //checking A2 lies on plane of circle
58 if( dirline.IsNormal(norm,Precision::Angular()) && (dirline.IsParallel(xAxis,Precision::Angular()) || C->IsKind(STANDARD_TYPE(Geom_Circle)))) {
59 //change parametrization for trimming
60 gp_Ax2 axnew(pc,norm,dirline.Reversed());
61 conic->SetPosition(axnew);
62 C = new Geom_TrimmedCurve(conic, 0., M_PI);
66 CS = new Geom_SurfaceOfRevolution(C, A);
70 return Standard_False;