1 // Created on: 2002-12-12
2 // Created by: data exchange team
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepElement_RWCurveElementSectionDerivedDefinitions.hxx>
21 #include <Standard_Real.hxx>
22 #include <StepData_StepReaderData.hxx>
23 #include <StepData_StepWriter.hxx>
24 #include <StepElement_CurveElementSectionDerivedDefinitions.hxx>
25 #include <StepElement_HArray1OfMeasureOrUnspecifiedValue.hxx>
26 #include <StepElement_MeasureOrUnspecifiedValue.hxx>
27 #include <TColStd_HArray1OfReal.hxx>
29 //=======================================================================
30 //function : RWStepElement_RWCurveElementSectionDerivedDefinitions
32 //=======================================================================
33 RWStepElement_RWCurveElementSectionDerivedDefinitions::RWStepElement_RWCurveElementSectionDerivedDefinitions ()
37 //=======================================================================
40 //=======================================================================
42 void RWStepElement_RWCurveElementSectionDerivedDefinitions::ReadStep (const Handle(StepData_StepReaderData)& data,
43 const Standard_Integer num,
44 Handle(Interface_Check)& ach,
45 const Handle(StepElement_CurveElementSectionDerivedDefinitions) &ent) const
47 // Check number of parameters
48 if ( ! data->CheckNbParams(num,12,ach,"curve_element_section_derived_definitions") ) return;
50 // Inherited fields of CurveElementSectionDefinition
52 Handle(TCollection_HAsciiString) aCurveElementSectionDefinition_Description;
53 data->ReadString (num, 1, "curve_element_section_definition.description", ach, aCurveElementSectionDefinition_Description);
55 Standard_Real aCurveElementSectionDefinition_SectionAngle;
56 data->ReadReal (num, 2, "curve_element_section_definition.section_angle", ach, aCurveElementSectionDefinition_SectionAngle);
58 // Own fields of CurveElementSectionDerivedDefinitions
60 Standard_Real aCrossSectionalArea;
61 data->ReadReal (num, 3, "cross_sectional_area", ach, aCrossSectionalArea);
63 Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aShearArea;
64 Standard_Integer sub4 = 0;
65 if ( data->ReadSubList (num, 4, "shear_area", ach, sub4) ) {
66 Standard_Integer nb0 = data->NbParams(sub4);
67 aShearArea = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
68 Standard_Integer num2 = sub4;
69 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
70 StepElement_MeasureOrUnspecifiedValue anIt0;
71 data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
72 aShearArea->SetValue(i0, anIt0);
76 Handle(TColStd_HArray1OfReal) aSecondMomentOfArea;
77 Standard_Integer sub5 = 0;
78 if ( data->ReadSubList (num, 5, "second_moment_of_area", ach, sub5) ) {
79 Standard_Integer nb0 = data->NbParams(sub5);
80 aSecondMomentOfArea = new TColStd_HArray1OfReal (1, nb0);
81 Standard_Integer num2 = sub5;
82 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
84 data->ReadReal (num2, i0, "real", ach, anIt0);
85 aSecondMomentOfArea->SetValue(i0, anIt0);
89 Standard_Real aTorsionalConstant;
90 data->ReadReal (num, 6, "torsional_constant", ach, aTorsionalConstant);
92 StepElement_MeasureOrUnspecifiedValue aWarpingConstant;
93 data->ReadEntity (num, 7, "warping_constant", ach, aWarpingConstant);
95 Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aLocationOfCentroid;
96 Standard_Integer sub8 = 0;
97 if ( data->ReadSubList (num, 8, "location_of_centroid", ach, sub8) ) {
98 Standard_Integer nb0 = data->NbParams(sub8);
99 aLocationOfCentroid = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
100 Standard_Integer num2 = sub8;
101 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
102 StepElement_MeasureOrUnspecifiedValue anIt0;
103 data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
104 aLocationOfCentroid->SetValue(i0, anIt0);
108 Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aLocationOfShearCentre;
109 Standard_Integer sub9 = 0;
110 if ( data->ReadSubList (num, 9, "location_of_shear_centre", ach, sub9) ) {
111 Standard_Integer nb0 = data->NbParams(sub9);
112 aLocationOfShearCentre = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
113 Standard_Integer num2 = sub9;
114 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
115 StepElement_MeasureOrUnspecifiedValue anIt0;
116 data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
117 aLocationOfShearCentre->SetValue(i0, anIt0);
121 Handle(StepElement_HArray1OfMeasureOrUnspecifiedValue) aLocationOfNonStructuralMass;
122 Standard_Integer sub10 = 0;
123 if ( data->ReadSubList (num, 10, "location_of_non_structural_mass", ach, sub10) ) {
124 Standard_Integer nb0 = data->NbParams(sub10);
125 aLocationOfNonStructuralMass = new StepElement_HArray1OfMeasureOrUnspecifiedValue (1, nb0);
126 Standard_Integer num2 = sub10;
127 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
128 StepElement_MeasureOrUnspecifiedValue anIt0;
129 data->ReadEntity (num2, i0, "measure_or_unspecified_value", ach, anIt0);
130 aLocationOfNonStructuralMass->SetValue(i0, anIt0);
134 StepElement_MeasureOrUnspecifiedValue aNonStructuralMass;
135 data->ReadEntity (num, 11, "non_structural_mass", ach, aNonStructuralMass);
137 StepElement_MeasureOrUnspecifiedValue aPolarMoment;
138 data->ReadEntity (num, 12, "polar_moment", ach, aPolarMoment);
141 ent->Init(aCurveElementSectionDefinition_Description,
142 aCurveElementSectionDefinition_SectionAngle,
149 aLocationOfShearCentre,
150 aLocationOfNonStructuralMass,
155 //=======================================================================
156 //function : WriteStep
158 //=======================================================================
160 void RWStepElement_RWCurveElementSectionDerivedDefinitions::WriteStep (StepData_StepWriter& SW,
161 const Handle(StepElement_CurveElementSectionDerivedDefinitions) &ent) const
164 // Inherited fields of CurveElementSectionDefinition
166 SW.Send (ent->StepElement_CurveElementSectionDefinition::Description());
168 SW.Send (ent->StepElement_CurveElementSectionDefinition::SectionAngle());
170 // Own fields of CurveElementSectionDerivedDefinitions
172 SW.Send (ent->CrossSectionalArea());
175 for (Standard_Integer i3=1; i3 <= ent->ShearArea()->Length(); i3++ ) {
176 StepElement_MeasureOrUnspecifiedValue Var0 = ent->ShearArea()->Value(i3);
177 SW.Send (Var0.Value());
182 for (Standard_Integer i4=1; i4 <= ent->SecondMomentOfArea()->Length(); i4++ ) {
183 Standard_Real Var0 = ent->SecondMomentOfArea()->Value(i4);
188 SW.Send (ent->TorsionalConstant());
190 SW.Send (ent->WarpingConstant().Value());
193 for (Standard_Integer i7=1; i7 <= ent->LocationOfCentroid()->Length(); i7++ ) {
194 StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfCentroid()->Value(i7);
195 SW.Send (Var0.Value());
200 for (Standard_Integer i8=1; i8 <= ent->LocationOfShearCentre()->Length(); i8++ ) {
201 StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfShearCentre()->Value(i8);
202 SW.Send (Var0.Value());
207 for (Standard_Integer i9=1; i9 <= ent->LocationOfNonStructuralMass()->Length(); i9++ ) {
208 StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfNonStructuralMass()->Value(i9);
209 SW.Send (Var0.Value());
213 SW.Send (ent->NonStructuralMass().Value());
215 SW.Send (ent->PolarMoment().Value());
218 //=======================================================================
221 //=======================================================================
223 void RWStepElement_RWCurveElementSectionDerivedDefinitions::Share (const Handle(StepElement_CurveElementSectionDerivedDefinitions) &ent,
224 Interface_EntityIterator& iter) const
227 // Inherited fields of CurveElementSectionDefinition
229 // Own fields of CurveElementSectionDerivedDefinitions
231 for (Standard_Integer i1=1; i1 <= ent->ShearArea()->Length(); i1++ ) {
232 StepElement_MeasureOrUnspecifiedValue Var0 = ent->ShearArea()->Value(i1);
233 iter.AddItem (Var0.Value());
236 iter.AddItem (ent->WarpingConstant().Value());
238 for (Standard_Integer i3=1; i3 <= ent->LocationOfCentroid()->Length(); i3++ ) {
239 StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfCentroid()->Value(i3);
240 iter.AddItem (Var0.Value());
243 for (Standard_Integer i4=1; i4 <= ent->LocationOfShearCentre()->Length(); i4++ ) {
244 StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfShearCentre()->Value(i4);
245 iter.AddItem (Var0.Value());
248 for (Standard_Integer i5=1; i5 <= ent->LocationOfNonStructuralMass()->Length(); i5++ ) {
249 StepElement_MeasureOrUnspecifiedValue Var0 = ent->LocationOfNonStructuralMass()->Value(i5);
250 iter.AddItem (Var0.Value());
253 iter.AddItem (ent->NonStructuralMass().Value());
255 iter.AddItem (ent->PolarMoment().Value());