1 // Created on: 1993-06-22
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 <GeomToStep_MakeSurface.ixx>
18 #include <StdFail_NotDone.hxx>
19 #include <StepGeom_Surface.hxx>
20 #include <GeomToStep_MakeSurface.hxx>
21 #include <Geom_BoundedSurface.hxx>
22 #include <GeomToStep_MakeBoundedSurface.hxx>
23 #include <Geom_ElementarySurface.hxx>
24 #include <GeomToStep_MakeElementarySurface.hxx>
25 #include <Geom_SweptSurface.hxx>
26 #include <GeomToStep_MakeSweptSurface.hxx>
27 #include <TCollection_HAsciiString.hxx>
28 #include <Geom_OffsetSurface.hxx>
29 #include <StepGeom_OffsetSurface.hxx>
30 #include <StepData_Logical.hxx>
31 #include <UnitsMethods.hxx>
33 //=============================================================================
34 // Creation d' une Surface de prostep a partir d' une Surface de Geom
35 //=============================================================================
37 GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S)
40 if (S->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
41 Handle(Geom_BoundedSurface) S1 =
42 Handle(Geom_BoundedSurface)::DownCast(S);
43 GeomToStep_MakeBoundedSurface MkBoundedS(S1);
44 theSurface = MkBoundedS.Value();
46 else if (S->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
47 Handle(Geom_ElementarySurface) S1 =
48 Handle(Geom_ElementarySurface)::DownCast(S);
49 GeomToStep_MakeElementarySurface MkElementaryS(S1);
50 theSurface = MkElementaryS.Value();
52 else if (S->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
53 Handle(Geom_SweptSurface) S1 =
54 Handle(Geom_SweptSurface)::DownCast(S);
55 GeomToStep_MakeSweptSurface MkSwept(S1);
56 theSurface = MkSwept.Value();
58 else if (S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
59 Handle(Geom_OffsetSurface) S1 =
60 Handle(Geom_OffsetSurface)::DownCast(S);
61 GeomToStep_MakeSurface MkBasis(S1->BasisSurface());
62 done = MkBasis.IsDone();
64 Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface;
65 Surf->Init (new TCollection_HAsciiString(""),
66 MkBasis.Value(),S1->Offset()/UnitsMethods::LengthFactor(),StepData_LFalse);
70 done = Standard_False;
72 cout << " unknown type " << S->DynamicType()->Name() << endl;
78 //=============================================================================
80 //=============================================================================
82 const Handle(StepGeom_Surface) &
83 GeomToStep_MakeSurface::Value() const
85 StdFail_NotDone_Raise_if(!done, "");