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 <RWStepFEA_RWVolume3dElementRepresentation.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepElement_ElementMaterial.hxx>
24 #include <StepElement_Volume3dElementDescriptor.hxx>
25 #include <StepFEA_FeaModel3d.hxx>
26 #include <StepFEA_HArray1OfNodeRepresentation.hxx>
27 #include <StepFEA_NodeRepresentation.hxx>
28 #include <StepFEA_Volume3dElementRepresentation.hxx>
29 #include <StepRepr_HArray1OfRepresentationItem.hxx>
30 #include <StepRepr_RepresentationContext.hxx>
31 #include <StepRepr_RepresentationItem.hxx>
33 //=======================================================================
34 //function : RWStepFEA_RWVolume3dElementRepresentation
36 //=======================================================================
37 RWStepFEA_RWVolume3dElementRepresentation::RWStepFEA_RWVolume3dElementRepresentation ()
41 //=======================================================================
44 //=======================================================================
46 void RWStepFEA_RWVolume3dElementRepresentation::ReadStep (const Handle(StepData_StepReaderData)& data,
47 const Standard_Integer num,
48 Handle(Interface_Check)& ach,
49 const Handle(StepFEA_Volume3dElementRepresentation) &ent) const
51 // Check number of parameters
52 if ( ! data->CheckNbParams(num,7,ach,"volume3d_element_representation") ) return;
54 // Inherited fields of Representation
56 Handle(TCollection_HAsciiString) aRepresentation_Name;
57 data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
59 Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
60 Standard_Integer sub2 = 0;
61 if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
62 Standard_Integer nb0 = data->NbParams(sub2);
63 aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
64 Standard_Integer num2 = sub2;
65 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
66 Handle(StepRepr_RepresentationItem) anIt0;
67 data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
68 aRepresentation_Items->SetValue(i0, anIt0);
72 Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
73 data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
75 // Inherited fields of ElementRepresentation
77 Handle(StepFEA_HArray1OfNodeRepresentation) aElementRepresentation_NodeList;
78 Standard_Integer sub4 = 0;
79 if ( data->ReadSubList (num, 4, "element_representation.node_list", ach, sub4) ) {
80 Standard_Integer nb0 = data->NbParams(sub4);
81 aElementRepresentation_NodeList = new StepFEA_HArray1OfNodeRepresentation (1, nb0);
82 Standard_Integer num2 = sub4;
83 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
84 Handle(StepFEA_NodeRepresentation) anIt0;
85 data->ReadEntity (num2, i0, "node_representation", ach, STANDARD_TYPE(StepFEA_NodeRepresentation), anIt0);
86 aElementRepresentation_NodeList->SetValue(i0, anIt0);
90 // Own fields of Volume3dElementRepresentation
92 Handle(StepFEA_FeaModel3d) aModelRef;
93 data->ReadEntity (num, 5, "model_ref", ach, STANDARD_TYPE(StepFEA_FeaModel3d), aModelRef);
95 Handle(StepElement_Volume3dElementDescriptor) aElementDescriptor;
96 data->ReadEntity (num, 6, "element_descriptor", ach, STANDARD_TYPE(StepElement_Volume3dElementDescriptor), aElementDescriptor);
98 Handle(StepElement_ElementMaterial) aMaterial;
99 data->ReadEntity (num, 7, "material", ach, STANDARD_TYPE(StepElement_ElementMaterial), aMaterial);
102 ent->Init(aRepresentation_Name,
103 aRepresentation_Items,
104 aRepresentation_ContextOfItems,
105 aElementRepresentation_NodeList,
111 //=======================================================================
112 //function : WriteStep
114 //=======================================================================
116 void RWStepFEA_RWVolume3dElementRepresentation::WriteStep (StepData_StepWriter& SW,
117 const Handle(StepFEA_Volume3dElementRepresentation) &ent) const
120 // Inherited fields of Representation
122 SW.Send (ent->StepRepr_Representation::Name());
125 for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
126 Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
131 SW.Send (ent->StepRepr_Representation::ContextOfItems());
133 // Inherited fields of ElementRepresentation
136 for (Standard_Integer i3=1; i3 <= ent->StepFEA_ElementRepresentation::NodeList()->Length(); i3++ ) {
137 Handle(StepFEA_NodeRepresentation) Var0 = ent->StepFEA_ElementRepresentation::NodeList()->Value(i3);
142 // Own fields of Volume3dElementRepresentation
144 SW.Send (ent->ModelRef());
146 SW.Send (ent->ElementDescriptor());
148 SW.Send (ent->Material());
151 //=======================================================================
154 //=======================================================================
156 void RWStepFEA_RWVolume3dElementRepresentation::Share (const Handle(StepFEA_Volume3dElementRepresentation) &ent,
157 Interface_EntityIterator& iter) const
160 // Inherited fields of Representation
162 for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
163 Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
167 iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
169 // Inherited fields of ElementRepresentation
171 for (Standard_Integer i3=1; i3 <= ent->StepFEA_ElementRepresentation::NodeList()->Length(); i3++ ) {
172 Handle(StepFEA_NodeRepresentation) Var0 = ent->StepFEA_ElementRepresentation::NodeList()->Value(i3);
176 // Own fields of Volume3dElementRepresentation
178 iter.AddItem (ent->ModelRef());
180 iter.AddItem (ent->ElementDescriptor());
182 iter.AddItem (ent->Material());