summaryrefslogtreecommitdiff
path: root/src/GeomToStep/GeomToStep_MakeSurface.cxx
blob: de3f8a4592d25e9b92eae4d322b0329f3051e6e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// File:	GeomToStep_MakeSurface.cxx
// Created:	Tue Jun 22 12:22:04 1993
// Author:	Martine LANGLOIS
//		<mla@mastox>

#include <GeomToStep_MakeSurface.ixx>
#include <StdFail_NotDone.hxx>
#include <StepGeom_Surface.hxx>
#include <GeomToStep_MakeSurface.hxx>
#include <Geom_BoundedSurface.hxx>
#include <GeomToStep_MakeBoundedSurface.hxx>
#include <Geom_ElementarySurface.hxx>
#include <GeomToStep_MakeElementarySurface.hxx>
#include <Geom_SweptSurface.hxx>
#include <GeomToStep_MakeSweptSurface.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Geom_OffsetSurface.hxx>
#include <StepGeom_OffsetSurface.hxx>
#include <StepData_Logical.hxx>
#include <UnitsMethods.hxx>

//=============================================================================
// Creation d' une Surface de prostep a partir d' une Surface de Geom
//=============================================================================

GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S)
{
  done = Standard_True;
  if (S->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
    Handle(Geom_BoundedSurface) S1 = 
      Handle(Geom_BoundedSurface)::DownCast(S);
    GeomToStep_MakeBoundedSurface MkBoundedS(S1);
    theSurface = MkBoundedS.Value();
  }
  else if (S->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
    Handle(Geom_ElementarySurface) S1 = 
      Handle(Geom_ElementarySurface)::DownCast(S);
    GeomToStep_MakeElementarySurface MkElementaryS(S1);
    theSurface = MkElementaryS.Value();
  }
  else if (S->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
    Handle(Geom_SweptSurface) S1 = 
      Handle(Geom_SweptSurface)::DownCast(S);
    GeomToStep_MakeSweptSurface MkSwept(S1);
    theSurface = MkSwept.Value();
  }
  else if (S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
    Handle(Geom_OffsetSurface) S1 =
      Handle(Geom_OffsetSurface)::DownCast(S);
    GeomToStep_MakeSurface MkBasis(S1->BasisSurface());
    done = MkBasis.IsDone();
    if (!done) return;
    Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface;
    Surf->Init (new TCollection_HAsciiString(""),
		     MkBasis.Value(),S1->Offset()/UnitsMethods::LengthFactor(),StepData_LFalse);
    theSurface = Surf;
  }
  else {
    done = Standard_False;
#ifdef DEB
    cout << " unknown type " << S->DynamicType()->Name() << endl;
#endif
  }
}


//=============================================================================
// renvoi des valeurs
//=============================================================================

const Handle(StepGeom_Surface) &
      GeomToStep_MakeSurface::Value() const
{
  StdFail_NotDone_Raise_if(!done == Standard_True,"");
  return theSurface;
}