973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
973c2be1 |
5 | // This library is free software; you can redistribute it and / or modify it |
6 | // under the terms of the GNU Lesser General Public version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <StepAP209_Construct.ixx> |
15 | |
16 | #include <Interface_EntityIterator.hxx> |
17 | #include <Interface_HArray1OfHAsciiString.hxx> |
18 | #include <TCollection_HAsciiString.hxx> |
19 | #include <TColStd_HArray1OfAsciiString.hxx> |
20 | #include <TColStd_HArray1OfReal.hxx> |
21 | #include <OSD_Process.hxx> |
22 | #include <Quantity_Date.hxx> |
23 | |
24 | #include <HeaderSection_FileName.hxx> |
25 | #include <HeaderSection_FileSchema.hxx> |
26 | #include <HeaderSection_FileDescription.hxx> |
27 | |
28 | #include <StepBasic_ProductDefinitionFormation.hxx> |
29 | #include <StepBasic_ProductDefinitionFormationRelationship.hxx> |
30 | #include <StepBasic_HArray1OfProductContext.hxx> |
31 | #include <StepBasic_ProductDefinitionContext.hxx> |
32 | #include <StepBasic_HArray1OfNamedUnit.hxx> |
33 | #include <StepBasic_HArray1OfUncertaintyMeasureWithUnit.hxx> |
34 | #include <StepBasic_SiUnitAndTimeUnit.hxx> |
35 | #include <StepBasic_SiUnitAndMassUnit.hxx> |
36 | #include <StepBasic_SiUnitAndThermodynamicTemperatureUnit.hxx> |
37 | #include <StepBasic_DimensionalExponents.hxx> |
38 | #include <StepBasic_ApprovalStatus.hxx> |
39 | #include <StepBasic_Approval.hxx> |
40 | #include <StepBasic_SecurityClassificationLevel.hxx> |
41 | #include <StepBasic_SecurityClassification.hxx> |
42 | #include <StepBasic_CalendarDate.hxx> |
43 | #include <StepBasic_CoordinatedUniversalTimeOffset.hxx> |
44 | #include <StepBasic_LocalTime.hxx> |
45 | #include <StepBasic_DateAndTime.hxx> |
46 | #include <StepBasic_DateTimeRole.hxx> |
47 | #include <StepBasic_ApprovalDateTime.hxx> |
48 | #include <StepBasic_DateTimeSelect.hxx> |
49 | #include <StepBasic_Person.hxx> |
50 | #include <StepBasic_Organization.hxx> |
51 | #include <StepBasic_PersonAndOrganization.hxx> |
52 | #include <StepBasic_PersonAndOrganizationRole.hxx> |
53 | #include <StepBasic_ApprovalRole.hxx> |
54 | #include <StepBasic_ApprovalPersonOrganization.hxx> |
55 | #include <StepBasic_PersonOrganizationSelect.hxx> |
56 | #include <StepBasic_HArray1OfProduct.hxx> |
57 | #include <StepBasic_ProductRelatedProductCategory.hxx> |
58 | #include <StepBasic_ProductCategory.hxx> |
59 | #include <StepBasic_ProductCategoryRelationship.hxx> |
60 | #include <StepBasic_MechanicalContext.hxx> |
61 | #include <StepBasic_DesignContext.hxx> |
62 | #include <StepBasic_ApplicationProtocolDefinition.hxx> |
63 | |
64 | #include <StepRepr_PropertyDefinitionRepresentation.hxx> |
65 | #include <StepRepr_StructuralResponseProperty.hxx> |
66 | #include <StepRepr_StructuralResponsePropertyDefinitionRepresentation.hxx> |
67 | #include <StepRepr_RepresentationItem.hxx> |
68 | #include <StepRepr_HArray1OfRepresentationItem.hxx> |
69 | #include <StepRepr_ShapeRepresentationRelationship.hxx> |
70 | #include <StepRepr_GlobalUncertaintyAssignedContext.hxx> |
71 | #include <StepRepr_GlobalUnitAssignedContext.hxx> |
72 | |
73 | #include <StepFEA_Curve3dElementRepresentation.hxx> |
74 | #include <StepFEA_Surface3dElementRepresentation.hxx> |
75 | #include <StepFEA_Volume3dElementRepresentation.hxx> |
76 | #include <StepFEA_FeaModelDefinition.hxx> |
77 | #include <StepFEA_HArray1OfCurveElementInterval.hxx> |
78 | #include <StepFEA_CurveElementIntervalConstant.hxx> |
79 | #include <StepFEA_Curve3dElementProperty.hxx> |
80 | #include <StepFEA_ElementGeometricRelationship.hxx> |
81 | #include <StepFEA_FeaModel3d.hxx> |
82 | #include <StepFEA_FeaAxis2Placement3d.hxx> |
83 | #include <StepFEA_CoordinateSystemType.hxx> |
84 | |
85 | #include <StepShape_ShapeDefinitionRepresentation.hxx> |
86 | |
87 | #include <StepData_StepModel.hxx> |
88 | |
89 | #include <StepElement_AnalysisItemWithinRepresentation.hxx> |
90 | |
91 | #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx> |
92 | #include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx> |
93 | #include <StepGeom_CartesianPoint.hxx> |
94 | #include <StepGeom_Direction.hxx> |
95 | |
96 | #include <StepAP203_CcDesignApproval.hxx> |
97 | #include <StepAP203_CcDesignPersonAndOrganizationAssignment.hxx> |
98 | #include <StepAP203_CcDesignDateAndTimeAssignment.hxx> |
99 | #include <StepAP203_CcDesignSecurityClassification.hxx> |
100 | #include <StepAP203_HArray1OfApprovedItem.hxx> |
101 | #include <StepAP203_HArray1OfPersonOrganizationItem.hxx> |
102 | #include <StepAP203_HArray1OfDateTimeItem.hxx> |
103 | #include <StepAP203_HArray1OfClassifiedItem.hxx> |
104 | |
105 | #include <StepAP214_AppliedApprovalAssignment.hxx> |
106 | #include <StepAP214_AppliedPersonAndOrganizationAssignment.hxx> |
107 | #include <StepAP214_AppliedDateAndTimeAssignment.hxx> |
108 | #include <StepAP214_AppliedSecurityClassificationAssignment.hxx> |
109 | #include <StepAP214_HArray1OfApprovalItem.hxx> |
110 | #include <StepAP214_ApprovalItem.hxx> |
111 | #include <StepAP214_HArray1OfPersonAndOrganizationItem.hxx> |
112 | #include <StepAP214_PersonAndOrganizationItem.hxx> |
113 | #include <StepAP214_HArray1OfDateAndTimeItem.hxx> |
114 | #include <StepAP214_DateAndTimeItem.hxx> |
115 | #include <StepAP214_HArray1OfSecurityClassificationItem.hxx> |
116 | #include <StepAP214_SecurityClassificationItem.hxx> |
117 | #include <StepAP214_ApprovalItem.hxx> |
118 | |
119 | //#include <.hxx> |
120 | |
121 | |
122 | //======================================================================= |
123 | //function : StepAP209_Construct |
124 | //purpose : |
125 | //======================================================================= |
126 | |
127 | StepAP209_Construct::StepAP209_Construct () |
128 | { |
129 | } |
130 | |
131 | //======================================================================= |
132 | //function : StepAP209_Construct |
133 | //purpose : |
134 | //======================================================================= |
135 | |
136 | StepAP209_Construct::StepAP209_Construct (const Handle(XSControl_WorkSession) &WS) |
137 | : STEPConstruct_Tool ( WS ) |
138 | { |
139 | } |
140 | |
141 | //======================================================================= |
142 | //function : Init |
143 | //purpose : |
144 | //======================================================================= |
145 | |
146 | Standard_Boolean StepAP209_Construct::Init (const Handle(XSControl_WorkSession) &WS) |
147 | { |
148 | return SetWS ( WS ); |
149 | } |
150 | |
151 | |
152 | //======================================================================= |
153 | //function : IsDesing |
154 | //purpose : |
155 | //======================================================================= |
156 | |
157 | Standard_Boolean StepAP209_Construct::IsDesing (const Handle(StepBasic_ProductDefinitionFormation) &PDF) const |
158 | { |
159 | Interface_EntityIterator subs = Graph().Sharings(PDF); |
160 | for (subs.Start(); subs.More(); subs.Next()) { |
161 | Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR = |
162 | Handle(StepBasic_ProductDefinitionFormationRelationship)::DownCast(subs.Value()); |
163 | if(PDFR.IsNull()) continue; |
164 | if ( PDF == PDFR->RelatingProductDefinitionFormation() ) return Standard_True; |
165 | } |
166 | return Standard_False; |
167 | } |
168 | |
169 | |
170 | //======================================================================= |
171 | //function : IsAnalys |
172 | //purpose : |
173 | //======================================================================= |
174 | |
175 | Standard_Boolean StepAP209_Construct::IsAnalys (const Handle(StepBasic_ProductDefinitionFormation) &PDF) const |
176 | { |
177 | Interface_EntityIterator subs = Graph().Sharings(PDF); |
178 | for (subs.Start(); subs.More(); subs.Next()) { |
179 | Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR = |
180 | Handle(StepBasic_ProductDefinitionFormationRelationship)::DownCast(subs.Value()); |
181 | if(PDFR.IsNull()) continue; |
182 | if ( PDF == PDFR->RelatedProductDefinitionFormation() ) return Standard_True; |
183 | } |
184 | return Standard_False; |
185 | } |
186 | |
187 | |
188 | //======================================================================= |
189 | //function : GetElementMaterial |
190 | //purpose : |
191 | //======================================================================= |
192 | |
193 | Handle(StepElement_HSequenceOfElementMaterial) StepAP209_Construct::GetElementMaterial() const |
194 | { |
195 | Handle(StepElement_HSequenceOfElementMaterial) aSequence = |
196 | new StepElement_HSequenceOfElementMaterial; |
197 | Handle(Interface_InterfaceModel) model = Model(); |
198 | Standard_Integer nb = model->NbEntities(); |
199 | for(Standard_Integer i=1; i<=nb; i++) { |
200 | Handle(Standard_Transient) anEntity = model->Value(i); |
201 | if(anEntity->IsKind(STANDARD_TYPE(StepElement_ElementMaterial))) { |
202 | Handle(StepElement_ElementMaterial) anElement = |
203 | Handle(StepElement_ElementMaterial)::DownCast(anEntity); |
204 | aSequence->Append(anElement); |
205 | } |
206 | } |
207 | return aSequence; |
208 | } |
209 | |
210 | |
211 | //======================================================================= |
212 | //function : GetElemGeomRelat |
213 | //purpose : |
214 | //======================================================================= |
215 | |
216 | Handle(StepFEA_HSequenceOfElementGeometricRelationship) StepAP209_Construct::GetElemGeomRelat() const |
217 | { |
218 | Handle(StepFEA_HSequenceOfElementGeometricRelationship) aSequence = |
219 | new StepFEA_HSequenceOfElementGeometricRelationship; |
220 | Handle(Interface_InterfaceModel) model = Model(); |
221 | Standard_Integer nb = model->NbEntities(); |
222 | for(Standard_Integer i=1; i<=nb; i++) { |
223 | Handle(Standard_Transient) anEntity = model->Value(i); |
224 | if(anEntity->IsKind(STANDARD_TYPE(StepFEA_ElementGeometricRelationship))) { |
225 | Handle(StepFEA_ElementGeometricRelationship) EGR = |
226 | Handle(StepFEA_ElementGeometricRelationship)::DownCast(anEntity); |
227 | aSequence->Append(EGR); |
228 | } |
229 | } |
230 | return aSequence; |
231 | } |
232 | |
233 | |
234 | //======================================================================= |
235 | //function : GetShReprForElem |
236 | //purpose : |
237 | //======================================================================= |
238 | |
239 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::GetShReprForElem |
240 | (const Handle(StepFEA_ElementRepresentation) &ElemRepr) const |
241 | { |
242 | Handle(StepShape_ShapeRepresentation) SR; |
243 | if(ElemRepr.IsNull()) return SR; |
244 | Interface_EntityIterator subs = Graph().Sharings(ElemRepr); |
245 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
246 | Handle(StepFEA_ElementGeometricRelationship) EGR = |
247 | Handle(StepFEA_ElementGeometricRelationship)::DownCast(subs.Value()); |
248 | if(EGR.IsNull()) continue; |
249 | Handle(StepElement_AnalysisItemWithinRepresentation) AIWR = EGR->Item(); |
250 | if(AIWR.IsNull()) continue; |
251 | Handle(StepRepr_Representation) Repr = AIWR->Rep(); |
252 | if(Repr.IsNull()) continue; |
253 | SR = Handle(StepShape_ShapeRepresentation)::DownCast(Repr); |
254 | } |
255 | return SR; |
256 | } |
257 | |
258 | |
259 | |
260 | // methods for getting fea_model |
261 | |
262 | |
263 | //======================================================================= |
264 | //function : FeaModel |
265 | //purpose : |
266 | //======================================================================= |
267 | |
268 | Handle(StepFEA_FeaModel) StepAP209_Construct::FeaModel (const Handle(StepBasic_Product) &Prod) const |
269 | { |
270 | Handle(StepFEA_FeaModel) FM; |
271 | if(Prod.IsNull()) return FM; |
272 | Interface_EntityIterator subs = Graph().Sharings(Prod); |
273 | for (subs.Start(); subs.More() && FM.IsNull() ; subs.Next()) { |
274 | Handle(StepBasic_ProductDefinitionFormation) PDF = |
275 | Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value()); |
276 | if ( PDF.IsNull() ) continue; |
277 | FM = FeaModel(PDF); |
278 | } |
279 | return FM; |
280 | } |
281 | |
282 | |
283 | //======================================================================= |
284 | //function : FeaModel |
285 | //purpose : |
286 | //======================================================================= |
287 | |
288 | Handle(StepFEA_FeaModel) StepAP209_Construct::FeaModel (const Handle(StepBasic_ProductDefinition) &PD) const |
289 | { |
290 | //Handle(Interface_InterfaceModel) model = Model(); |
291 | //Standard_Integer nb = model->NbEntities(); |
292 | Handle(StepFEA_FeaModel) FM; |
293 | if(PD.IsNull()) return FM; |
294 | Interface_EntityIterator subs = Graph().Shareds(PD); |
295 | for (subs.Start(); subs.More() && FM.IsNull() ; subs.Next()) { |
296 | Handle(StepBasic_ProductDefinitionFormation) PDF = |
297 | Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value()); |
298 | if ( PDF.IsNull() ) continue; |
299 | FM = FeaModel(PDF); |
300 | } |
301 | return FM; |
302 | } |
303 | |
304 | |
305 | //======================================================================= |
306 | //function : FeaModel |
307 | //purpose : |
308 | //======================================================================= |
309 | |
310 | Handle(StepFEA_FeaModel) StepAP209_Construct::FeaModel (const Handle(StepBasic_ProductDefinitionFormation) &PDF) const |
311 | { |
312 | Handle(StepFEA_FeaModel) FM; |
313 | if(PDF.IsNull()) return FM; |
314 | Handle(StepBasic_ProductDefinitionFormation) PDF2; |
315 | Interface_EntityIterator subs = Graph().Sharings(PDF); |
316 | for (subs.Start(); subs.More(); subs.Next()) { |
317 | Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR = |
318 | Handle(StepBasic_ProductDefinitionFormationRelationship)::DownCast(subs.Value()); |
319 | if(PDFR.IsNull()) continue; |
320 | PDF2 = PDFR->RelatedProductDefinitionFormation(); |
321 | } |
322 | if(PDF2.IsNull() ) return FM; |
323 | subs = Graph().Sharings(PDF2); |
324 | for (subs.Start(); subs.More() && FM.IsNull() ; subs.Next()) { |
325 | Handle(StepBasic_ProductDefinition) PD = |
326 | Handle(StepBasic_ProductDefinition)::DownCast(subs.Value()); |
327 | if(PD.IsNull()) continue; |
328 | Interface_EntityIterator subs2 = Graph().Sharings(PD); |
329 | for (subs2.Start(); subs2.More() && FM.IsNull() ; subs2.Next()) { |
330 | Handle(StepRepr_ProductDefinitionShape) PDS = |
331 | Handle(StepRepr_ProductDefinitionShape)::DownCast(subs2.Value()); |
332 | if(PDS.IsNull()) continue; |
333 | FM = FeaModel(PDS); |
334 | } |
335 | } |
336 | return FM; |
337 | } |
338 | |
339 | |
340 | //======================================================================= |
341 | //function : FeaModel |
342 | //purpose : |
343 | //======================================================================= |
344 | |
345 | Handle(StepFEA_FeaModel) StepAP209_Construct::FeaModel (const Handle(StepRepr_ProductDefinitionShape)& PDS) const |
346 | { |
347 | Handle(StepFEA_FeaModel) FM; |
348 | Interface_EntityIterator subs = Graph().Sharings(PDS); |
349 | for (subs.Start(); subs.More() && FM.IsNull() ; subs.Next()) { |
350 | Handle(StepFEA_FeaModelDefinition) FMD = Handle(StepFEA_FeaModelDefinition)::DownCast(subs.Value()); |
351 | if(FMD.IsNull()) continue; |
352 | Interface_EntityIterator subs2 = Graph().Sharings(FMD); |
353 | for (subs2.Start(); subs2.More() && FM.IsNull() ; subs2.Next()) { |
354 | //ENTITY structural_response_property - SUBTYPE OF (property_definition); |
355 | Handle(StepRepr_StructuralResponseProperty) SRP = |
356 | Handle(StepRepr_StructuralResponseProperty)::DownCast(subs2.Value()); |
357 | if(SRP.IsNull()) continue; |
358 | Interface_EntityIterator subs3 = Graph().Sharings(SRP); |
359 | for (subs3.Start(); subs3.More() && FM.IsNull() ; subs3.Next()) { |
360 | //ENTITY structural_response_property_definition_representation - |
361 | //SUBTYPE OF (property_definition_representation); |
362 | Handle(StepRepr_StructuralResponsePropertyDefinitionRepresentation) SRPDR = |
363 | Handle(StepRepr_StructuralResponsePropertyDefinitionRepresentation)::DownCast(subs3.Value()); |
364 | if(SRPDR.IsNull()) continue; |
365 | Handle(StepRepr_Representation) Repr = SRPDR->UsedRepresentation(); |
366 | if ( Repr.IsNull() ) continue; |
367 | if (Repr->IsKind(STANDARD_TYPE(StepFEA_FeaModel))) |
368 | FM = Handle(StepFEA_FeaModel)::DownCast(Repr); |
369 | } |
370 | } |
371 | } |
372 | return FM; |
373 | } |
374 | |
375 | |
376 | //======================================================================= |
377 | //function : GetFeaAxis2Placement3D |
378 | //purpose : |
379 | //======================================================================= |
380 | |
381 | Handle(StepFEA_FeaAxis2Placement3d) StepAP209_Construct::GetFeaAxis2Placement3d |
382 | (const Handle(StepFEA_FeaModel)& theFeaModel) const |
383 | { |
384 | Handle(StepFEA_FeaAxis2Placement3d) FA2P3D = new StepFEA_FeaAxis2Placement3d; |
385 | if(theFeaModel.IsNull()) return FA2P3D; |
386 | Interface_EntityIterator subs = Graph().Shareds(theFeaModel); |
387 | for (subs.Start(); subs.More(); subs.Next()) { |
388 | FA2P3D = Handle(StepFEA_FeaAxis2Placement3d)::DownCast(subs.Value()); |
389 | if(FA2P3D.IsNull()) continue; |
390 | return FA2P3D; |
391 | } |
392 | return FA2P3D; |
393 | } |
394 | |
395 | |
396 | // methods for getting idealized_analysis_shape |
397 | |
398 | |
399 | //======================================================================= |
400 | //function : IdealShape |
401 | //purpose : |
402 | //======================================================================= |
403 | |
404 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::IdealShape (const Handle(StepBasic_Product) &Prod) const |
405 | { |
406 | Handle(StepShape_ShapeRepresentation) SR; |
407 | if(Prod.IsNull()) return SR; |
408 | Interface_EntityIterator subs = Graph().Sharings(Prod); |
409 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
410 | Handle(StepBasic_ProductDefinitionFormation) PDF = |
411 | Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value()); |
412 | if ( PDF.IsNull() ) continue; |
413 | SR = IdealShape(PDF); |
414 | } |
415 | return SR; |
416 | } |
417 | |
418 | |
419 | //======================================================================= |
420 | //function : IdealShape |
421 | //purpose : |
422 | //======================================================================= |
423 | |
424 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::IdealShape (const Handle(StepBasic_ProductDefinition) &PD) const |
425 | { |
426 | Handle(StepShape_ShapeRepresentation) SR; |
427 | if(PD.IsNull()) return SR; |
428 | Interface_EntityIterator subs = Graph().Shareds(PD); |
429 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
430 | Handle(StepBasic_ProductDefinitionFormation) PDF = |
431 | Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value()); |
432 | if ( PDF.IsNull() ) continue; |
433 | SR = IdealShape(PDF); |
434 | } |
435 | return SR; |
436 | } |
437 | |
438 | |
439 | //======================================================================= |
440 | //function : IdealShape |
441 | //purpose : |
442 | //======================================================================= |
443 | |
444 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::IdealShape (const Handle(StepBasic_ProductDefinitionFormation) &PDF) const |
445 | { |
446 | Handle(StepShape_ShapeRepresentation) SR; |
447 | if(PDF.IsNull()) return SR; |
448 | Handle(StepBasic_ProductDefinitionFormation) PDF2; |
449 | Interface_EntityIterator subs = Graph().Sharings(PDF); |
450 | for (subs.Start(); subs.More(); subs.Next()) { |
451 | Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR = |
452 | Handle(StepBasic_ProductDefinitionFormationRelationship)::DownCast(subs.Value()); |
453 | if(PDFR.IsNull()) continue; |
454 | PDF2 = PDFR->RelatedProductDefinitionFormation(); |
455 | } |
456 | if(PDF2.IsNull() ) return SR; |
457 | subs = Graph().Sharings(PDF2); |
458 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
459 | Handle(StepBasic_ProductDefinition) PD = |
460 | Handle(StepBasic_ProductDefinition)::DownCast(subs.Value()); |
461 | if(PD.IsNull()) continue; |
462 | Interface_EntityIterator subs2 = Graph().Sharings(PD); |
463 | for (subs2.Start(); subs2.More() && SR.IsNull() ; subs2.Next()) { |
464 | Handle(StepRepr_ProductDefinitionShape) PDS = |
465 | Handle(StepRepr_ProductDefinitionShape)::DownCast(subs2.Value()); |
466 | if(PDS.IsNull()) continue; |
467 | SR = IdealShape(PDS); |
468 | } |
469 | } |
470 | return SR; |
471 | } |
472 | |
473 | |
474 | //======================================================================= |
475 | //function : IdealShape |
476 | //purpose : |
477 | //======================================================================= |
478 | |
479 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::IdealShape (const Handle(StepRepr_ProductDefinitionShape)& PDS) const |
480 | { |
481 | Handle(StepShape_ShapeRepresentation) SR; |
482 | Interface_EntityIterator subs = Graph().Sharings(PDS); |
483 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
484 | Handle(StepShape_ShapeDefinitionRepresentation) SDR = |
485 | Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value()); |
486 | if(SDR.IsNull()) continue; |
487 | SR = Handle(StepShape_ShapeRepresentation)::DownCast(SDR->UsedRepresentation()); |
488 | } |
489 | return SR; |
490 | } |
491 | |
492 | |
493 | // methods for getting nominal_design_shape |
494 | |
495 | |
496 | //======================================================================= |
497 | //function : NominShape |
498 | //purpose : |
499 | //======================================================================= |
500 | |
501 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::NominShape (const Handle(StepBasic_Product) &Prod) const |
502 | { |
503 | Handle(StepShape_ShapeRepresentation) SR; |
504 | if(Prod.IsNull()) return SR; |
505 | Interface_EntityIterator subs = Graph().Sharings(Prod); |
506 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
507 | Handle(StepBasic_ProductDefinitionFormation) PDF = |
508 | Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value()); |
509 | if ( PDF.IsNull() ) continue; |
510 | SR = NominShape(PDF); |
511 | } |
512 | return SR; |
513 | } |
514 | |
515 | |
516 | //======================================================================= |
517 | //function : NominShape |
518 | //purpose : |
519 | //======================================================================= |
520 | |
521 | Handle(StepShape_ShapeRepresentation) StepAP209_Construct::NominShape (const Handle(StepBasic_ProductDefinitionFormation) &PDF) const |
522 | { |
523 | Handle(StepShape_ShapeRepresentation) SR; |
524 | if(PDF.IsNull()) return SR; |
525 | Handle(StepBasic_ProductDefinitionFormation) PDF2; |
526 | Interface_EntityIterator subs = Graph().Sharings(PDF); |
527 | for (subs.Start(); subs.More(); subs.Next()) { |
528 | Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR = |
529 | Handle(StepBasic_ProductDefinitionFormationRelationship)::DownCast(subs.Value()); |
530 | if(PDFR.IsNull()) continue; |
531 | PDF2 = PDFR->RelatingProductDefinitionFormation(); |
532 | } |
533 | if(PDF2.IsNull() ) return SR; |
534 | subs = Graph().Sharings(PDF2); |
535 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
536 | Handle(StepBasic_ProductDefinition) PD = |
537 | Handle(StepBasic_ProductDefinition)::DownCast(subs.Value()); |
538 | if(PD.IsNull()) continue; |
539 | Interface_EntityIterator subs2 = Graph().Sharings(PD); |
540 | for (subs2.Start(); subs2.More() && SR.IsNull() ; subs2.Next()) { |
541 | Handle(StepRepr_ProductDefinitionShape) PDS = |
542 | Handle(StepRepr_ProductDefinitionShape)::DownCast(subs2.Value()); |
543 | if(PDS.IsNull()) continue; |
544 | Interface_EntityIterator subs3 = Graph().Sharings(PDS); |
545 | for (subs3.Start(); subs3.More() && SR.IsNull() ; subs3.Next()) { |
546 | Handle(StepShape_ShapeDefinitionRepresentation) SDR = |
547 | Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs3.Value()); |
548 | if(SDR.IsNull()) continue; |
549 | SR = Handle(StepShape_ShapeRepresentation)::DownCast(SDR->UsedRepresentation()); |
550 | } |
551 | } |
552 | } |
553 | return SR; |
554 | } |
555 | |
556 | |
557 | |
558 | //======================================================================= |
559 | //function : GetElements1D |
560 | //purpose : |
561 | //======================================================================= |
562 | |
563 | Handle(StepFEA_HSequenceOfElementRepresentation) StepAP209_Construct::GetElements1D |
564 | (const Handle(StepFEA_FeaModel)& theFeaModel) const |
565 | { |
566 | return GetFeaElements(theFeaModel,STANDARD_TYPE(StepFEA_Curve3dElementRepresentation)); |
567 | } |
568 | |
569 | |
570 | //======================================================================= |
571 | //function : GetElements2D |
572 | //purpose : |
573 | //======================================================================= |
574 | |
575 | Handle(StepFEA_HSequenceOfElementRepresentation) StepAP209_Construct::GetElements2D |
576 | (const Handle(StepFEA_FeaModel)& theFeaModel) const |
577 | { |
578 | return GetFeaElements(theFeaModel,STANDARD_TYPE(StepFEA_Surface3dElementRepresentation)); |
579 | } |
580 | |
581 | |
582 | //======================================================================= |
583 | //function : GetElements3D |
584 | //purpose : |
585 | //======================================================================= |
586 | |
587 | Handle(StepFEA_HSequenceOfElementRepresentation) StepAP209_Construct::GetElements3D |
588 | (const Handle(StepFEA_FeaModel)& theFeaModel) const |
589 | { |
590 | return GetFeaElements(theFeaModel,STANDARD_TYPE(StepFEA_Volume3dElementRepresentation)); |
591 | } |
592 | |
593 | |
594 | //======================================================================= |
595 | //function : GetFeaElements |
596 | //purpose : |
597 | //======================================================================= |
598 | |
599 | Handle(StepFEA_HSequenceOfElementRepresentation) StepAP209_Construct::GetFeaElements |
600 | (const Handle(StepFEA_FeaModel)& theFeaModel, |
601 | const Handle(Standard_Type)& theType) const |
602 | { |
603 | Handle(StepFEA_HSequenceOfElementRepresentation) aSequence; |
604 | if( !theType->SubType(STANDARD_TYPE(StepFEA_ElementRepresentation))) |
605 | return aSequence; |
606 | |
607 | Interface_EntityIterator anIter = Graph().Sharings(theFeaModel); |
608 | anIter.Start(); |
609 | if(anIter.More()) |
610 | aSequence = new StepFEA_HSequenceOfElementRepresentation; |
611 | |
612 | for (; anIter.More(); anIter.Next()) { |
613 | Handle(Standard_Transient) anEntity = anIter.Value(); |
614 | if(anEntity->IsKind(theType)) { |
615 | Handle(StepFEA_ElementRepresentation) anElement = |
616 | Handle(StepFEA_ElementRepresentation)::DownCast(anEntity); |
617 | aSequence->Append(anElement); |
618 | } |
619 | } |
620 | return aSequence; |
621 | |
622 | } |
623 | |
624 | |
625 | //======================================================================= |
626 | //function : GetFeaElements |
627 | //purpose : |
628 | //======================================================================= |
629 | |
630 | Handle(StepElement_HSequenceOfCurveElementSectionDefinition) StepAP209_Construct::GetCurElemSection |
631 | (const Handle(StepFEA_Curve3dElementRepresentation)& ElemRepr) const |
632 | { |
633 | Handle(StepElement_HSequenceOfCurveElementSectionDefinition) aSequence = |
634 | new StepElement_HSequenceOfCurveElementSectionDefinition; |
635 | if(ElemRepr.IsNull()) return aSequence; |
636 | |
637 | Handle(StepFEA_Curve3dElementProperty) C3dEP = ElemRepr->Property(); |
638 | if(C3dEP.IsNull()) return aSequence; |
639 | |
640 | Handle(StepFEA_HArray1OfCurveElementInterval) ACEI = C3dEP->IntervalDefinitions(); |
641 | if(ACEI.IsNull()) return aSequence; |
642 | |
643 | for(Standard_Integer i=1; i<=ACEI->Length(); i++) { |
644 | Handle(StepFEA_CurveElementIntervalConstant) CEIC = |
645 | Handle(StepFEA_CurveElementIntervalConstant)::DownCast(ACEI->Value(i)); |
646 | if(CEIC.IsNull()) continue; |
647 | aSequence->Append(CEIC->Section()); |
648 | } |
649 | return aSequence; |
650 | } |
651 | |
652 | |
653 | //======================================================================= |
654 | //function : CreateAnalysStructure |
655 | //purpose : |
656 | //======================================================================= |
657 | |
658 | Standard_Boolean StepAP209_Construct::CreateAnalysStructure (const Handle(StepBasic_Product) &Prod) const |
659 | { |
660 | if(Prod.IsNull()) return Standard_False; |
661 | Interface_EntityIterator subs = Graph().Sharings(Prod); |
662 | Handle(StepBasic_ProductDefinitionFormation) PDF; |
663 | for (subs.Start(); subs.More() && PDF.IsNull() ; subs.Next()) { |
664 | PDF = Handle(StepBasic_ProductDefinitionFormation)::DownCast(subs.Value()); |
665 | if(PDF.IsNull()) continue; |
666 | } |
667 | if(PDF.IsNull()) return Standard_False; |
668 | //if( IsDesing(PDF) || IsAnalys(PDF) ) return Standard_False; |
669 | |
670 | // find nominal_design_shape: |
671 | Handle(StepShape_ShapeRepresentation) SR; |
672 | Handle(StepBasic_ProductDefinition) PD; |
673 | subs = Graph().Sharings(PDF); |
674 | for (subs.Start(); subs.More() && SR.IsNull() ; subs.Next()) { |
675 | PD = Handle(StepBasic_ProductDefinition)::DownCast(subs.Value()); |
676 | if(PD.IsNull()) continue; |
677 | Interface_EntityIterator subs2 = Graph().Sharings(PD); |
678 | for (subs2.Start(); subs2.More() && SR.IsNull() ; subs2.Next()) { |
679 | Handle(StepRepr_ProductDefinitionShape) PDS = |
680 | Handle(StepRepr_ProductDefinitionShape)::DownCast(subs2.Value()); |
681 | if(PDS.IsNull()) continue; |
682 | Interface_EntityIterator subs3 = Graph().Sharings(PDS); |
683 | for (subs3.Start(); subs3.More() && SR.IsNull() ; subs3.Next()) { |
684 | Handle(StepShape_ShapeDefinitionRepresentation) SDR = |
685 | Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs3.Value()); |
686 | if(SDR.IsNull()) continue; |
687 | SR = Handle(StepShape_ShapeRepresentation)::DownCast(SDR->UsedRepresentation()); |
688 | } |
689 | } |
690 | } |
691 | if(SR.IsNull()) return Standard_False; // no nominal_design_shape |
692 | |
693 | // create structure: |
694 | ReplaceCcDesingToApplied(); |
695 | Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model()); |
696 | |
697 | // replace existing contexts for using AP209 |
698 | Handle(StepBasic_ProductContext) OldProdCtx = |
699 | Handle(StepBasic_ProductContext)::DownCast(Prod->FrameOfReferenceValue(1)); |
700 | if(!OldProdCtx.IsNull()) { |
701 | Handle(StepBasic_ProductContext) ProdCtx = new StepBasic_ProductContext; |
702 | ProdCtx->Init(OldProdCtx->Name(), |
703 | OldProdCtx->FrameOfReference(), |
704 | OldProdCtx->DisciplineType()); |
705 | smodel->ReplaceEntity(smodel->Number(OldProdCtx),ProdCtx); |
706 | smodel->SetIdentLabel(ProdCtx, smodel->Number(ProdCtx)); |
707 | Handle(StepBasic_HArray1OfProductContext) HAPC = Prod->FrameOfReference(); |
708 | HAPC->SetValue(1,ProdCtx); |
709 | Prod->SetFrameOfReference(HAPC); |
710 | } |
711 | Handle(StepBasic_ProductDefinitionContext) OldPDCtx = |
712 | Handle(StepBasic_ProductDefinitionContext)::DownCast(PD->FrameOfReference()); |
713 | if(!OldPDCtx.IsNull()) { |
714 | Handle(StepBasic_ProductDefinitionContext) PDCtx = new StepBasic_ProductDefinitionContext; |
715 | PDCtx->Init(OldPDCtx->Name(), |
716 | OldPDCtx->FrameOfReference(), |
717 | OldPDCtx->LifeCycleStage()); |
718 | smodel->ReplaceEntity(smodel->Number(OldPDCtx),PDCtx); |
719 | smodel->SetIdentLabel(PDCtx, smodel->Number(PDCtx)); |
720 | PD->SetFrameOfReference(PDCtx); |
721 | } |
722 | |
723 | // add idealized_analys_shape: |
724 | Handle(StepShape_ShapeRepresentation) AnaSR = new StepShape_ShapeRepresentation; |
725 | Handle(StepRepr_RepresentationItem) RI = new StepRepr_RepresentationItem; |
726 | RI = SR->ItemsValue(1); |
727 | smodel->AddWithRefs(RI); // add new representation_item |
728 | smodel->SetIdentLabel(RI, smodel->Number(RI)); |
729 | Handle(StepRepr_HArray1OfRepresentationItem) ARI = new StepRepr_HArray1OfRepresentationItem(1,1); |
730 | ARI->SetValue(1,RI); |
731 | AnaSR->Init(new TCollection_HAsciiString("idealized_analysis_shape"), |
732 | ARI, SR->ContextOfItems()); |
733 | smodel->AddWithRefs(AnaSR); // add idealized_analys_shape |
734 | smodel->SetIdentLabel(AnaSR, smodel->Number(AnaSR)); |
735 | |
736 | // add product: |
737 | Handle(StepBasic_Product) AnaProd = new StepBasic_Product; |
738 | AnaProd->Init(new TCollection_HAsciiString(""), new TCollection_HAsciiString("analysis"), |
739 | new TCollection_HAsciiString("analysis product"), Prod->FrameOfReference()); |
740 | smodel->AddWithRefs(AnaProd); |
741 | smodel->SetIdentLabel(AnaProd, smodel->Number(AnaProd)); |
742 | |
743 | // add product_definition_formation: |
744 | Handle(StepBasic_ProductDefinitionFormation) AnaPDF = |
745 | new StepBasic_ProductDefinitionFormation; |
746 | AnaPDF->Init(new TCollection_HAsciiString(""), |
747 | new TCollection_HAsciiString("analysis version"), AnaProd); |
748 | smodel->AddWithRefs(AnaPDF); |
749 | smodel->SetIdentLabel(AnaPDF, smodel->Number(AnaPDF)); |
750 | |
751 | // add product_definition_formation_relationship: |
752 | Handle(StepBasic_ProductDefinitionFormationRelationship) PDFR = |
753 | new StepBasic_ProductDefinitionFormationRelationship; |
754 | PDFR->Init(new TCollection_HAsciiString(""), |
755 | new TCollection_HAsciiString("analysis design version relationship"), |
756 | new TCollection_HAsciiString(""), PDF, AnaPDF); |
757 | smodel->AddWithRefs(PDFR); |
758 | smodel->SetIdentLabel(PDFR, smodel->Number(PDFR)); |
759 | |
760 | // add product_definition: |
761 | Handle(StepBasic_ProductDefinition) AnaPD = new StepBasic_ProductDefinition; |
762 | Handle(StepBasic_ProductDefinitionContext) AnaPDC = |
763 | new StepBasic_ProductDefinitionContext; |
764 | Handle(StepBasic_ApplicationContext) AC = Prod->FrameOfReferenceValue(1)->FrameOfReference(); |
765 | AnaPDC->Init(new TCollection_HAsciiString("analysis"), AC, |
766 | new TCollection_HAsciiString("analysis") ); |
767 | smodel->AddWithRefs(AnaPDC); // add new product_definition_context |
768 | smodel->SetIdentLabel(AnaPDC, smodel->Number(AnaPDC)); |
769 | AnaPD->Init(new TCollection_HAsciiString("analysis"), |
770 | new TCollection_HAsciiString("analysis discipline product definition"), |
771 | AnaPDF, AnaPDC); |
772 | smodel->AddWithRefs(AnaPD); // add new product_definition |
773 | smodel->SetIdentLabel(AnaPD, smodel->Number(AnaPD)); |
774 | |
775 | // add product_definition_shape: |
776 | Handle(StepRepr_ProductDefinitionShape) AnaPDS = new StepRepr_ProductDefinitionShape; |
777 | StepRepr_CharacterizedDefinition ChDef; |
778 | ChDef.SetValue(AnaPD); |
779 | AnaPDS->Init(new TCollection_HAsciiString(""), Standard_True, |
780 | new TCollection_HAsciiString("analysis shape"), ChDef); |
781 | smodel->AddWithRefs(AnaPDS); |
782 | smodel->SetIdentLabel(AnaPDS, smodel->Number(AnaPDS)); |
783 | |
784 | // add shape_definition_representation: |
785 | Handle(StepShape_ShapeDefinitionRepresentation) AnaSDR = new StepShape_ShapeDefinitionRepresentation; |
786 | StepRepr_RepresentedDefinition RepDef; |
787 | RepDef.SetValue(AnaPDS); |
788 | AnaSDR->Init(RepDef, AnaSR); |
789 | smodel->AddWithRefs(AnaSDR); |
790 | smodel->SetIdentLabel(AnaSDR, smodel->Number(AnaSDR)); |
791 | |
792 | // add shape_representation_relationship: |
793 | Handle(StepRepr_ShapeRepresentationRelationship) SRR = |
794 | new StepRepr_ShapeRepresentationRelationship; |
795 | SRR->Init(new TCollection_HAsciiString("basis"), new TCollection_HAsciiString(""), AnaSR, SR); |
796 | smodel->AddWithRefs(SRR); |
797 | smodel->SetIdentLabel(SRR, smodel->Number(SRR)); |
798 | |
799 | CreateAddingEntities(AnaPD); |
800 | |
801 | |
802 | WS()->ComputeGraph(Standard_True); |
803 | WS()->ComputeCheck(Standard_True); |
804 | |
805 | return Standard_True; |
806 | } |
807 | |
808 | |
809 | //======================================================================= |
810 | //function : CreateFeaStructure |
811 | //purpose : |
812 | //======================================================================= |
813 | |
814 | Standard_Boolean StepAP209_Construct::CreateFeaStructure (const Handle(StepBasic_Product) &Prod) const |
815 | { |
816 | if(Prod.IsNull()) { |
817 | #ifdef DEB |
818 | cout<<"Prod.IsNull()"<<endl; |
819 | #endif |
820 | return Standard_False; |
821 | } |
822 | Handle(StepShape_ShapeRepresentation) AnaSR = IdealShape(Prod); |
823 | if(AnaSR.IsNull()) { |
824 | #ifdef DEB |
825 | cout<<"AnaSR.IsNull()"<<endl; |
826 | #endif |
827 | return Standard_False; |
828 | } |
829 | Handle(StepRepr_ProductDefinitionShape) AnaPDS; |
830 | Interface_EntityIterator subs = Graph().Sharings(AnaSR); |
831 | for (subs.Start(); subs.More() && AnaPDS.IsNull(); subs.Next()) { |
832 | Handle(StepShape_ShapeDefinitionRepresentation) SDR = |
833 | Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value()); |
834 | if ( SDR.IsNull() ) continue; |
835 | AnaPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(SDR->Definition().Value()); |
836 | } |
837 | |
838 | //Handle(Interface_InterfaceModel) model = Model(); |
839 | Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model()); |
840 | |
841 | // add fea_model_definition |
842 | Handle(StepFEA_FeaModelDefinition) FMD = new StepFEA_FeaModelDefinition; |
843 | FMD->Init(new TCollection_HAsciiString("FEA_MODEL"), |
844 | new TCollection_HAsciiString("FEA_MODEL"), AnaPDS, StepData_LFalse); |
845 | smodel->AddWithRefs(FMD); |
846 | smodel->SetIdentLabel(FMD, smodel->Number(FMD)); |
847 | |
848 | // add fea_axis2_placement_3d |
849 | Handle(StepFEA_FeaAxis2Placement3d) FA2P3D = new StepFEA_FeaAxis2Placement3d; |
850 | Handle(StepGeom_CartesianPoint) SGCP = new StepGeom_CartesianPoint; |
851 | SGCP->Init3D(new TCollection_HAsciiString(""), 0., 0., 0.); |
852 | Handle(TColStd_HArray1OfReal) ArrTmp = new TColStd_HArray1OfReal(1,3); |
853 | ArrTmp->SetValue(1,0.); |
854 | ArrTmp->SetValue(2,0.); |
855 | ArrTmp->SetValue(3,1.); |
856 | Handle(StepGeom_Direction) SGD1 = new StepGeom_Direction; |
857 | SGD1->Init(new TCollection_HAsciiString(""), ArrTmp); |
858 | ArrTmp->SetValue(1,1.); |
859 | ArrTmp->SetValue(2,0.); |
860 | ArrTmp->SetValue(3,0.); |
861 | Handle(StepGeom_Direction) SGD2 = new StepGeom_Direction; |
862 | SGD2->Init(new TCollection_HAsciiString(""), ArrTmp); |
863 | FA2P3D->Init(new TCollection_HAsciiString("FEA_BASIC_COORD_SYSTEM"), |
864 | SGCP, Standard_True, SGD1, Standard_True, SGD2, StepFEA_Cartesian, |
865 | new TCollection_HAsciiString("FEA_BASIC_COORD_SYSTEM")); |
866 | smodel->AddWithRefs(FA2P3D); |
867 | smodel->SetIdentLabel(FA2P3D, smodel->Number(FA2P3D)); |
868 | |
869 | // create context for fea_model |
870 | Handle(StepShape_ShapeRepresentation) NS = NominShape(Prod); |
871 | Handle(StepRepr_RepresentationContext) RC = NS->ContextOfItems(); |
872 | Handle(StepGeom_GeometricRepresentationContext) GeoCtx; |
873 | Handle(StepBasic_HArray1OfNamedUnit) OldHANU; |
874 | if(RC->IsKind(STANDARD_TYPE(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx))) { |
875 | Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx) GeoUnitCtxNS = |
876 | Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx)::DownCast(RC); |
877 | GeoCtx = GeoUnitCtxNS->GeometricRepresentationContext(); |
878 | OldHANU = GeoUnitCtxNS->GlobalUnitAssignedContext()->Units(); |
879 | } |
880 | if(RC->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext))) { |
881 | Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext) GeoUnitCtxNS = |
882 | Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext)::DownCast(RC); |
883 | GeoCtx = GeoUnitCtxNS->GeometricRepresentationContext(); |
884 | OldHANU = GeoUnitCtxNS->GlobalUnitAssignedContext()->Units(); |
885 | } |
886 | Handle(StepBasic_HArray1OfNamedUnit) NewHANU = new StepBasic_HArray1OfNamedUnit(1,OldHANU->Length()+3); |
887 | for(Standard_Integer i=1; i<=OldHANU->Length(); i++) |
888 | NewHANU->SetValue(i,OldHANU->Value(i)); |
889 | // create SiUnitAndTimeUnit |
890 | Handle(StepBasic_DimensionalExponents) DimExpT = new StepBasic_DimensionalExponents; |
891 | DimExpT->Init(0.,0.,1.,0.,0.,0.,0.); |
892 | smodel->AddWithRefs(DimExpT); |
893 | smodel->SetIdentLabel(DimExpT, smodel->Number(DimExpT)); |
894 | Handle(StepBasic_SiUnitAndTimeUnit) SUTU = new StepBasic_SiUnitAndTimeUnit; |
895 | SUTU->Init(DimExpT); |
896 | SUTU->SetName(StepBasic_sunSecond); |
897 | smodel->AddWithRefs(SUTU); |
898 | smodel->SetIdentLabel(SUTU, smodel->Number(SUTU)); |
899 | NewHANU->SetValue(OldHANU->Length()+1,SUTU); |
900 | //create SiUnitAndMassUnit |
901 | Handle(StepBasic_DimensionalExponents) DimExpM = new StepBasic_DimensionalExponents; |
902 | DimExpM->Init(0.,1.,0.,0.,0.,0.,0.); |
903 | smodel->AddWithRefs(DimExpM); |
904 | smodel->SetIdentLabel(DimExpM, smodel->Number(DimExpM)); |
905 | Handle(StepBasic_SiUnitAndMassUnit) SUMU = new StepBasic_SiUnitAndMassUnit; |
906 | SUMU->Init(DimExpM); |
907 | SUMU->SetName(StepBasic_sunGram); |
908 | SUMU->SetPrefix(StepBasic_spKilo); |
909 | smodel->AddWithRefs(SUMU); |
910 | smodel->SetIdentLabel(SUMU, smodel->Number(SUMU)); |
911 | NewHANU->SetValue(OldHANU->Length()+2,SUMU); |
912 | // create SiUnitAndThermodynamicTemperatureUnit |
913 | Handle(StepBasic_DimensionalExponents) DimExpTT = new StepBasic_DimensionalExponents; |
914 | DimExpTT->Init(0.,0.,0.,0.,1.,0.,0.); |
915 | smodel->AddWithRefs(DimExpTT); |
916 | smodel->SetIdentLabel(DimExpTT, smodel->Number(DimExpTT)); |
917 | Handle(StepBasic_SiUnitAndThermodynamicTemperatureUnit) SUTTU = |
918 | new StepBasic_SiUnitAndThermodynamicTemperatureUnit; |
919 | SUTTU->Init(DimExpTT); |
920 | SUTTU->SetName(StepBasic_sunDegreeCelsius); |
921 | smodel->AddWithRefs(SUTTU); |
922 | smodel->SetIdentLabel(SUTTU, smodel->Number(SUTTU)); |
923 | NewHANU->SetValue(OldHANU->Length()+3,SUTTU); |
924 | |
925 | Handle(StepRepr_GlobalUnitAssignedContext) NewUnitCtx = new StepRepr_GlobalUnitAssignedContext; |
926 | NewUnitCtx->Init(new TCollection_HAsciiString(""), new TCollection_HAsciiString(""),NewHANU); |
927 | Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext) NewGeoCtx = |
928 | new StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext; |
929 | NewGeoCtx->Init(new TCollection_HAsciiString("REP_CONTEXT_FEA"), |
930 | new TCollection_HAsciiString("3D"), GeoCtx, NewUnitCtx); |
931 | smodel->AddWithRefs(NewGeoCtx); |
932 | smodel->SetIdentLabel(NewGeoCtx, smodel->Number(NewGeoCtx)); |
933 | |
934 | // create fea_model_3d |
935 | Handle(StepFEA_FeaModel3d) FM = new StepFEA_FeaModel3d; |
936 | FM->SetName(new TCollection_HAsciiString("FEA_MODEL")); |
937 | Handle(StepRepr_HArray1OfRepresentationItem) HARI = |
938 | new StepRepr_HArray1OfRepresentationItem(1,1); |
939 | HARI->SetValue(1,FA2P3D); |
940 | Handle(TColStd_HArray1OfAsciiString) HAAS = new TColStd_HArray1OfAsciiString(1,1); |
941 | HAAS->SetValue(1,"FEA_SOLVER"); |
942 | FM->Init(new TCollection_HAsciiString("FEA_MODEL"), HARI, |
943 | NewGeoCtx, new TCollection_HAsciiString(""), |
944 | HAAS, new TCollection_HAsciiString("ANALYSIS_MODEL"), |
945 | new TCollection_HAsciiString("LINEAR_STATIC")); |
946 | smodel->AddWithRefs(FM); |
947 | smodel->SetIdentLabel(FM, smodel->Number(FM)); |
948 | |
949 | // add structural_response_property |
950 | Handle(StepRepr_StructuralResponseProperty) SRP = |
951 | new StepRepr_StructuralResponseProperty; |
952 | StepRepr_CharacterizedDefinition ChDef2; |
953 | ChDef2.SetValue(FMD); |
954 | SRP->Init(new TCollection_HAsciiString("STRUCT_RESP_PROP"), Standard_True, |
955 | new TCollection_HAsciiString("STRUCTURAL_RESPONSE_PROPERTY"),ChDef2); |
956 | smodel->AddWithRefs(SRP); |
957 | smodel->SetIdentLabel(SRP, smodel->Number(SRP)); |
958 | |
959 | // add structural_response_property_definition_representation |
960 | Handle(StepRepr_StructuralResponsePropertyDefinitionRepresentation) SRPDR = |
961 | new StepRepr_StructuralResponsePropertyDefinitionRepresentation; |
962 | StepRepr_RepresentedDefinition RepDef2; |
963 | RepDef2.SetValue(SRP); |
964 | SRPDR->Init(RepDef2,FM); |
965 | smodel->AddWithRefs(SRPDR); |
966 | smodel->SetIdentLabel(SRPDR, smodel->Number(SRPDR)); |
967 | |
968 | WS()->ComputeGraph(Standard_True); |
969 | WS()->ComputeCheck(Standard_True); |
970 | |
971 | return Standard_True; |
972 | } |
973 | |
974 | |
975 | //======================================================================= |
976 | //function : ReplaceCcDesingToApplied |
977 | //purpose : Put into model entities Applied... for AP209 instead of |
978 | // entities CcDesing... from AP203 |
979 | //======================================================================= |
980 | |
981 | Standard_Boolean StepAP209_Construct::ReplaceCcDesingToApplied() const |
982 | { |
983 | Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model()); |
984 | Standard_Integer nb = smodel->NbEntities(); |
985 | for(Standard_Integer i=1; i<=nb; i++) { |
986 | Handle(Standard_Transient) anEntity = smodel->Value(i); |
987 | if(anEntity->IsKind(STANDARD_TYPE(StepAP203_CcDesignApproval))) { |
988 | Handle(StepAP203_CcDesignApproval) ent = Handle(StepAP203_CcDesignApproval)::DownCast(anEntity); |
989 | Handle(StepAP214_AppliedApprovalAssignment) nent = new StepAP214_AppliedApprovalAssignment; |
990 | Handle(StepAP203_HArray1OfApprovedItem) HAAI203 = ent->Items(); |
991 | Handle(StepAP214_HArray1OfApprovalItem) HAAI214 = |
992 | new StepAP214_HArray1OfApprovalItem(1,HAAI203->Length()); |
993 | for(Standard_Integer j=1; j<=HAAI203->Length(); j++) { |
994 | StepAP214_ApprovalItem AI214; |
995 | AI214.SetValue(HAAI203->Value(j).Value()); |
996 | HAAI214->SetValue(j,AI214); |
997 | } |
998 | nent->Init(ent->AssignedApproval(), HAAI214); |
999 | smodel->ReplaceEntity(i,nent); |
1000 | smodel->SetIdentLabel(nent, smodel->Number(nent)); |
1001 | } |
1002 | else if(anEntity->IsKind(STANDARD_TYPE(StepAP203_CcDesignPersonAndOrganizationAssignment))) { |
1003 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) ent = |
1004 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment)::DownCast(anEntity); |
1005 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment) nent = |
1006 | new StepAP214_AppliedPersonAndOrganizationAssignment; |
1007 | Handle(StepAP203_HArray1OfPersonOrganizationItem) HAPOI203 = ent->Items(); |
1008 | Handle(StepAP214_HArray1OfPersonAndOrganizationItem) HAPOI214 = |
1009 | new StepAP214_HArray1OfPersonAndOrganizationItem(1,HAPOI203->Length()); |
1010 | for(Standard_Integer j=1; j<=HAPOI203->Length(); j++) { |
1011 | StepAP214_PersonAndOrganizationItem POI214; |
1012 | POI214.SetValue(HAPOI203->Value(j).Value()); |
1013 | HAPOI214->SetValue(j,POI214); |
1014 | } |
1015 | nent->Init(ent->AssignedPersonAndOrganization(), ent->Role(), HAPOI214); |
1016 | smodel->ReplaceEntity(i,nent); |
1017 | smodel->SetIdentLabel(nent, smodel->Number(nent)); |
1018 | } |
1019 | else if(anEntity->IsKind(STANDARD_TYPE(StepAP203_CcDesignDateAndTimeAssignment))) { |
1020 | Handle(StepAP203_CcDesignDateAndTimeAssignment) ent = |
1021 | Handle(StepAP203_CcDesignDateAndTimeAssignment)::DownCast(anEntity); |
1022 | Handle(StepAP214_AppliedDateAndTimeAssignment) nent = new StepAP214_AppliedDateAndTimeAssignment; |
1023 | Handle(StepAP203_HArray1OfDateTimeItem) HADTI203 = ent->Items(); |
1024 | Handle(StepAP214_HArray1OfDateAndTimeItem) HADTI214 = |
1025 | new StepAP214_HArray1OfDateAndTimeItem(1,HADTI203->Length()); |
1026 | for(Standard_Integer j=1; j<=HADTI203->Length(); j++) { |
1027 | StepAP214_DateAndTimeItem DTI214; |
1028 | DTI214.SetValue(HADTI203->Value(j).Value()); |
1029 | HADTI214->SetValue(j,DTI214); |
1030 | } |
1031 | nent->Init(ent->AssignedDateAndTime(), ent->Role(), HADTI214); |
1032 | smodel->ReplaceEntity(i,nent); |
1033 | smodel->SetIdentLabel(nent, smodel->Number(nent)); |
1034 | } |
1035 | else if(anEntity->IsKind(STANDARD_TYPE(StepAP203_CcDesignSecurityClassification))) { |
1036 | Handle(StepAP203_CcDesignSecurityClassification) ent = |
1037 | Handle(StepAP203_CcDesignSecurityClassification)::DownCast(anEntity); |
1038 | Handle(StepAP214_AppliedSecurityClassificationAssignment) nent = |
1039 | new StepAP214_AppliedSecurityClassificationAssignment; |
1040 | Handle(StepAP203_HArray1OfClassifiedItem) HACI203 = ent->Items(); |
1041 | Handle(StepAP214_HArray1OfSecurityClassificationItem) HASCI214 = |
1042 | new StepAP214_HArray1OfSecurityClassificationItem(1,HACI203->Length()); |
1043 | for(Standard_Integer j=1; j<=HACI203->Length(); j++) { |
1044 | StepAP214_SecurityClassificationItem SCI214; |
1045 | SCI214.SetValue(HACI203->Value(j).Value()); |
1046 | HASCI214->SetValue(j,SCI214); |
1047 | } |
1048 | nent->Init(ent->AssignedSecurityClassification(), HASCI214); |
1049 | smodel->ReplaceEntity(i,nent); |
1050 | smodel->SetIdentLabel(nent, smodel->Number(nent)); |
1051 | } |
1052 | } |
1053 | |
1054 | return Standard_True; |
1055 | } |
1056 | |
1057 | |
1058 | //======================================================================= |
1059 | //function : CreateAddingEntities |
1060 | //purpose : create approval.. , date.. , time.. , person.. and |
1061 | // organization.. entities for analysis structure |
1062 | //======================================================================= |
1063 | |
1064 | Standard_Boolean StepAP209_Construct::CreateAddingEntities |
1065 | (const Handle(StepBasic_ProductDefinition) &AnaPD) const |
1066 | { |
1067 | Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model()); |
1068 | Handle(StepBasic_ProductDefinitionFormation) AnaPDF = AnaPD->Formation(); |
1069 | Handle(StepBasic_Product) AnaProd = AnaPDF->OfProduct(); |
1070 | |
1071 | Handle(StepBasic_ApprovalStatus) AS = new StepBasic_ApprovalStatus; |
1072 | AS->Init(new TCollection_HAsciiString("approved")); |
1073 | smodel->AddEntity(AS); |
1074 | smodel->SetIdentLabel(AS, smodel->Number(AS)); |
1075 | Handle(StepBasic_Approval) Appr = new StepBasic_Approval; |
1076 | Appr->Init(AS, new TCollection_HAsciiString("approved")); |
1077 | smodel->AddWithRefs(Appr); |
1078 | smodel->SetIdentLabel(Appr, smodel->Number(Appr)); |
1079 | |
1080 | Handle(StepBasic_SecurityClassificationLevel) SCL = new StepBasic_SecurityClassificationLevel; |
1081 | SCL->Init(new TCollection_HAsciiString("unclassified")); |
1082 | smodel->AddEntity(SCL); |
1083 | smodel->SetIdentLabel(SCL, smodel->Number(SCL)); |
1084 | Handle(StepBasic_SecurityClassification) SC = new StepBasic_SecurityClassification; |
1085 | SC->Init(new TCollection_HAsciiString(""), new TCollection_HAsciiString(""), SCL); |
1086 | smodel->AddWithRefs(SC); |
1087 | smodel->SetIdentLabel(SC, smodel->Number(SC)); |
1088 | |
1089 | Handle(StepAP214_AppliedApprovalAssignment) AAA = new StepAP214_AppliedApprovalAssignment; |
1090 | Handle(StepAP214_HArray1OfApprovalItem) HAAI = new StepAP214_HArray1OfApprovalItem(1,3); |
1091 | StepAP214_ApprovalItem AI1; |
1092 | AI1.SetValue(AnaPD); |
1093 | HAAI->SetValue(1,AI1); |
1094 | StepAP214_ApprovalItem AI2; |
1095 | AI2.SetValue(AnaPDF); |
1096 | HAAI->SetValue(2,AI2); |
1097 | StepAP214_ApprovalItem AI3; |
1098 | AI3.SetValue(SC); |
1099 | HAAI->SetValue(3,AI3); |
1100 | AAA->Init(Appr, HAAI); |
1101 | smodel->AddWithRefs(AAA); |
1102 | smodel->SetIdentLabel(AAA, smodel->Number(AAA)); |
1103 | |
1104 | Handle(StepAP214_AppliedSecurityClassificationAssignment) ASCA = |
1105 | new StepAP214_AppliedSecurityClassificationAssignment; |
1106 | Handle(StepAP214_HArray1OfSecurityClassificationItem) HASCI = |
1107 | new StepAP214_HArray1OfSecurityClassificationItem(1,1); |
1108 | StepAP214_SecurityClassificationItem SCI; |
1109 | SCI.SetValue(AnaPDF); |
1110 | HASCI->SetValue(1,SCI); |
1111 | ASCA->Init(SC,HASCI); |
1112 | smodel->AddWithRefs(ASCA); |
1113 | smodel->SetIdentLabel(ASCA, smodel->Number(ASCA)); |
1114 | |
1115 | OSD_Process sys; |
1116 | Quantity_Date date = sys.SystemDate (); |
1117 | |
1118 | Handle(StepBasic_CalendarDate) CDate = new StepBasic_CalendarDate; |
1119 | CDate->Init(date.Year(), date.Day(), date.Month()); |
1120 | smodel->AddEntity(CDate); |
1121 | smodel->SetIdentLabel(CDate, smodel->Number(CDate)); |
1122 | Handle(StepBasic_CoordinatedUniversalTimeOffset) CUTO = new StepBasic_CoordinatedUniversalTimeOffset; |
1123 | CUTO->Init(0, Standard_True, 0, StepBasic_aobAhead); |
1124 | smodel->AddEntity(CUTO); |
1125 | smodel->SetIdentLabel(CUTO, smodel->Number(CUTO)); |
1126 | Handle(StepBasic_LocalTime) LT = new StepBasic_LocalTime; |
1127 | LT->Init(date.Hour(), Standard_True, date.Minute(), Standard_True, |
1128 | (Standard_Real)date.Second(), CUTO); |
1129 | smodel->AddWithRefs(LT); |
1130 | smodel->SetIdentLabel(LT, smodel->Number(LT)); |
1131 | Handle(StepBasic_DateAndTime) DAT = new StepBasic_DateAndTime; |
1132 | DAT->Init(CDate,LT); |
1133 | smodel->AddWithRefs(DAT); |
1134 | smodel->SetIdentLabel(DAT, smodel->Number(DAT)); |
1135 | |
1136 | Handle(StepBasic_DateTimeRole) DTR = new StepBasic_DateTimeRole; |
1137 | DTR->Init(new TCollection_HAsciiString("classification_date")); |
1138 | smodel->AddEntity(DTR); |
1139 | smodel->SetIdentLabel(DTR, smodel->Number(DTR)); |
1140 | Handle(StepAP214_AppliedDateAndTimeAssignment) ADTA = new StepAP214_AppliedDateAndTimeAssignment; |
1141 | Handle(StepAP214_HArray1OfDateAndTimeItem) HADTI = new StepAP214_HArray1OfDateAndTimeItem(1,1); |
1142 | StepAP214_DateAndTimeItem DTI1; |
1143 | DTI1.SetValue(SC); |
1144 | HADTI->SetValue(1,DTI1); |
1145 | ADTA->Init(DAT,DTR,HADTI); |
1146 | smodel->AddWithRefs(ADTA); |
1147 | smodel->SetIdentLabel(ADTA, smodel->Number(ADTA)); |
1148 | |
1149 | DTR = new StepBasic_DateTimeRole; |
1150 | DTR->Init(new TCollection_HAsciiString("creation_date")); |
1151 | smodel->AddEntity(DTR); |
1152 | smodel->SetIdentLabel(DTR, smodel->Number(DTR)); |
1153 | ADTA = new StepAP214_AppliedDateAndTimeAssignment; |
1154 | HADTI = new StepAP214_HArray1OfDateAndTimeItem(1,1); |
1155 | StepAP214_DateAndTimeItem DTI2; |
1156 | DTI2.SetValue(AnaPD); |
1157 | HADTI->SetValue(1,DTI2); |
1158 | ADTA->Init(DAT,DTR,HADTI); |
1159 | smodel->AddWithRefs(ADTA); |
1160 | smodel->SetIdentLabel(ADTA, smodel->Number(ADTA)); |
1161 | |
1162 | Handle(StepBasic_ApprovalDateTime) ADT = new StepBasic_ApprovalDateTime; |
1163 | StepBasic_DateTimeSelect DTS; |
1164 | DTS.SetValue(DAT); |
1165 | ADT->Init(DTS,Appr); |
1166 | smodel->AddWithRefs(ADT); |
1167 | smodel->SetIdentLabel(ADT, smodel->Number(ADT)); |
1168 | |
1169 | Handle(StepBasic_Person) Pers = new StepBasic_Person; |
1170 | Handle(Interface_HArray1OfHAsciiString) HAHAS = new Interface_HArray1OfHAsciiString(1,1); |
1171 | HAHAS->SetValue(1,new TCollection_HAsciiString("")); |
1172 | Pers->Init(new TCollection_HAsciiString("1"), Standard_True, |
1173 | new TCollection_HAsciiString("last_name"), Standard_True, |
1174 | new TCollection_HAsciiString("first_name"), Standard_True, |
1175 | HAHAS, Standard_True, HAHAS, Standard_True, HAHAS); |
1176 | smodel->AddEntity(Pers); |
1177 | smodel->SetIdentLabel(Pers, smodel->Number(Pers)); |
1178 | Handle(StepBasic_Organization) Org = new StepBasic_Organization; |
1179 | Org->Init(Standard_True, new TCollection_HAsciiString("1"), |
1180 | new TCollection_HAsciiString("organisation"), |
1181 | new TCollection_HAsciiString("organisation_description")); |
1182 | smodel->AddEntity(Org); |
1183 | smodel->SetIdentLabel(Org, smodel->Number(Org)); |
1184 | Handle(StepBasic_PersonAndOrganization) PO = new StepBasic_PersonAndOrganization; |
1185 | PO->Init(Pers,Org); |
1186 | smodel->AddWithRefs(PO); |
1187 | smodel->SetIdentLabel(PO, smodel->Number(PO)); |
1188 | |
1189 | Handle(StepBasic_PersonAndOrganizationRole) POR = new StepBasic_PersonAndOrganizationRole; |
1190 | POR->Init(new TCollection_HAsciiString("analysis_owner")); |
1191 | smodel->AddEntity(POR); |
1192 | smodel->SetIdentLabel(POR, smodel->Number(POR)); |
1193 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment) APOA = |
1194 | new StepAP214_AppliedPersonAndOrganizationAssignment; |
1195 | Handle(StepAP214_HArray1OfPersonAndOrganizationItem) HAPOI = |
1196 | new StepAP214_HArray1OfPersonAndOrganizationItem(1,1); |
1197 | StepAP214_PersonAndOrganizationItem POI1; |
1198 | POI1.SetValue(AnaProd); |
1199 | HAPOI->SetValue(1,POI1); |
1200 | APOA->Init(PO,POR,HAPOI); |
1201 | smodel->AddWithRefs(APOA); |
1202 | smodel->SetIdentLabel(APOA, smodel->Number(APOA)); |
1203 | |
1204 | POR = new StepBasic_PersonAndOrganizationRole; |
1205 | POR->Init(new TCollection_HAsciiString("creator")); |
1206 | smodel->AddEntity(POR); |
1207 | smodel->SetIdentLabel(POR, smodel->Number(POR)); |
1208 | APOA = new StepAP214_AppliedPersonAndOrganizationAssignment; |
1209 | HAPOI = new StepAP214_HArray1OfPersonAndOrganizationItem(1,1); |
1210 | StepAP214_PersonAndOrganizationItem POI2; |
1211 | POI2.SetValue(AnaPD); |
1212 | HAPOI->SetValue(1,POI2); |
1213 | APOA->Init(PO,POR,HAPOI); |
1214 | smodel->AddWithRefs(APOA); |
1215 | smodel->SetIdentLabel(APOA, smodel->Number(APOA)); |
1216 | |
1217 | POR = new StepBasic_PersonAndOrganizationRole; |
1218 | POR->Init(new TCollection_HAsciiString("analysis_owner")); |
1219 | smodel->AddEntity(POR); |
1220 | smodel->SetIdentLabel(POR, smodel->Number(POR)); |
1221 | APOA = new StepAP214_AppliedPersonAndOrganizationAssignment; |
1222 | HAPOI = new StepAP214_HArray1OfPersonAndOrganizationItem(1,1); |
1223 | StepAP214_PersonAndOrganizationItem POI3; |
1224 | POI3.SetValue(AnaPD); |
1225 | HAPOI->SetValue(1,POI3); |
1226 | APOA->Init(PO,POR,HAPOI); |
1227 | smodel->AddWithRefs(APOA); |
1228 | smodel->SetIdentLabel(APOA, smodel->Number(APOA)); |
1229 | |
1230 | POR = new StepBasic_PersonAndOrganizationRole; |
1231 | POR->Init(new TCollection_HAsciiString("classification_officer")); |
1232 | smodel->AddEntity(POR); |
1233 | smodel->SetIdentLabel(POR, smodel->Number(POR)); |
1234 | APOA = new StepAP214_AppliedPersonAndOrganizationAssignment; |
1235 | HAPOI = new StepAP214_HArray1OfPersonAndOrganizationItem(1,1); |
1236 | StepAP214_PersonAndOrganizationItem POI4; |
1237 | POI4.SetValue(SC); |
1238 | HAPOI->SetValue(1,POI4); |
1239 | APOA->Init(PO,POR,HAPOI); |
1240 | smodel->AddWithRefs(APOA); |
1241 | smodel->SetIdentLabel(APOA, smodel->Number(APOA)); |
1242 | |
1243 | POR = new StepBasic_PersonAndOrganizationRole; |
1244 | POR->Init(new TCollection_HAsciiString("creator")); |
1245 | smodel->AddEntity(POR); |
1246 | smodel->SetIdentLabel(POR, smodel->Number(POR)); |
1247 | APOA = new StepAP214_AppliedPersonAndOrganizationAssignment; |
1248 | HAPOI = new StepAP214_HArray1OfPersonAndOrganizationItem(1,1); |
1249 | StepAP214_PersonAndOrganizationItem POI5; |
1250 | POI5.SetValue(AnaPDF); |
1251 | HAPOI->SetValue(1,POI5); |
1252 | APOA->Init(PO,POR,HAPOI); |
1253 | smodel->AddWithRefs(APOA); |
1254 | smodel->SetIdentLabel(APOA, smodel->Number(APOA)); |
1255 | |
1256 | Handle(StepBasic_ApprovalRole) AR = new StepBasic_ApprovalRole; |
1257 | AR->Init(new TCollection_HAsciiString("approver")); |
1258 | smodel->AddEntity(AR); |
1259 | smodel->SetIdentLabel(AR, smodel->Number(AR)); |
1260 | Handle(StepBasic_ApprovalPersonOrganization) APO = new StepBasic_ApprovalPersonOrganization; |
1261 | StepBasic_PersonOrganizationSelect POS; |
1262 | POS.SetValue(PO); |
1263 | APO->Init(POS,Appr,AR); |
1264 | smodel->AddWithRefs(APO); |
1265 | smodel->SetIdentLabel(APO, smodel->Number(APO)); |
1266 | |
1267 | |
1268 | return Standard_True; |
1269 | } |
1270 | |
1271 | |
1272 | //======================================================================= |
1273 | //function : CreateAP203Structure |
1274 | //purpose : |
1275 | //======================================================================= |
1276 | |
1277 | Handle(StepData_StepModel) StepAP209_Construct::CreateAP203Structure() const |
1278 | { |
1279 | Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model()); |
1280 | Handle(StepData_StepModel) nmodel;// = new StepData_StepModel; |
1281 | if(smodel.IsNull()) return nmodel; |
1282 | //nmodel->SetProtocol(smodel->Protocol()); |
1283 | Handle(StepBasic_ProductDefinitionFormation) PDF; |
1284 | Handle(StepBasic_ProductDefinition) PD; |
1285 | Handle(StepRepr_ProductDefinitionShape) PDS; |
1286 | Handle(StepShape_ShapeDefinitionRepresentation) SDR; |
1287 | Standard_Integer nb = smodel->NbEntities(); |
1288 | for(Standard_Integer i=1; i<=nb; i++) { |
1289 | if(smodel->Value(i)->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) { |
1290 | SDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(smodel->Value(i)); |
1291 | PDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(SDR->Definition().Value()); |
1292 | if(PDS.IsNull()) continue; |
1293 | PD = Handle(StepBasic_ProductDefinition)::DownCast(PDS->Definition().Value()); |
1294 | if(PD.IsNull()) continue; |
1295 | Handle(StepBasic_ProductDefinitionFormation) PDF1 = PD->Formation(); |
1296 | if(IsDesing(PDF1)) { |
1297 | PDF = PDF1; |
1298 | i = nb; |
1299 | } |
1300 | } |
1301 | } |
1302 | if(PDF.IsNull()) return nmodel; |
1303 | nmodel = new StepData_StepModel; |
1304 | nmodel->SetProtocol(smodel->Protocol()); |
1305 | |
1306 | Handle(StepBasic_Product) Prod = PDF->OfProduct(); |
1307 | nmodel->AddWithRefs(Prod); |
1308 | |
1309 | // adding categories: |
1310 | Handle(StepBasic_HArray1OfProduct) HAProd = new StepBasic_HArray1OfProduct(1,1); |
1311 | HAProd->SetValue(1,Prod); |
1312 | Handle(StepBasic_ProductRelatedProductCategory) PRPC = new StepBasic_ProductRelatedProductCategory; |
1313 | PRPC->Init(new TCollection_HAsciiString("design"), |
1314 | Standard_True, Prod->Name(), HAProd); // may be Prod->Description() - ??? |
1315 | nmodel->AddEntity(PRPC); |
1316 | Handle(StepBasic_ProductCategory) PCat = new StepBasic_ProductCategory; |
1317 | PCat->Init(new TCollection_HAsciiString("part"), |
1318 | Standard_True, Prod->Name()); // may be Prod->Description() - ??? |
1319 | nmodel->AddEntity(PCat); |
1320 | //nmodel->SetIdentLabel(PCat, smodel->Number(PCat)); |
1321 | Handle(StepBasic_ProductCategoryRelationship) PCR = new StepBasic_ProductCategoryRelationship; |
1322 | PCR->Init(new TCollection_HAsciiString(""), Standard_True, |
1323 | Prod->Name(), PCat, PRPC); // may be Prod->Description() - ??? |
1324 | nmodel->AddWithRefs(PCR); |
1325 | |
1326 | nmodel->AddWithRefs(PDF); |
1327 | nmodel->AddWithRefs(PD); |
1328 | |
1329 | // replacing contexts: |
1330 | Handle(StepBasic_ApplicationContext) ApplCtx; |
1331 | Handle(StepBasic_ProductContext) ProdCtx = |
1332 | Handle(StepBasic_ProductContext)::DownCast(Prod->FrameOfReferenceValue(1)); |
1333 | if(!ProdCtx.IsNull()) { |
1334 | Handle(StepBasic_MechanicalContext) MechCtx = new StepBasic_MechanicalContext; |
1335 | MechCtx->Init(ProdCtx->Name(), ProdCtx->FrameOfReference(), |
1336 | ProdCtx->DisciplineType()); |
1337 | nmodel->ReplaceEntity(nmodel->Number(ProdCtx),MechCtx); |
1338 | Handle(StepBasic_HArray1OfProductContext) HAPC = new StepBasic_HArray1OfProductContext(1,1); |
1339 | HAPC->SetValue(1,MechCtx); |
1340 | Prod->SetFrameOfReference(HAPC); |
1341 | ApplCtx = MechCtx->FrameOfReference(); |
1342 | } |
1343 | Handle(StepBasic_ProductDefinitionContext) PDCtx = |
1344 | Handle(StepBasic_ProductDefinitionContext)::DownCast(PD->FrameOfReference()); |
1345 | if(!PDCtx.IsNull()) { |
1346 | Handle(StepBasic_DesignContext) DesCtx = new StepBasic_DesignContext; |
1347 | DesCtx->Init(PDCtx->Name(), PDCtx->FrameOfReference(), |
1348 | PDCtx->LifeCycleStage()); |
1349 | nmodel->ReplaceEntity(nmodel->Number(PDCtx),DesCtx); |
1350 | PD->SetFrameOfReference(DesCtx); |
1351 | ApplCtx = DesCtx->FrameOfReference(); |
1352 | } |
1353 | if(!ApplCtx.IsNull()) { |
1354 | Handle(StepBasic_ApplicationProtocolDefinition) APD; |
1355 | Interface_EntityIterator subs = Graph().Sharings(ApplCtx); |
1356 | for (subs.Start(); subs.More() && APD.IsNull(); subs.Next()) { |
1357 | APD = Handle(StepBasic_ApplicationProtocolDefinition)::DownCast(subs.Value()); |
1358 | if(APD.IsNull()) continue; |
1359 | nmodel->AddWithRefs(APD); |
1360 | } |
1361 | } |
1362 | |
1363 | CreateAdding203Entities(PD,nmodel); |
1364 | |
1365 | // adding geometry part |
1366 | nmodel->AddWithRefs(SDR); |
1367 | |
1368 | // adding DimensionalExponents |
1369 | Handle(StepBasic_DimensionalExponents) DimExp = new StepBasic_DimensionalExponents; |
1370 | DimExp->Init(1.,0.,0.,0.,0.,0.,0.); |
1371 | nmodel->AddWithRefs(DimExp); |
1372 | DimExp = new StepBasic_DimensionalExponents; |
1373 | DimExp->Init(0.,0.,0.,0.,0.,0.,0.); |
1374 | nmodel->AddWithRefs(DimExp); |
1375 | |
1376 | // writing HeaderSection |
1377 | nmodel->ClearHeader(); |
1378 | Handle(HeaderSection_FileName) FN = Handle(HeaderSection_FileName):: |
1379 | DownCast(smodel->HeaderEntity(STANDARD_TYPE(HeaderSection_FileName))); |
1380 | if(!FN.IsNull()) { |
1381 | FN->SetPreprocessorVersion(new TCollection_HAsciiString("AP209 -> SDRB Convertor")); |
1382 | nmodel->AddHeaderEntity(FN); |
1383 | } |
1384 | Handle(HeaderSection_FileSchema) FS = Handle(HeaderSection_FileSchema):: |
1385 | DownCast(smodel->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema))); |
1386 | if(!FS.IsNull()) |
1387 | nmodel->AddHeaderEntity(FS); |
1388 | Handle(HeaderSection_FileDescription) FD = Handle(HeaderSection_FileDescription):: |
1389 | DownCast(smodel->HeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription))); |
1390 | if(!FD.IsNull()) { |
1391 | Handle(Interface_HArray1OfHAsciiString) HAAS = new Interface_HArray1OfHAsciiString(1,1); |
1392 | HAAS->SetValue(1,new TCollection_HAsciiString("STEP AP203 file generated from STEP AP209")); |
1393 | FD->SetDescription(HAAS); |
1394 | nmodel->AddHeaderEntity(FD); |
1395 | } |
1396 | |
1397 | // WS()->SetModel(nmodel); |
1398 | |
1399 | return nmodel; |
1400 | } |
1401 | |
1402 | |
1403 | //======================================================================= |
1404 | //function : CreateAdding203Entities |
1405 | //purpose : create approval.. , date.. , time.. , person.. and |
1406 | // organization.. entities for analysis structure |
1407 | //======================================================================= |
1408 | |
1409 | Standard_Boolean StepAP209_Construct::CreateAdding203Entities |
1410 | (const Handle(StepBasic_ProductDefinition) &PD, |
1411 | Handle(StepData_StepModel) &aModel) const |
1412 | { |
1413 | Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model()); |
1414 | Handle(StepBasic_ProductDefinitionFormation) PDF = PD->Formation(); |
1415 | Handle(StepBasic_Product) Prod = PDF->OfProduct(); |
1416 | |
1417 | // create SecurityClassification |
1418 | Handle(StepBasic_SecurityClassification) SC; |
1419 | Interface_EntityIterator subs = Graph().Sharings(PDF); |
1420 | for (subs.Start(); subs.More() && SC.IsNull(); subs.Next()) { |
1421 | Handle(StepAP214_AppliedSecurityClassificationAssignment) ASCA = |
1422 | Handle(StepAP214_AppliedSecurityClassificationAssignment)::DownCast(subs.Value()); |
1423 | if(ASCA.IsNull()) continue; |
1424 | SC = ASCA->AssignedSecurityClassification(); |
1425 | } |
1426 | if(SC.IsNull()) { |
1427 | // create new |
1428 | Handle(StepBasic_SecurityClassificationLevel) SCL = new StepBasic_SecurityClassificationLevel; |
1429 | SCL->Init(new TCollection_HAsciiString("unclassified")); |
1430 | SC = new StepBasic_SecurityClassification; |
1431 | SC->Init(new TCollection_HAsciiString(""), new TCollection_HAsciiString(""), SCL); |
1432 | } |
1433 | aModel->AddWithRefs(SC); |
1434 | Handle(StepAP203_CcDesignSecurityClassification) DSC = |
1435 | new StepAP203_CcDesignSecurityClassification; |
1436 | Handle(StepAP203_HArray1OfClassifiedItem) HACI = new StepAP203_HArray1OfClassifiedItem(1,1); |
1437 | StepAP203_ClassifiedItem CI; |
1438 | CI.SetValue(PDF); |
1439 | HACI->SetValue(1,CI); |
1440 | DSC->Init(SC,HACI); |
1441 | aModel->AddWithRefs(DSC); |
1442 | |
1443 | // create CcDesignApproval |
1444 | Handle(StepBasic_DateAndTime) DT; |
1445 | subs = Graph().Sharings(PD); |
1446 | for (subs.Start(); subs.More(); subs.Next()) { |
1447 | Handle(StepAP214_AppliedApprovalAssignment) AAA = |
1448 | Handle(StepAP214_AppliedApprovalAssignment)::DownCast(subs.Value()); |
1449 | if(!AAA.IsNull()) { |
1450 | Handle(StepAP214_HArray1OfApprovalItem) HAAI214 = AAA->Items(); |
1451 | Handle(StepAP203_HArray1OfApprovedItem) HAAI = |
1452 | new StepAP203_HArray1OfApprovedItem(1,HAAI214->Length()); |
1453 | for(Standard_Integer i=1; i<=HAAI214->Length(); i++) { |
1454 | StepAP203_ApprovedItem AI; |
1455 | AI.SetValue(AAA->ItemsValue(i).Value()); |
1456 | HAAI->SetValue(i,AI); |
1457 | } |
1458 | Handle(StepAP203_CcDesignApproval) DA = new StepAP203_CcDesignApproval; |
1459 | DA->Init(AAA->AssignedApproval(),HAAI); |
1460 | aModel->AddWithRefs(DA); |
1461 | // find ApprovalDateTime for Approval |
1462 | Interface_EntityIterator subs2 = Graph().Sharings(AAA->AssignedApproval()); |
1463 | for (subs2.Start(); subs2.More(); subs2.Next()) { |
1464 | Handle(StepBasic_ApprovalDateTime) ADT = |
1465 | Handle(StepBasic_ApprovalDateTime)::DownCast(subs2.Value()); |
1466 | if(ADT.IsNull()) continue; |
1467 | aModel->AddWithRefs(ADT); |
1468 | Handle(StepBasic_DateAndTime) DT1 = |
1469 | Handle(StepBasic_DateAndTime)::DownCast(ADT->DateTime().Value()); |
1470 | if(DT1.IsNull()) continue; |
1471 | DT = DT1; |
1472 | } |
1473 | } |
1474 | } |
1475 | subs = Graph().Sharings(PDF); |
1476 | for (subs.Start(); subs.More(); subs.Next()) { |
1477 | Handle(StepAP214_AppliedApprovalAssignment) AAA = |
1478 | Handle(StepAP214_AppliedApprovalAssignment)::DownCast(subs.Value()); |
1479 | if(!AAA.IsNull()) { |
1480 | Handle(StepAP214_HArray1OfApprovalItem) HAAI214 = AAA->Items(); |
1481 | Handle(StepAP203_HArray1OfApprovedItem) HAAI = |
1482 | new StepAP203_HArray1OfApprovedItem(1,HAAI214->Length()); |
1483 | for(Standard_Integer i=1; i<=HAAI214->Length(); i++) { |
1484 | StepAP203_ApprovedItem AI; |
1485 | AI.SetValue(AAA->ItemsValue(i).Value()); |
1486 | HAAI->SetValue(i,AI); |
1487 | } |
1488 | Handle(StepAP203_CcDesignApproval) DA = new StepAP203_CcDesignApproval; |
1489 | DA->Init(AAA->AssignedApproval(),HAAI); |
1490 | aModel->AddWithRefs(DA); |
1491 | // find ApprovalDateTime for Approval |
1492 | Interface_EntityIterator subs2 = Graph().Sharings(AAA->AssignedApproval()); |
1493 | for (subs2.Start(); subs2.More(); subs2.Next()) { |
1494 | Handle(StepBasic_ApprovalDateTime) ADT = |
1495 | Handle(StepBasic_ApprovalDateTime)::DownCast(subs2.Value()); |
1496 | if(ADT.IsNull()) continue; |
1497 | aModel->AddWithRefs(ADT); |
1498 | Handle(StepBasic_DateAndTime) DT1 = |
1499 | Handle(StepBasic_DateAndTime)::DownCast(ADT->DateTime().Value()); |
1500 | if(DT1.IsNull()) continue; |
1501 | DT = DT1; |
1502 | } |
1503 | } |
1504 | } |
1505 | subs = Graph().Sharings(SC); |
1506 | for (subs.Start(); subs.More(); subs.Next()) { |
1507 | Handle(StepAP214_AppliedApprovalAssignment) AAA = |
1508 | Handle(StepAP214_AppliedApprovalAssignment)::DownCast(subs.Value()); |
1509 | if(!AAA.IsNull()) { |
1510 | Handle(StepAP214_HArray1OfApprovalItem) HAAI214 = AAA->Items(); |
1511 | Handle(StepAP203_HArray1OfApprovedItem) HAAI = |
1512 | new StepAP203_HArray1OfApprovedItem(1,HAAI214->Length()); |
1513 | for(Standard_Integer i=1; i<=HAAI214->Length(); i++) { |
1514 | StepAP203_ApprovedItem AI; |
1515 | AI.SetValue(AAA->ItemsValue(i).Value()); |
1516 | HAAI->SetValue(i,AI); |
1517 | } |
1518 | Handle(StepAP203_CcDesignApproval) DA = new StepAP203_CcDesignApproval; |
1519 | DA->Init(AAA->AssignedApproval(),HAAI); |
1520 | aModel->AddWithRefs(DA); |
1521 | // find ApprovalDateTime for Approval |
1522 | Interface_EntityIterator subs2 = Graph().Sharings(AAA->AssignedApproval()); |
1523 | for (subs2.Start(); subs2.More(); subs2.Next()) { |
1524 | Handle(StepBasic_ApprovalDateTime) ADT = |
1525 | Handle(StepBasic_ApprovalDateTime)::DownCast(subs2.Value()); |
1526 | if(ADT.IsNull()) continue; |
1527 | aModel->AddWithRefs(ADT); |
1528 | Handle(StepBasic_DateAndTime) DT1 = |
1529 | Handle(StepBasic_DateAndTime)::DownCast(ADT->DateTime().Value()); |
1530 | if(DT1.IsNull()) continue; |
1531 | DT = DT1; |
1532 | } |
1533 | } |
1534 | } |
1535 | |
1536 | if(aModel->Number(DT)>0) { |
1537 | // create CcDesignDateAndTimeAssignment |
1538 | subs = Graph().Sharings(DT); |
1539 | for (subs.Start(); subs.More(); subs.Next()) { |
1540 | Handle(StepAP214_AppliedDateAndTimeAssignment)ADTA = |
1541 | Handle(StepAP214_AppliedDateAndTimeAssignment)::DownCast(subs.Value()); |
1542 | if(ADTA.IsNull()) continue; |
1543 | Handle(StepAP214_HArray1OfDateAndTimeItem) HADTI214 = ADTA->Items(); |
1544 | Handle(StepAP203_HArray1OfDateTimeItem) HADTI = |
1545 | new StepAP203_HArray1OfDateTimeItem(1,HADTI214->Length()); |
1546 | for(Standard_Integer i=1; i<=HADTI214->Length(); i++) { |
1547 | StepAP203_DateTimeItem DTI; |
1548 | DTI.SetValue(ADTA->ItemsValue(i).Value()); |
1549 | HADTI->SetValue(i,DTI); |
1550 | } |
1551 | Handle(StepAP203_CcDesignDateAndTimeAssignment) DDTA = |
1552 | new StepAP203_CcDesignDateAndTimeAssignment; |
1553 | DDTA->Init(DT, ADTA->Role(), HADTI); |
1554 | aModel->AddWithRefs(DDTA); |
1555 | } |
1556 | } |
1557 | |
1558 | // create Person.. and Organization.. entities |
1559 | subs = Graph().Sharings(Prod); |
1560 | for (subs.Start(); subs.More(); subs.Next()) { |
1561 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment) APOA = |
1562 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment)::DownCast(subs.Value()); |
1563 | if(APOA.IsNull()) continue; |
1564 | Handle(StepAP214_HArray1OfPersonAndOrganizationItem) HAPOI214 = APOA->Items(); |
1565 | Handle(StepAP203_HArray1OfPersonOrganizationItem) HAPOI = |
1566 | new StepAP203_HArray1OfPersonOrganizationItem(1,HAPOI214->Length()); |
1567 | for(Standard_Integer i=1; i<=HAPOI214->Length(); i++) { |
1568 | StepAP203_PersonOrganizationItem POI; |
1569 | POI.SetValue(HAPOI214->Value(i).Value()); |
1570 | HAPOI->SetValue(i,POI); |
1571 | } |
1572 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) DPOA = |
1573 | new StepAP203_CcDesignPersonAndOrganizationAssignment; |
1574 | DPOA->Init(APOA->AssignedPersonAndOrganization(), APOA->Role(), HAPOI); |
1575 | aModel->AddWithRefs(DPOA); |
1576 | } |
1577 | subs = Graph().Sharings(PD); |
1578 | for (subs.Start(); subs.More(); subs.Next()) { |
1579 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment) APOA = |
1580 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment)::DownCast(subs.Value()); |
1581 | if(APOA.IsNull()) continue; |
1582 | Handle(StepAP214_HArray1OfPersonAndOrganizationItem) HAPOI214 = APOA->Items(); |
1583 | Handle(StepAP203_HArray1OfPersonOrganizationItem) HAPOI = |
1584 | new StepAP203_HArray1OfPersonOrganizationItem(1,HAPOI214->Length()); |
1585 | for(Standard_Integer i=1; i<=HAPOI214->Length(); i++) { |
1586 | StepAP203_PersonOrganizationItem POI; |
1587 | POI.SetValue(HAPOI214->Value(i).Value()); |
1588 | HAPOI->SetValue(i,POI); |
1589 | } |
1590 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) DPOA = |
1591 | new StepAP203_CcDesignPersonAndOrganizationAssignment; |
1592 | DPOA->Init(APOA->AssignedPersonAndOrganization(), APOA->Role(), HAPOI); |
1593 | aModel->AddWithRefs(DPOA); |
1594 | } |
1595 | subs = Graph().Sharings(PDF); |
1596 | for (subs.Start(); subs.More(); subs.Next()) { |
1597 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment) APOA = |
1598 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment)::DownCast(subs.Value()); |
1599 | if(APOA.IsNull()) continue; |
1600 | Handle(StepAP214_HArray1OfPersonAndOrganizationItem) HAPOI214 = APOA->Items(); |
1601 | Handle(StepAP203_HArray1OfPersonOrganizationItem) HAPOI = |
1602 | new StepAP203_HArray1OfPersonOrganizationItem(1,HAPOI214->Length()); |
1603 | for(Standard_Integer i=1; i<=HAPOI214->Length(); i++) { |
1604 | StepAP203_PersonOrganizationItem POI; |
1605 | POI.SetValue(HAPOI214->Value(i).Value()); |
1606 | HAPOI->SetValue(i,POI); |
1607 | } |
1608 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) DPOA = |
1609 | new StepAP203_CcDesignPersonAndOrganizationAssignment; |
1610 | DPOA->Init(APOA->AssignedPersonAndOrganization(), APOA->Role(), HAPOI); |
1611 | aModel->AddWithRefs(DPOA); |
1612 | } |
1613 | subs = Graph().Sharings(SC); |
1614 | for (subs.Start(); subs.More(); subs.Next()) { |
1615 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment) APOA = |
1616 | Handle(StepAP214_AppliedPersonAndOrganizationAssignment)::DownCast(subs.Value()); |
1617 | if(APOA.IsNull()) continue; |
1618 | Handle(StepAP214_HArray1OfPersonAndOrganizationItem) HAPOI214 = APOA->Items(); |
1619 | Handle(StepAP203_HArray1OfPersonOrganizationItem) HAPOI = |
1620 | new StepAP203_HArray1OfPersonOrganizationItem(1,HAPOI214->Length()); |
1621 | for(Standard_Integer i=1; i<=HAPOI214->Length(); i++) { |
1622 | StepAP203_PersonOrganizationItem POI; |
1623 | POI.SetValue(HAPOI214->Value(i).Value()); |
1624 | HAPOI->SetValue(i,POI); |
1625 | } |
1626 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) DPOA = |
1627 | new StepAP203_CcDesignPersonAndOrganizationAssignment; |
1628 | DPOA->Init(APOA->AssignedPersonAndOrganization(), APOA->Role(), HAPOI); |
1629 | aModel->AddWithRefs(DPOA); |
1630 | } |
1631 | |
1632 | return Standard_True; |
1633 | } |
1634 | |