0030380: Exception while reading Step-file
[occt.git] / src / RWStepFEA / RWStepFEA_RWCurve3dElementRepresentation.cxx
CommitLineData
b311480e 1// Created on: 2002-12-12
2// Created by: data exchange team
973c2be1 3// Copyright (c) 2002-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16// Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
7fd59977 17
42cf5bc1 18#include <Interface_Check.hxx>
19#include <Interface_EntityIterator.hxx>
20#include <RWStepFEA_RWCurve3dElementRepresentation.hxx>
21#include <StepData_StepReaderData.hxx>
22#include <StepData_StepWriter.hxx>
23#include <StepElement_Curve3dElementDescriptor.hxx>
24#include <StepElement_ElementMaterial.hxx>
25#include <StepFEA_Curve3dElementProperty.hxx>
26#include <StepFEA_Curve3dElementRepresentation.hxx>
27#include <StepFEA_FeaModel3d.hxx>
7fd59977 28#include <StepFEA_HArray1OfNodeRepresentation.hxx>
29#include <StepFEA_NodeRepresentation.hxx>
42cf5bc1 30#include <StepRepr_HArray1OfRepresentationItem.hxx>
ec357c5c 31#include <StepRepr_RepresentationContext.hxx>
42cf5bc1 32#include <StepRepr_RepresentationItem.hxx>
7fd59977 33
34//=======================================================================
35//function : RWStepFEA_RWCurve3dElementRepresentation
36//purpose :
37//=======================================================================
7fd59977 38RWStepFEA_RWCurve3dElementRepresentation::RWStepFEA_RWCurve3dElementRepresentation ()
39{
40}
41
42//=======================================================================
43//function : ReadStep
44//purpose :
45//=======================================================================
46
47void RWStepFEA_RWCurve3dElementRepresentation::ReadStep (const Handle(StepData_StepReaderData)& data,
48 const Standard_Integer num,
49 Handle(Interface_Check)& ach,
50 const Handle(StepFEA_Curve3dElementRepresentation) &ent) const
51{
52 // Check number of parameters
53 if ( ! data->CheckNbParams(num,8,ach,"curve3d_element_representation") ) return;
54
55 // Inherited fields of Representation
56
57 Handle(TCollection_HAsciiString) aRepresentation_Name;
58 data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
59
60 Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
61 Standard_Integer sub2 = 0;
62 if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
63 Standard_Integer nb0 = data->NbParams(sub2);
64 aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
65 Standard_Integer num2 = sub2;
66 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
67 Handle(StepRepr_RepresentationItem) anIt0;
68 data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
69 aRepresentation_Items->SetValue(i0, anIt0);
70 }
71 }
72
73 Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
74 data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
75
76 // Inherited fields of ElementRepresentation
77
78 Handle(StepFEA_HArray1OfNodeRepresentation) aElementRepresentation_NodeList;
79 Standard_Integer sub4 = 0;
80 if ( data->ReadSubList (num, 4, "element_representation.node_list", ach, sub4) ) {
81 Standard_Integer nb0 = data->NbParams(sub4);
82 aElementRepresentation_NodeList = new StepFEA_HArray1OfNodeRepresentation (1, nb0);
83 Standard_Integer num2 = sub4;
84 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
85 Handle(StepFEA_NodeRepresentation) anIt0;
86 data->ReadEntity (num2, i0, "node_representation", ach, STANDARD_TYPE(StepFEA_NodeRepresentation), anIt0);
87 aElementRepresentation_NodeList->SetValue(i0, anIt0);
88 }
89 }
90
91 // Own fields of Curve3dElementRepresentation
92
93 Handle(StepFEA_FeaModel3d) aModelRef;
94 data->ReadEntity (num, 5, "model_ref", ach, STANDARD_TYPE(StepFEA_FeaModel3d), aModelRef);
95
96 Handle(StepElement_Curve3dElementDescriptor) aElementDescriptor;
97 data->ReadEntity (num, 6, "element_descriptor", ach, STANDARD_TYPE(StepElement_Curve3dElementDescriptor), aElementDescriptor);
98
99 Handle(StepFEA_Curve3dElementProperty) aProperty;
100 data->ReadEntity (num, 7, "property", ach, STANDARD_TYPE(StepFEA_Curve3dElementProperty), aProperty);
101
102 Handle(StepElement_ElementMaterial) aMaterial;
103 data->ReadEntity (num, 8, "material", ach, STANDARD_TYPE(StepElement_ElementMaterial), aMaterial);
104
105 // Initialize entity
106 ent->Init(aRepresentation_Name,
107 aRepresentation_Items,
108 aRepresentation_ContextOfItems,
109 aElementRepresentation_NodeList,
110 aModelRef,
111 aElementDescriptor,
112 aProperty,
113 aMaterial);
114}
115
116//=======================================================================
117//function : WriteStep
118//purpose :
119//=======================================================================
120
121void RWStepFEA_RWCurve3dElementRepresentation::WriteStep (StepData_StepWriter& SW,
122 const Handle(StepFEA_Curve3dElementRepresentation) &ent) const
123{
124
125 // Inherited fields of Representation
126
127 SW.Send (ent->StepRepr_Representation::Name());
128
129 SW.OpenSub();
0df4bbd6 130 for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
7fd59977 131 Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
132 SW.Send (Var0);
133 }
134 SW.CloseSub();
135
136 SW.Send (ent->StepRepr_Representation::ContextOfItems());
137
138 // Inherited fields of ElementRepresentation
139
140 SW.OpenSub();
141 for (Standard_Integer i3=1; i3 <= ent->StepFEA_ElementRepresentation::NodeList()->Length(); i3++ ) {
142 Handle(StepFEA_NodeRepresentation) Var0 = ent->StepFEA_ElementRepresentation::NodeList()->Value(i3);
143 SW.Send (Var0);
144 }
145 SW.CloseSub();
146
147 // Own fields of Curve3dElementRepresentation
148
149 SW.Send (ent->ModelRef());
150
151 SW.Send (ent->ElementDescriptor());
152
153 SW.Send (ent->Property());
154
155 SW.Send (ent->Material());
156}
157
158//=======================================================================
159//function : Share
160//purpose :
161//=======================================================================
162
163void RWStepFEA_RWCurve3dElementRepresentation::Share (const Handle(StepFEA_Curve3dElementRepresentation) &ent,
164 Interface_EntityIterator& iter) const
165{
166
167 // Inherited fields of Representation
168
0df4bbd6 169 for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
7fd59977 170 Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
171 iter.AddItem (Var0);
172 }
173
174 iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
175
176 // Inherited fields of ElementRepresentation
177
178 for (Standard_Integer i3=1; i3 <= ent->StepFEA_ElementRepresentation::NodeList()->Length(); i3++ ) {
179 Handle(StepFEA_NodeRepresentation) Var0 = ent->StepFEA_ElementRepresentation::NodeList()->Value(i3);
180 iter.AddItem (Var0);
181 }
182
183 // Own fields of Curve3dElementRepresentation
184
185 iter.AddItem (ent->ModelRef());
186
187 iter.AddItem (ent->ElementDescriptor());
188
189 iter.AddItem (ent->Property());
190
191 iter.AddItem (ent->Material());
192}