summaryrefslogtreecommitdiff
path: root/src/RWStepFEA/RWStepFEA_RWFeaAxis2Placement3d.cxx
blob: 0000429016a5caa8e9036d402d1e9230adfcfe80 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// File:	RWStepFEA_RWFeaAxis2Placement3d.cxx
// Created:	Thu Dec 12 17:51:05 2002 
// Author:	data exchange team
// Generator:	ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
// Copyright:	Open CASCADE 2002

#include <RWStepFEA_RWFeaAxis2Placement3d.ixx>

//=======================================================================
//function : RWStepFEA_RWFeaAxis2Placement3d
//purpose  : 
//=======================================================================

RWStepFEA_RWFeaAxis2Placement3d::RWStepFEA_RWFeaAxis2Placement3d ()
{
}

//=======================================================================
//function : ReadStep
//purpose  : 
//=======================================================================

void RWStepFEA_RWFeaAxis2Placement3d::ReadStep (const Handle(StepData_StepReaderData)& data,
                                                const Standard_Integer num,
                                                Handle(Interface_Check)& ach,
                                                const Handle(StepFEA_FeaAxis2Placement3d) &ent) const
{
  // Check number of parameters
  if ( ! data->CheckNbParams(num,6,ach,"fea_axis2_placement3d") ) return;

  // Inherited fields of RepresentationItem

  Handle(TCollection_HAsciiString) aRepresentationItem_Name;
  data->ReadString (num, 1, "representation_item.name", ach, aRepresentationItem_Name);

  // Inherited fields of Placement

  Handle(StepGeom_CartesianPoint) aPlacement_Location;
  data->ReadEntity (num, 2, "placement.location", ach, STANDARD_TYPE(StepGeom_CartesianPoint), aPlacement_Location);

  // Inherited fields of Axis2Placement3d

  Handle(StepGeom_Direction) aAxis2Placement3d_Axis;
  Standard_Boolean hasAxis2Placement3d_Axis = Standard_True;
  if ( data->IsParamDefined (num,3) ) {
    data->ReadEntity (num, 3, "axis2_placement3d.axis", ach, STANDARD_TYPE(StepGeom_Direction), aAxis2Placement3d_Axis);
  }
  else {
    hasAxis2Placement3d_Axis = Standard_False;
  }

  Handle(StepGeom_Direction) aAxis2Placement3d_RefDirection;
  Standard_Boolean hasAxis2Placement3d_RefDirection = Standard_True;
  if ( data->IsParamDefined (num,4) ) {
    data->ReadEntity (num, 4, "axis2_placement3d.ref_direction", ach, STANDARD_TYPE(StepGeom_Direction), aAxis2Placement3d_RefDirection);
  }
  else {
    hasAxis2Placement3d_RefDirection = Standard_False;
  }

  // Own fields of FeaAxis2Placement3d

  StepFEA_CoordinateSystemType aSystemType = StepFEA_Cartesian;
  if (data->ParamType (num, 5) == Interface_ParamEnum) {
    Standard_CString text = data->ParamCValue(num, 5);
    if      (strcmp(text, ".CARTESIAN.")) aSystemType = StepFEA_Cartesian;
    else if (strcmp(text, ".CYLINDRICAL.")) aSystemType = StepFEA_Cylindrical;
    else if (strcmp(text, ".SPHERICAL.")) aSystemType = StepFEA_Spherical;
    else ach->AddFail("Parameter #5 (system_type) has not allowed value");
  }
  else ach->AddFail("Parameter #5 (system_type) is not enumeration");

  Handle(TCollection_HAsciiString) aDescription;
  data->ReadString (num, 6, "description", ach, aDescription);

  // Initialize entity
  ent->Init(aRepresentationItem_Name,
            aPlacement_Location,
            hasAxis2Placement3d_Axis,
            aAxis2Placement3d_Axis,
            hasAxis2Placement3d_RefDirection,
            aAxis2Placement3d_RefDirection,
            aSystemType,
            aDescription);
}

//=======================================================================
//function : WriteStep
//purpose  : 
//=======================================================================

void RWStepFEA_RWFeaAxis2Placement3d::WriteStep (StepData_StepWriter& SW,
                                                 const Handle(StepFEA_FeaAxis2Placement3d) &ent) const
{

  // Inherited fields of RepresentationItem

  SW.Send (ent->StepRepr_RepresentationItem::Name());

  // Inherited fields of Placement

  SW.Send (ent->StepGeom_Placement::Location());

  // Inherited fields of Axis2Placement3d

  if ( ent->StepGeom_Axis2Placement3d::HasAxis() ) {
    SW.Send (ent->StepGeom_Axis2Placement3d::Axis());
  }
  else SW.SendUndef();

  if ( ent->StepGeom_Axis2Placement3d::HasRefDirection() ) {
    SW.Send (ent->StepGeom_Axis2Placement3d::RefDirection());
  }
  else SW.SendUndef();

  // Own fields of FeaAxis2Placement3d

  switch (ent->SystemType()) {
    case StepFEA_Cartesian: SW.SendEnum (".CARTESIAN."); break;
    case StepFEA_Cylindrical: SW.SendEnum (".CYLINDRICAL."); break;
    case StepFEA_Spherical: SW.SendEnum (".SPHERICAL."); break;
  }

  SW.Send (ent->Description());
}

//=======================================================================
//function : Share
//purpose  : 
//=======================================================================

void RWStepFEA_RWFeaAxis2Placement3d::Share (const Handle(StepFEA_FeaAxis2Placement3d) &ent,
                                             Interface_EntityIterator& iter) const
{

  // Inherited fields of RepresentationItem

  // Inherited fields of Placement

  iter.AddItem (ent->StepGeom_Placement::Location());

  // Inherited fields of Axis2Placement3d

  if ( ent->StepGeom_Axis2Placement3d::HasAxis() ) {
    iter.AddItem (ent->StepGeom_Axis2Placement3d::Axis());
  }

  if ( ent->StepGeom_Axis2Placement3d::HasRefDirection() ) {
    iter.AddItem (ent->StepGeom_Axis2Placement3d::RefDirection());
  }

  // Own fields of FeaAxis2Placement3d
}