b311480e |
1 | // Created on: 2000-09-29 |
2 | // Created by: Andrey BETENEV |
973c2be1 |
3 | // Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
7fd59977 |
16 | |
17 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
18 | #include <StepAP203_ApprovedItem.hxx> |
19 | #include <StepAP203_CcDesignApproval.hxx> |
20 | #include <StepAP203_CcDesignDateAndTimeAssignment.hxx> |
21 | #include <StepAP203_CcDesignPersonAndOrganizationAssignment.hxx> |
22 | #include <StepAP203_DateTimeItem.hxx> |
23 | #include <StepAP203_HArray1OfApprovedItem.hxx> |
24 | #include <StepAP203_HArray1OfDateTimeItem.hxx> |
25 | #include <StepAP203_HArray1OfPersonOrganizationItem.hxx> |
26 | #include <StepAP203_PersonOrganizationItem.hxx> |
7fd59977 |
27 | #include <StepAP214_AppliedDocumentReference.hxx> |
28 | #include <StepAP214_AppliedExternalIdentificationAssignment.hxx> |
29 | #include <StepAP214_ExternalIdentificationItem.hxx> |
7fd59977 |
30 | #include <StepAP214_HArray1OfDocumentReferenceItem.hxx> |
42cf5bc1 |
31 | #include <StepAP214_HArray1OfExternalIdentificationItem.hxx> |
7fd59977 |
32 | #include <StepBasic_ApplicationContext.hxx> |
42cf5bc1 |
33 | #include <StepBasic_ApplicationProtocolDefinition.hxx> |
34 | #include <StepBasic_Document.hxx> |
35 | #include <StepBasic_DocumentFile.hxx> |
7fd59977 |
36 | #include <StepBasic_DocumentProductEquivalence.hxx> |
42cf5bc1 |
37 | #include <StepBasic_DocumentRepresentationType.hxx> |
7fd59977 |
38 | #include <StepBasic_DocumentType.hxx> |
42cf5bc1 |
39 | #include <StepBasic_ExternalSource.hxx> |
40 | #include <StepBasic_HArray1OfDocument.hxx> |
7fd59977 |
41 | #include <StepBasic_HArray1OfProduct.hxx> |
42cf5bc1 |
42 | #include <StepBasic_HArray1OfProductContext.hxx> |
43 | #include <StepBasic_IdentificationRole.hxx> |
44 | #include <StepBasic_ObjectRole.hxx> |
45 | #include <StepBasic_Product.hxx> |
46 | #include <StepBasic_ProductContext.hxx> |
47 | #include <StepBasic_ProductDefinition.hxx> |
48 | #include <StepBasic_ProductDefinitionContext.hxx> |
49 | #include <StepBasic_ProductDefinitionFormation.hxx> |
50 | #include <StepBasic_ProductDefinitionWithAssociatedDocuments.hxx> |
7fd59977 |
51 | #include <StepBasic_ProductOrFormationOrDefinition.hxx> |
52 | #include <StepBasic_ProductRelatedProductCategory.hxx> |
42cf5bc1 |
53 | #include <StepBasic_RoleAssociation.hxx> |
54 | #include <StepBasic_SourceItem.hxx> |
55 | #include <STEPConstruct_ExternRefs.hxx> |
56 | #include <StepData_SelectNamed.hxx> |
57 | #include <StepRepr_CharacterizedDefinition.hxx> |
58 | #include <StepRepr_DescriptiveRepresentationItem.hxx> |
59 | #include <StepRepr_HArray1OfRepresentationItem.hxx> |
60 | #include <StepRepr_NextAssemblyUsageOccurrence.hxx> |
61 | #include <StepRepr_ProductDefinitionShape.hxx> |
62 | #include <StepRepr_PropertyDefinition.hxx> |
63 | #include <StepRepr_PropertyDefinitionRepresentation.hxx> |
64 | #include <StepRepr_RepresentationContext.hxx> |
65 | #include <StepRepr_RepresentedDefinition.hxx> |
66 | #include <StepShape_ShapeRepresentation.hxx> |
67 | #include <TCollection_HAsciiString.hxx> |
68 | #include <XSControl_WorkSession.hxx> |
7fd59977 |
69 | |
70 | //======================================================================= |
71 | //function : STEPConstruct_ExternRefs |
72 | //purpose : |
73 | //======================================================================= |
7fd59977 |
74 | STEPConstruct_ExternRefs::STEPConstruct_ExternRefs () |
75 | { |
76 | } |
77 | |
78 | //======================================================================= |
79 | //function : STEPConstruct_ExternRefs |
80 | //purpose : |
81 | //======================================================================= |
82 | |
83 | STEPConstruct_ExternRefs::STEPConstruct_ExternRefs (const Handle(XSControl_WorkSession) &WS) |
84 | : STEPConstruct_Tool ( WS ) |
85 | { |
86 | } |
87 | |
88 | //======================================================================= |
89 | //function : Init |
90 | //purpose : |
91 | //======================================================================= |
92 | |
93 | Standard_Boolean STEPConstruct_ExternRefs::Init (const Handle(XSControl_WorkSession) &WS) |
94 | { |
95 | Clear(); |
96 | return SetWS ( WS ); |
97 | } |
98 | |
99 | //======================================================================= |
100 | //function : Clear |
101 | //purpose : |
102 | //======================================================================= |
103 | |
104 | void STEPConstruct_ExternRefs::Clear () |
105 | { |
106 | myAEIAs.Clear(); |
107 | myRoles.Clear(); |
108 | myFormats.Clear(); |
109 | myShapes.Clear(); |
110 | myTypes.Clear(); |
111 | myIsAP214.Clear(); |
112 | // PTV 30.01.2003 TRJ11 |
113 | myDocFiles.Clear(); |
114 | mySharedPRPC.Nullify(); |
115 | mySharedDocType.Nullify(); |
116 | mySharedPDC.Nullify(); |
117 | mySharedPC.Nullify(); |
118 | myAPD.Nullify(); |
119 | } |
120 | |
121 | //======================================================================= |
122 | //function : LoadExternRefs |
123 | //purpose : |
124 | //======================================================================= |
125 | |
126 | static Standard_Boolean findPDWADandExcludeExcess (Handle(StepAP214_AppliedDocumentReference)& ADR, |
127 | TColStd_SequenceOfTransient& aSeqOfPDWAD, |
128 | const Interface_Graph& Graph, |
129 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)& aPDWAD) |
130 | { |
131 | // WARNING! do not add check for aSeqOfPDWAD.Length() and exit if it < 1, |
132 | // because this methods invokes with an empty sequence too to find PDWAD by ADR |
133 | Interface_EntityIterator subsADR = Graph.Shareds(ADR); |
134 | for ( subsADR.Start(); subsADR.More(); subsADR.Next() ) { |
135 | if ( !subsADR.Value()->IsKind (STANDARD_TYPE(StepBasic_Document)) ) |
136 | continue; |
137 | Handle(StepBasic_Document) aDoc = Handle(StepBasic_Document)::DownCast(subsADR.Value()); |
138 | // looking for Document Product Equivalence |
139 | Interface_EntityIterator subsD = Graph.Sharings(aDoc); |
140 | for ( subsD.Start(); subsD.More(); subsD.Next() ) { |
141 | if ( !subsD.Value()->IsKind (STANDARD_TYPE(StepBasic_DocumentProductEquivalence)) ) |
142 | continue; |
143 | Handle(StepBasic_DocumentProductEquivalence) aDPE = |
144 | Handle(StepBasic_DocumentProductEquivalence)::DownCast(subsD.Value()); |
145 | // take PDF and search the same PDF by PDWAD chain |
146 | Interface_EntityIterator subsDPE = Graph.Shareds(aDPE); |
147 | for ( subsDPE.Start(); subsDPE.More(); subsDPE.Next() ) { |
148 | if ( !subsDPE.Value()->IsKind (STANDARD_TYPE(StepBasic_ProductDefinitionFormation)) ) |
149 | continue; |
150 | Handle(StepBasic_ProductDefinitionFormation) aPDF = |
151 | Handle(StepBasic_ProductDefinitionFormation)::DownCast(subsDPE.Value()); |
152 | Interface_EntityIterator subs = Graph.Sharings(aPDF); |
153 | for ( subs.Start(); subs.More(); subs.Next() ) { |
154 | if ( !subs.Value()->IsKind (STANDARD_TYPE(StepBasic_ProductDefinitionWithAssociatedDocuments)) ) |
155 | continue; |
156 | aPDWAD = Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)::DownCast(subs.Value()); |
157 | } |
158 | // now searching for PDWAD that refer to the same PDF |
159 | for (Standard_Integer pdwadi = 1; pdwadi <= aSeqOfPDWAD.Length(); pdwadi++) { |
160 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) aCurPDWAD = |
161 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)::DownCast(aSeqOfPDWAD(pdwadi)); |
162 | if ( !aCurPDWAD.IsNull() && aPDWAD == aCurPDWAD ) { |
163 | // found the same Product Definition Formation |
164 | aSeqOfPDWAD.Remove( pdwadi ); |
165 | return Standard_True; |
166 | } |
167 | } |
168 | } // end of looking for PDF by ADR chain |
169 | } // end of looking for DPE |
170 | } // end iterations on Shareds(ADR) |
171 | return Standard_False; |
172 | } |
173 | |
174 | |
175 | Standard_Boolean STEPConstruct_ExternRefs::LoadExternRefs () |
176 | { |
177 | // iterate on entities in the model and find AEIAs |
178 | // or PDWADs (for AP203) |
179 | Handle(Interface_InterfaceModel) model = Model(); |
180 | Handle(Standard_Type) tADR = STANDARD_TYPE(StepAP214_AppliedDocumentReference); |
181 | Handle(Standard_Type) tPDWAD = STANDARD_TYPE(StepBasic_ProductDefinitionWithAssociatedDocuments); |
182 | Standard_Integer nb = model->NbEntities(); |
183 | |
184 | // PTV 28.01.2003 CAX-IF TRJ11, file ext_ref_master.stp |
185 | // search all ADR and PDWAD and exclude excess PDWADs |
186 | TColStd_SequenceOfTransient aSeqOfADR, aSeqOfPDWAD; |
187 | for (Standard_Integer ient = 1; ient <= nb; ient ++) { |
188 | Handle(Standard_Transient) enti = model->Value(ient); |
189 | if ( enti->DynamicType() == tPDWAD ) |
190 | aSeqOfPDWAD.Append( enti ); |
191 | else if ( enti->DynamicType() == tADR ) |
192 | aSeqOfADR.Append( enti ); |
193 | } |
194 | Standard_Integer IsAP214 = 0; |
195 | // run on sequence aSeqOfADR of ADR and remove excess PDWAD from aSeqOfPDWAD |
196 | for (Standard_Integer adri = 1; adri <= aSeqOfADR.Length(); adri++) { |
197 | Handle(StepAP214_AppliedDocumentReference) ADR = |
198 | Handle(StepAP214_AppliedDocumentReference)::DownCast(aSeqOfADR.Value(adri)); |
199 | // looking for Product Definition Formation and exlude excess PDWAD from aSeqOfPDWAD |
200 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) aPDWAD; |
201 | findPDWADandExcludeExcess( ADR, aSeqOfPDWAD, Graph(), aPDWAD ); |
202 | |
203 | // now add all necessary information as original implementation. |
204 | IsAP214 = 1; |
205 | Handle(StepBasic_RoleAssociation) Role; |
206 | Handle(StepBasic_ProductDefinition) Shape; |
207 | Handle(StepRepr_PropertyDefinitionRepresentation) Format; |
208 | Handle(StepBasic_DocumentRepresentationType) Type; |
209 | // AppliedDocumentReference with RoleAssociation... |
210 | Interface_EntityIterator subs4 = Graph().Sharings(ADR); |
211 | for (subs4.Start(); subs4.More(); subs4.Next()) { |
212 | if ( subs4.Value()->IsKind ( STANDARD_TYPE(StepBasic_RoleAssociation) ) ) |
213 | Role = Handle(StepBasic_RoleAssociation)::DownCast(subs4.Value()); |
214 | } |
215 | |
216 | subs4 = Graph().Shareds(ADR); |
217 | for (subs4.Start(); subs4.More(); subs4.Next()) { |
218 | if ( subs4.Value()->IsKind ( STANDARD_TYPE(StepBasic_ProductDefinition) ) ) |
219 | Shape = Handle(StepBasic_ProductDefinition)::DownCast(subs4.Value()); |
220 | } |
221 | // search for Document file |
222 | Handle(StepBasic_DocumentFile) DocFile; |
223 | if ( aPDWAD.IsNull() ) { // shoudnot be begin from TRJ11 |
7fd59977 |
224 | // lookinf from ADR |
225 | subs4 = Graph().Shareds(ADR); |
226 | } else |
227 | // looking from PDWAD |
228 | subs4 = Graph().Shareds(aPDWAD); |
229 | |
230 | for (subs4.Start(); subs4.More(); subs4.Next()) { |
231 | if ( !subs4.Value()->IsKind ( STANDARD_TYPE(StepBasic_DocumentFile) ) ) |
232 | continue; |
233 | DocFile = Handle(StepBasic_DocumentFile)::DownCast(subs4.Value()); |
234 | if ( DocFile.IsNull() ) |
235 | continue; |
236 | // for each DocumentFile, find associated with it data: |
237 | Interface_EntityIterator subs = Graph().Sharings(DocFile); |
238 | for (subs.Start(); subs.More(); subs.Next()) { |
239 | Handle(Standard_Transient) sub = subs.Value(); |
240 | |
241 | // FORMAT - ??????? |
242 | // |
243 | // PDRs of a shape and of a file format |
244 | if ( sub->IsKind ( STANDARD_TYPE(StepRepr_PropertyDefinition) ) ) { |
245 | Handle(StepRepr_PropertyDefinition) PD = Handle(StepRepr_PropertyDefinition)::DownCast(sub); |
246 | Interface_EntityIterator subs2 = Graph().Sharings(PD); |
247 | for (subs2.Start(); subs2.More(); subs2.Next()) { |
248 | Handle(StepRepr_PropertyDefinitionRepresentation) PDR = |
249 | Handle(StepRepr_PropertyDefinitionRepresentation)::DownCast(subs2.Value()); |
250 | if ( PDR.IsNull() ) continue; |
251 | if ( PDR->UsedRepresentation()->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation)) ) |
252 | Format = PDR; |
253 | } |
254 | } |
255 | // DocumentRepresentationType |
256 | if ( sub->IsKind ( STANDARD_TYPE(StepBasic_DocumentRepresentationType) ) ) { |
257 | Type = Handle(StepBasic_DocumentRepresentationType)::DownCast(sub); |
258 | } |
259 | if ( !Type.IsNull() && !Format.IsNull() ) |
260 | break; |
261 | } |
262 | if ( !Type.IsNull() && !Format.IsNull() ) |
263 | break; |
264 | } |
265 | if ( DocFile.IsNull() ) |
266 | continue; |
267 | myAEIAs.Append ( ADR ); |
268 | myRoles.Append ( Role ); |
269 | myFormats.Append ( Format ); |
270 | myShapes.Append ( Shape ); |
271 | myTypes.Append ( Type ); |
272 | myIsAP214.Append ( IsAP214 ); |
273 | myDocFiles.Append( DocFile ); |
274 | } // end iterations on aSeqOfADR |
275 | |
276 | // now iterates on sequence aSeqOfPDWAD of Product Definition With Associated Documents |
277 | for (Standard_Integer pdwadi = 1; pdwadi <= aSeqOfPDWAD.Length(); pdwadi++) { |
278 | IsAP214 = 0; |
279 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) aPDWAD = |
280 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)::DownCast(aSeqOfPDWAD(pdwadi)); |
281 | myShapes.Append(aPDWAD); |
282 | myIsAP214.Append ( IsAP214 ); |
283 | Handle(StepAP214_AppliedExternalIdentificationAssignment) AEIA; |
284 | Handle(StepBasic_RoleAssociation) Role; |
285 | Handle(StepRepr_PropertyDefinitionRepresentation) Format; |
286 | Handle(StepBasic_DocumentRepresentationType) Type; |
287 | Handle(StepBasic_DocumentFile) DocFile; |
288 | myAEIAs.Append ( AEIA ); |
289 | myRoles.Append ( Role ); |
290 | myFormats.Append ( Format ); |
291 | myTypes.Append ( Type ); |
292 | myDocFiles.Append( DocFile ); |
293 | } |
294 | |
295 | return myShapes.Length() >0; |
296 | } |
297 | |
298 | //======================================================================= |
299 | //function : NbExternRefs |
300 | //purpose : |
301 | //======================================================================= |
302 | |
303 | Standard_Integer STEPConstruct_ExternRefs::NbExternRefs () const |
304 | { |
305 | return myShapes.Length(); |
306 | } |
307 | |
308 | //======================================================================= |
309 | //function : FileName |
310 | //purpose : |
311 | //======================================================================= |
312 | |
487bf1ce |
313 | Standard_CString STEPConstruct_ExternRefs::FileName (const Standard_Integer num) const |
7fd59977 |
314 | { |
315 | Handle(StepBasic_DocumentFile) DocFile; |
316 | Handle(StepAP214_AppliedExternalIdentificationAssignment) AEIA; |
317 | Standard_CString aCStringFileName = 0; |
318 | if ( myDocFiles.Length() >= num && !myDocFiles.Value(num).IsNull() ) |
319 | DocFile = Handle(StepBasic_DocumentFile)::DownCast(myDocFiles.Value( num )); |
320 | else if (myIsAP214(num)==1) |
321 | { |
322 | Handle(StepAP214_AppliedDocumentReference) ADR = |
323 | Handle(StepAP214_AppliedDocumentReference)::DownCast ( myAEIAs(num) ); |
324 | |
325 | // PTV 28.01.2003 CAX-IF TRJ11, file ext_ref_master.stp |
326 | // serach document file name by long chain ADR->D<-DPE->PDF<-PDWAD->DF |
327 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) aPDWAD; |
328 | // create an empty aSeqOfPDWAD |
329 | TColStd_SequenceOfTransient aSeqOfPDWAD; |
330 | // we do not need to exclude, just find PDWAD |
331 | findPDWADandExcludeExcess( ADR, aSeqOfPDWAD, Graph(), aPDWAD ); |
332 | |
333 | // search for Document file |
334 | Interface_EntityIterator subs4; |
335 | if ( aPDWAD.IsNull() ) { // shoudnot be begin from TRJ11 |
7fd59977 |
336 | // lookinf from ADR |
337 | subs4 = Graph().Shareds(ADR); |
338 | } else |
339 | // looking from PDWAD |
340 | subs4 = Graph().Shareds(aPDWAD); |
341 | for (subs4.Start(); subs4.More(); subs4.Next()) { |
342 | if ( !subs4.Value()->IsKind ( STANDARD_TYPE(StepBasic_DocumentFile) ) ) |
343 | continue; |
344 | DocFile = Handle(StepBasic_DocumentFile)::DownCast(subs4.Value()); |
345 | if ( DocFile.IsNull() ) continue; |
346 | } |
347 | } |
348 | else { |
349 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) aPDWAD = |
350 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)::DownCast(myShapes(num)); |
351 | if ( aPDWAD.IsNull() || aPDWAD->DocIds().IsNull() ) |
352 | return ""; |
353 | Standard_Integer i; |
354 | for ( i=1; i <= aPDWAD->NbDocIds(); i++ ) { |
355 | Handle(StepBasic_Document) Doc = aPDWAD->DocIdsValue(i); |
356 | Handle(TCollection_HAsciiString) aFilename = Doc->Name(); |
357 | if (!aFilename.IsNull() && !aFilename->IsEmpty()) return aFilename->ToCString(); |
358 | } |
359 | return ""; |
360 | } |
361 | // take name from AEIA and from DF |
362 | if(!DocFile.IsNull()) { |
363 | Interface_EntityIterator subs3 = Graph().Sharings(DocFile); |
364 | for (subs3.Start(); subs3.More(); subs3.Next()) { |
365 | if (subs3.Value()->IsKind(STANDARD_TYPE(StepAP214_AppliedExternalIdentificationAssignment))) { |
366 | AEIA = Handle(StepAP214_AppliedExternalIdentificationAssignment)::DownCast(subs3.Value()); |
367 | if (!AEIA.IsNull()) |
368 | break; |
369 | } |
370 | } |
371 | } |
372 | if(!AEIA.IsNull()) { |
373 | Handle(TCollection_HAsciiString) aFilename; |
374 | aFilename = AEIA->AssignedId(); |
375 | if (!aFilename.IsNull() && !aFilename->IsEmpty()) { |
376 | aCStringFileName = aFilename->ToCString(); |
377 | // ptv 29.01.2003 file trj4_xr1-tc-214.stp entity #71 have id "#71" |
378 | if ( aCStringFileName && aCStringFileName[0] == '#') |
379 | aCStringFileName = 0; |
380 | } |
381 | if ( ! aCStringFileName || ! aCStringFileName[0] ) { |
382 | // try to take name from external source |
383 | Handle(StepBasic_ExternalSource) theSource = AEIA->Source(); |
384 | if (!theSource.IsNull()) { |
385 | StepBasic_SourceItem theSourceId = theSource->SourceId(); |
386 | if (!theSourceId.IsNull()) { |
387 | Handle(StepData_SelectNamed) theFileName; |
388 | theFileName = Handle(StepData_SelectNamed)::DownCast (theSourceId.Value()); |
389 | if (theFileName.IsNull() || theFileName->Kind()!=6 ) { |
390 | // nothing to do, hope could take name later. |
391 | } |
392 | else |
393 | aCStringFileName = theFileName->String(); |
394 | } |
395 | } |
396 | } |
397 | } |
398 | if ( ! aCStringFileName || ! aCStringFileName[0] ) { |
399 | // try to find name direct from DocFile |
400 | if ( !DocFile.IsNull() ) { |
401 | Handle(TCollection_HAsciiString) aFilename = DocFile->Id(); |
402 | if (!aFilename.IsNull() && !aFilename->IsEmpty()) |
403 | aCStringFileName = aFilename->ToCString(); |
404 | if ( ! aCStringFileName || ! aCStringFileName[0] ) { |
405 | aFilename = DocFile->Name(); |
406 | if (!aFilename.IsNull() && !aFilename->IsEmpty()) |
407 | aCStringFileName = aFilename->ToCString(); |
408 | } |
409 | if ( ! aCStringFileName || ! aCStringFileName[0] ) { |
410 | return ""; |
411 | } |
412 | else |
413 | return aCStringFileName; |
414 | } |
415 | } |
416 | return aCStringFileName; |
417 | } |
418 | |
419 | //======================================================================= |
420 | //function : ProdDef |
421 | //purpose : |
422 | //======================================================================= |
423 | |
424 | Handle(StepBasic_ProductDefinition) STEPConstruct_ExternRefs::ProdDef (const Standard_Integer num) const |
425 | { |
426 | return Handle(StepBasic_ProductDefinition)::DownCast( myShapes(num) ); |
427 | } |
428 | |
429 | //======================================================================= |
430 | //function : Format |
431 | //purpose : |
432 | //======================================================================= |
433 | |
434 | Handle(TCollection_HAsciiString) STEPConstruct_ExternRefs::Format (const Standard_Integer num) const |
435 | { |
436 | Handle(TCollection_HAsciiString) Format; |
437 | |
438 | if (myIsAP214(num)==0) return Format; |
439 | |
440 | Handle(StepRepr_PropertyDefinitionRepresentation) PDR = |
441 | Handle(StepRepr_PropertyDefinitionRepresentation)::DownCast ( myFormats(num) ); |
442 | if (PDR.IsNull()) return Format; |
443 | |
444 | Handle(StepRepr_Representation) rep = PDR->UsedRepresentation(); |
445 | for ( Standard_Integer i=1; i <= rep->NbItems(); i++ ) { |
446 | if ( rep->ItemsValue(i)->IsKind ( STANDARD_TYPE(StepRepr_DescriptiveRepresentationItem) ) ) { |
447 | Handle(StepRepr_DescriptiveRepresentationItem) DRI = |
448 | Handle(StepRepr_DescriptiveRepresentationItem)::DownCast ( rep->ItemsValue(i) ); |
449 | Format = DRI->Description(); |
450 | break; |
451 | } |
452 | } |
453 | |
454 | return Format; |
455 | } |
456 | |
457 | //======================================================================= |
458 | //function : AddExternRef |
459 | //purpose : |
460 | //======================================================================= |
461 | |
462 | Standard_Integer STEPConstruct_ExternRefs::AddExternRef (const Standard_CString filename, |
463 | const Handle(StepBasic_ProductDefinition) &PD, |
464 | const Standard_CString format) |
465 | { |
466 | Handle(TCollection_HAsciiString) EmptyString = new TCollection_HAsciiString(""); |
467 | Handle(TCollection_HAsciiString) fmt = new TCollection_HAsciiString(format); |
468 | Handle(TCollection_HAsciiString) tmp = new TCollection_HAsciiString("203"); |
469 | Standard_Integer np = fmt->Location(tmp,1,fmt->Length()); |
470 | |
471 | // if( !(fmt==tmp) ) { |
472 | if( !(np>0) ) { |
473 | |
474 | // create core entity DocumentFile |
475 | Handle(StepBasic_DocumentType) DT = new StepBasic_DocumentType; |
476 | DT->Init(EmptyString); |
477 | Handle(TCollection_HAsciiString) DFid = new TCollection_HAsciiString(filename); |
478 | // PTV 30.01.2003 TRJ11 - copy external filename as is |
479 | // DFid->AssignCat ( " file id" ); |
480 | Handle(StepBasic_DocumentFile) DF = new StepBasic_DocumentFile; |
481 | DF->Init(DFid, EmptyString, Standard_False, EmptyString, DT, EmptyString, Standard_False, EmptyString); |
482 | |
483 | // create AppliedExternalIdentificationAssignment et al |
484 | Handle(StepBasic_IdentificationRole) IR = new StepBasic_IdentificationRole; |
485 | // PTV 30.01.2003 TRJ11 |
486 | // - set the ("external document id and location", $) without unmeaning description |
487 | Handle(TCollection_HAsciiString) aName = |
488 | new TCollection_HAsciiString("external document id and location"); |
489 | IR->SetName( aName ); |
490 | // Handle(TCollection_HAsciiString) aIRdescr = new TCollection_HAsciiString("source system"); |
491 | // IR->Init(aName, Standard_True, aIRdescr); |
492 | |
493 | Handle(StepData_SelectNamed) SDS = new StepData_SelectNamed; |
494 | SDS->SetString ( filename ); |
495 | SDS->SetName("IDENTIFIER"); |
496 | StepBasic_SourceItem SID; |
497 | SID.SetValue(SDS); |
498 | Handle(StepBasic_ExternalSource) ES = new StepBasic_ExternalSource; |
499 | ES->Init(SID); |
500 | |
501 | StepAP214_ExternalIdentificationItem Item; |
502 | Item.SetValue(DF); |
503 | Handle(StepAP214_HArray1OfExternalIdentificationItem) Items = |
504 | new StepAP214_HArray1OfExternalIdentificationItem(1,1); |
505 | Items->SetValue(1, Item); |
506 | |
507 | Handle(StepAP214_AppliedExternalIdentificationAssignment) ExtIdent = |
508 | new StepAP214_AppliedExternalIdentificationAssignment; |
509 | // ExtIdent->Init(EmptyString, IR, ES, Items); |
510 | // PTV 30.01.2003 TRJ11 - store filename in AEIA |
511 | Handle(TCollection_HAsciiString) aFName = new TCollection_HAsciiString(filename); |
512 | ExtIdent->Init(aFName, IR, ES, Items); |
513 | // create DocumentRepresentationType |
514 | Handle(TCollection_HAsciiString) Dig = new TCollection_HAsciiString("digital"); |
515 | Handle(StepBasic_DocumentRepresentationType) Type = new StepBasic_DocumentRepresentationType; |
516 | Type->Init(Dig, DF); |
517 | |
518 | // create AppliedDocumentReference, |
519 | Handle(StepAP214_AppliedDocumentReference) ADR = new StepAP214_AppliedDocumentReference; |
520 | // PTV 30.01.2003 TRJ11 - create additional entities for AP214 |
521 | addAP214ExterRef( ADR, PD, DF, filename ); |
522 | |
523 | // create RoleAssociation etc. |
524 | Handle(StepBasic_ObjectRole) OR = new StepBasic_ObjectRole; |
525 | Handle(TCollection_HAsciiString) mandatory = new TCollection_HAsciiString("mandatory"); |
526 | OR->Init(mandatory, Standard_False, EmptyString); |
527 | StepBasic_RoleSelect RS; |
528 | RS.SetValue(ADR); |
529 | Handle(StepBasic_RoleAssociation) Role = new StepBasic_RoleAssociation; |
530 | Role->Init(OR, RS); |
531 | |
532 | // create PDR for association with SR |
533 | StepRepr_CharacterizedDefinition CD; |
534 | CD.SetValue(DF); |
535 | Handle(TCollection_HAsciiString) PDname = new TCollection_HAsciiString("external definition"); |
536 | Handle(StepRepr_PropertyDefinition) PropD = new StepRepr_PropertyDefinition; |
537 | PropD->Init(PDname, Standard_True, EmptyString, CD); |
538 | StepRepr_RepresentedDefinition RD; |
539 | RD.SetValue(PropD); |
540 | // Handle(StepRepr_PropertyDefinitionRepresentation) PDRshape = new StepRepr_PropertyDefinitionRepresentation; |
541 | // PDRshape->Init ( RD, SDR->UsedRepresentation() ); |
542 | |
543 | // create PDR for definition of document format (if defined) |
544 | Handle(StepRepr_PropertyDefinitionRepresentation) PDRformat; |
545 | if ( format && format[0] ) { |
546 | |
547 | Handle(TCollection_HAsciiString) RCftype = new TCollection_HAsciiString ( "document parameters" ); |
548 | Handle(StepRepr_RepresentationContext) RCf = new StepRepr_RepresentationContext; |
549 | RCf->Init ( EmptyString, RCftype ); |
550 | |
551 | Handle(TCollection_HAsciiString) DRIname = new TCollection_HAsciiString ( "data format" ); |
552 | Handle(TCollection_HAsciiString) DRIdscr = new TCollection_HAsciiString ( format ); |
553 | Handle(StepRepr_DescriptiveRepresentationItem) DRI = new StepRepr_DescriptiveRepresentationItem; |
554 | DRI->Init ( DRIname, DRIdscr ); |
555 | Handle(StepRepr_HArray1OfRepresentationItem) fItems = new StepRepr_HArray1OfRepresentationItem(1,1); |
556 | fItems->SetValue ( 1, DRI ); |
557 | |
558 | Handle(TCollection_HAsciiString) SRfname = new TCollection_HAsciiString ( "document format" ); |
559 | Handle(StepRepr_Representation) SRformat = new StepRepr_Representation; |
560 | SRformat->Init(SRfname, fItems, RCf); |
561 | |
562 | StepRepr_CharacterizedDefinition CDf; |
563 | CDf.SetValue(DF); |
564 | Handle(TCollection_HAsciiString) PDfname = new TCollection_HAsciiString("document property"); |
565 | Handle(StepRepr_PropertyDefinition) PDf = new StepRepr_PropertyDefinition; |
566 | PDf->Init(PDfname, Standard_True, EmptyString, CDf); |
567 | StepRepr_RepresentedDefinition RDf; |
568 | RDf.SetValue(PDf); |
569 | |
570 | PDRformat = new StepRepr_PropertyDefinitionRepresentation; |
571 | PDRformat->Init ( RDf, SRformat ); |
572 | } |
573 | |
574 | // add all the created root entities to sequences |
575 | myAEIAs.Append ( ExtIdent ); //StepAP214_AppliedExternalIdentificationAssignment |
576 | myRoles.Append ( Role ); //StepBasic_RoleAssociation |
577 | myFormats.Append ( PDRformat ); //StepRepr_PropertyDefinitionRepresentation |
578 | // myShapes.Append ( PDRshape ); //StepRepr_PropertyDefinitionRepresentation |
579 | myShapes.Append ( PD ); //StepBasic_ProductDefinition |
580 | myTypes.Append ( Type ); //StepBasic_DocumentRepresentationType |
581 | |
582 | } |
583 | |
584 | else { // format=="AP203" |
585 | |
586 | // StepRepr_RepresentedDefinition aRD = SDR->Definition(); |
587 | // Handle(StepRepr_PropertyDefinition) aPD = aRD.PropertyDefinition(); |
588 | // StepRepr_CharacterizedDefinition aCD = aPD->Definition(); |
589 | // Handle(StepBasic_ProductDefinition) aProdDef = aCD.ProductDefinition(); |
590 | Handle(StepBasic_ProductDefinitionFormation) ProdDefForm = PD->Formation(); |
591 | Handle(StepBasic_ProductDefinitionContext) ProdDefCont = PD->FrameOfReference(); |
592 | |
593 | // create document |
594 | Handle(TCollection_HAsciiString) fname = new TCollection_HAsciiString(filename); |
595 | Handle(StepBasic_DocumentType) aDocType = new StepBasic_DocumentType; |
596 | Handle(TCollection_HAsciiString) aDT = new TCollection_HAsciiString("cad_filename"); |
597 | aDocType->Init(aDT); |
598 | Handle(StepBasic_Document) aDoc = new StepBasic_Document; |
599 | Handle(TCollection_HAsciiString) aDescription = |
600 | new TCollection_HAsciiString("CAD Model associated to the part"); |
601 | aDoc->Init(EmptyString,fname,Standard_True,aDescription,aDocType); |
602 | Handle(StepBasic_HArray1OfDocument) aDocIds = new StepBasic_HArray1OfDocument(1,1); |
603 | aDocIds->SetValue(1,aDoc); |
604 | |
605 | // create ProductDefinitionWithAssociatedDocuments |
606 | aDescription = PD->Description(); |
607 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) PDWAD = |
608 | new StepBasic_ProductDefinitionWithAssociatedDocuments; |
609 | PDWAD->Init(EmptyString,aDescription,ProdDefForm,ProdDefCont,aDocIds); |
610 | //Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) PDWAD = |
611 | // Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)::DownCast(PD); |
612 | |
613 | // searh in graph for replace |
614 | // Standard_Integer numProdDef; |
615 | // Interface_EntityIterator subs = Graph().Shareds(SDR); |
616 | // for (subs.Start(); subs.More(); subs.Next()) { |
617 | // Handle(Standard_Transient) sub = subs.Value(); |
618 | Interface_EntityIterator subs = Graph().Sharings(PD); |
619 | for (subs.Start(); subs.More(); subs.Next()) { |
620 | Handle(Standard_Transient) sub = subs.Value(); |
621 | if (!sub->IsKind(STANDARD_TYPE(StepRepr_ProductDefinitionShape))) continue; |
622 | Handle(StepRepr_ProductDefinitionShape) ProdDefSh = |
623 | Handle(StepRepr_ProductDefinitionShape)::DownCast ( sub ); |
624 | if(ProdDefSh.IsNull()) continue; |
625 | StepRepr_CharacterizedDefinition CDf; |
626 | CDf.SetValue(PDWAD); |
627 | ProdDefSh->SetDefinition(CDf); |
628 | } |
629 | |
630 | // Interface_EntityIterator subs1 = Graph().Shareds(ProdDefSh); |
631 | // for (subs1.Start(); subs1.More(); subs1.Next()) { |
632 | |
633 | // Handle(Standard_Transient) sub1 = subs1.Value(); |
634 | // if (!sub1->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) continue; |
635 | // Handle(StepBasic_ProductDefinition) ProdDef = |
636 | // Handle(StepBasic_ProductDefinition)::DownCast ( sub1 ); |
637 | // numProdDef = Model()->Number(ProdDef); |
638 | Standard_Integer numProdDef = Model()->Number(PD); |
639 | |
640 | // Interface_EntityIterator subs2 = Graph().Sharings(ProdDef); |
641 | Interface_EntityIterator subs2 = Graph().Sharings(PD); |
642 | for (subs2.Start(); subs2.More(); subs2.Next()) { |
643 | Handle(Standard_Transient) sub2 = subs2.Value(); |
644 | |
645 | if (sub2->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) { |
646 | Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO = |
647 | Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast ( sub2 ); |
648 | NAUO->SetRelatedProductDefinition(PDWAD); |
649 | } |
650 | |
651 | if (sub2->IsKind(STANDARD_TYPE(StepAP203_CcDesignPersonAndOrganizationAssignment))) { |
652 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) CDPAOA = |
653 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment)::DownCast ( sub2 ); |
654 | Handle(StepAP203_HArray1OfPersonOrganizationItem) HAPOI = CDPAOA->Items(); |
655 | for(Standard_Integer i=1; i<=HAPOI->Length(); i++) { |
656 | StepAP203_PersonOrganizationItem POI = HAPOI->Value(i); |
657 | Handle(StepBasic_ProductDefinition) PDtmp = POI.ProductDefinition(); |
658 | Standard_Integer numPDtmp = Model()->Number(PDtmp); |
659 | if(numProdDef==numPDtmp) { |
660 | POI.SetValue(PDWAD); |
661 | HAPOI->SetValue(i,POI); |
662 | } |
663 | } |
664 | } |
665 | |
666 | if (sub2->IsKind(STANDARD_TYPE(StepAP203_CcDesignDateAndTimeAssignment))) { |
667 | Handle(StepAP203_CcDesignDateAndTimeAssignment) CDDATA = |
668 | Handle(StepAP203_CcDesignDateAndTimeAssignment)::DownCast ( sub2 ); |
669 | Handle(StepAP203_HArray1OfDateTimeItem) HADTI = CDDATA->Items(); |
670 | for(Standard_Integer i=1; i<=HADTI->Length(); i++) { |
671 | StepAP203_DateTimeItem DTI = HADTI->Value(i); |
672 | Handle(StepBasic_ProductDefinition) PDtmp = DTI.ProductDefinition(); |
673 | Standard_Integer numPDtmp = Model()->Number(PDtmp); |
674 | if(numProdDef==numPDtmp) { |
675 | DTI.SetValue(PDWAD); |
676 | HADTI->SetValue(i,DTI); |
677 | } |
678 | } |
679 | } |
680 | |
681 | if (sub2->IsKind(STANDARD_TYPE(StepAP203_CcDesignApproval))) { |
682 | Handle(StepAP203_CcDesignApproval) CDA = |
683 | Handle(StepAP203_CcDesignApproval)::DownCast ( sub2 ); |
684 | Handle(StepAP203_HArray1OfApprovedItem) HAAI = CDA->Items(); |
685 | for(Standard_Integer i=1; i<=HAAI->Length(); i++) { |
686 | StepAP203_ApprovedItem AI = HAAI->Value(i); |
687 | Handle(StepBasic_ProductDefinition) PDtmp = AI.ProductDefinition(); |
688 | Standard_Integer numPDtmp = Model()->Number(PDtmp); |
689 | if(numProdDef==numPDtmp) { |
690 | AI.SetValue(PDWAD); |
691 | HAAI->SetValue(i,AI); |
692 | } |
693 | } |
694 | } |
695 | } |
696 | // } |
697 | // |
698 | // StepRepr_CharacterizedDefinition ChartDef; |
699 | // ChartDef.SetValue(PDWAD); |
700 | // ProdDefSh->SetDefinition(ChartDef); |
701 | // } |
702 | |
703 | myAEIAs.Append ( PDWAD ); |
704 | myReplaceNum.Append(numProdDef); |
705 | myRoles.Append ( aDoc ); |
706 | myTypes.Append ( aDocType ); |
707 | |
708 | } |
709 | |
710 | return myAEIAs.Length(); |
711 | |
712 | } |
713 | |
714 | //======================================================================= |
715 | //function : WriteExternRefs |
716 | //purpose : |
717 | //======================================================================= |
718 | |
719 | Standard_Integer STEPConstruct_ExternRefs::WriteExternRefs (const Standard_Integer num) const |
720 | { |
721 | if(num==3) { |
722 | for ( Standard_Integer i=1; i <= myAEIAs.Length(); i++ ) { |
723 | Model()->ReplaceEntity(myReplaceNum(i),myAEIAs(i)); |
724 | if ( ! myRoles(i).IsNull() ) |
725 | Model()->AddWithRefs ( myRoles(i) ); |
726 | if ( ! myTypes(i).IsNull() ) |
727 | Model()->AddWithRefs ( myTypes(i) ); |
728 | } |
729 | } |
730 | else { |
731 | for ( Standard_Integer i=1; i <= myAEIAs.Length(); i++ ) { |
732 | Model()->AddWithRefs ( myAEIAs(i) ); |
733 | if ( ! myRoles(i).IsNull() ) |
734 | Model()->AddWithRefs ( myRoles(i) ); |
735 | if ( ! myFormats(i).IsNull() ) |
736 | Model()->AddWithRefs ( myFormats(i) ); |
737 | if ( ! myShapes(i).IsNull() ) |
738 | Model()->AddWithRefs ( myShapes(i) ); |
739 | if ( ! myTypes(i).IsNull() ) |
740 | Model()->AddWithRefs ( myTypes(i) ); |
741 | } |
742 | } |
743 | // PTV 30.01.2003 TRJ11 |
744 | if ( !myAPD.IsNull() ) |
745 | Model()->AddWithRefs( myAPD ); |
746 | if ( !mySharedPRPC.IsNull() ) |
747 | Model()->AddWithRefs( mySharedPRPC ); |
748 | |
749 | return myAEIAs.Length(); |
750 | } |
751 | |
752 | //======================================================================= |
753 | //function : addAP214ExterRef |
754 | //purpose : PTV 30.01.2003 TRJ11 |
755 | //======================================================================= |
756 | |
757 | Standard_Boolean STEPConstruct_ExternRefs::addAP214ExterRef (const Handle(StepAP214_AppliedDocumentReference)& ADR, |
758 | const Handle(StepBasic_ProductDefinition)& PD, |
759 | const Handle(StepBasic_DocumentFile)& DF, |
760 | const Standard_CString filename ) |
761 | { |
762 | Handle(StepAP214_HArray1OfDocumentReferenceItem) DRIs = new StepAP214_HArray1OfDocumentReferenceItem(1,1); |
763 | StepAP214_DocumentReferenceItem aDRI; |
764 | aDRI.SetValue(PD); |
765 | DRIs->SetValue(1, aDRI); |
766 | Handle(TCollection_HAsciiString) EmptyString = new TCollection_HAsciiString(""); |
767 | |
768 | // create/get created shared entities: |
769 | // DocumentType, ProductDefinitionContext, ProductRelatedProductCategory, ProductContext |
770 | checkAP214Shared(); |
771 | |
772 | // create document |
773 | Handle(StepBasic_Document) aDocument = new StepBasic_Document; |
774 | aDocument->Init( EmptyString, EmptyString, Standard_False, EmptyString, mySharedDocType ); |
775 | ADR->Init(aDocument, EmptyString, DRIs); |
776 | |
777 | // create new product |
778 | Handle(StepBasic_Product) Product = new StepBasic_Product; |
779 | Handle(StepBasic_HArray1OfProduct) HProducts = mySharedPRPC->Products(); |
780 | Standard_Integer nbProducts = 0; |
781 | if (!HProducts.IsNull()) |
782 | nbProducts = HProducts->Length(); |
783 | Standard_Integer intProdId = 20001 + nbProducts; |
784 | Handle(TCollection_HAsciiString) ProductID = new TCollection_HAsciiString( intProdId ); |
785 | Handle(TCollection_HAsciiString) ProductName = new TCollection_HAsciiString(filename); |
786 | ProductName->AssignCat( "-Doc" ); |
787 | Handle(StepBasic_HArray1OfProductContext) aHProdContext = new StepBasic_HArray1OfProductContext(1, 1); |
788 | aHProdContext->SetValue( 1, mySharedPC ); |
789 | Product->Init( ProductID, ProductName, EmptyString, aHProdContext ); |
790 | |
791 | // create new product definition formation |
792 | Handle(StepBasic_ProductDefinitionFormation) PDF = new StepBasic_ProductDefinitionFormation; |
793 | // name id taked from exapmle Standard_ExtString_ref_master.stp |
794 | Handle(TCollection_HAsciiString) PDF_ID = new TCollection_HAsciiString("1"); |
795 | PDF->Init( PDF_ID, EmptyString, Product ); |
796 | |
797 | Handle(StepBasic_DocumentProductEquivalence) DPE = new StepBasic_DocumentProductEquivalence; |
798 | Handle(TCollection_HAsciiString) DPEname = new TCollection_HAsciiString("equivalence"); |
799 | StepBasic_ProductOrFormationOrDefinition aPOFOD; |
800 | aPOFOD.SetValue( PDF ); |
801 | DPE->Init( DPEname, Standard_False, EmptyString, aDocument, aPOFOD ); |
802 | // add to the model with references |
803 | Model()->AddWithRefs( DPE ); |
804 | |
805 | // add products to shared PRPC |
806 | Handle(StepBasic_HArray1OfProduct) newHProducts = new StepBasic_HArray1OfProduct(1, nbProducts + 1); |
807 | for (Standard_Integer pi = 1; pi <= nbProducts; pi++) |
808 | newHProducts->SetValue( pi, HProducts->Value( pi ) ); |
809 | newHProducts->SetValue( nbProducts + 1, Product ); |
810 | // set the hArray to the PRPC |
811 | mySharedPRPC->SetProducts( newHProducts ); |
812 | |
813 | // create new PDWAD |
814 | Handle(StepBasic_ProductDefinitionWithAssociatedDocuments) PDWAD = |
815 | new StepBasic_ProductDefinitionWithAssociatedDocuments; |
816 | Handle(StepBasic_HArray1OfDocument) aDocIds = new StepBasic_HArray1OfDocument(1,1); |
817 | aDocIds->SetValue( 1, DF ); |
818 | Handle(TCollection_HAsciiString) PDWAD_ID = new TCollection_HAsciiString("1"); |
819 | PDWAD->Init( PDWAD_ID, EmptyString, PDF, mySharedPDC, aDocIds ); |
820 | // add to the model with references |
821 | Model()->AddWithRefs( PDWAD ); |
822 | |
823 | return Standard_True; |
824 | } |
825 | |
826 | //======================================================================= |
827 | //function : SetAP214APD |
828 | //purpose : |
829 | //======================================================================= |
830 | |
831 | void STEPConstruct_ExternRefs::SetAP214APD (const Handle(StepBasic_ApplicationProtocolDefinition)& APD) |
832 | { |
833 | myAPD = APD; |
834 | } |
835 | |
836 | //======================================================================= |
837 | //function : GetAP214APD |
838 | //purpose : |
839 | //======================================================================= |
840 | |
841 | Handle(StepBasic_ApplicationProtocolDefinition) STEPConstruct_ExternRefs::GetAP214APD() |
842 | { |
843 | if (myAPD.IsNull()) { |
844 | // create new APD with new Application Context |
845 | myAPD = new StepBasic_ApplicationProtocolDefinition; |
846 | // examples of the values taken from ext_ref_master.stp |
847 | Handle(TCollection_HAsciiString) status = |
848 | new TCollection_HAsciiString("version 1.1"); |
849 | Handle(TCollection_HAsciiString) appSchemaName = |
850 | new TCollection_HAsciiString("pdm_schema"); |
851 | Standard_Integer intProtocolYear = 1999; |
852 | Handle(StepBasic_ApplicationContext) aApplication = new StepBasic_ApplicationContext; |
853 | Handle(TCollection_HAsciiString) EmptyString = new TCollection_HAsciiString(""); |
854 | aApplication->Init( EmptyString ); |
855 | myAPD->Init( status, appSchemaName, intProtocolYear, aApplication ); |
856 | } |
857 | return myAPD; |
858 | } |
859 | |
860 | void STEPConstruct_ExternRefs::checkAP214Shared () |
861 | { |
862 | Handle(TCollection_HAsciiString) EmptyString = new TCollection_HAsciiString(""); |
863 | if ( mySharedPRPC.IsNull() ) { |
864 | // create new ProductRelatedProductCategory for all extern files. |
865 | Handle(TCollection_HAsciiString) PRPCname = new TCollection_HAsciiString("document"); |
866 | mySharedPRPC = new StepBasic_ProductRelatedProductCategory; |
18f7c9a5 |
867 | mySharedPRPC->Init( PRPCname, Standard_False, EmptyString, 0 ); |
7fd59977 |
868 | } |
869 | if ( mySharedDocType.IsNull() ) { |
870 | // create new shared Document Type |
871 | mySharedDocType = new StepBasic_DocumentType; |
872 | Handle(TCollection_HAsciiString) prod_dat_type = |
873 | new TCollection_HAsciiString("configuration controlled document version"); |
874 | mySharedDocType->Init( prod_dat_type ); |
875 | } |
876 | if ( mySharedPDC.IsNull() ) { |
877 | // create new shared Product Definition Context |
878 | mySharedPDC = new StepBasic_ProductDefinitionContext; |
879 | Handle(TCollection_HAsciiString) aPDCname = |
880 | new TCollection_HAsciiString("digital document definition"); |
881 | Handle(StepBasic_ApplicationContext) anAppContext = GetAP214APD()->Application(); |
882 | mySharedPDC->Init( aPDCname, anAppContext, EmptyString ); |
883 | } |
884 | if ( mySharedPC.IsNull() ) { |
885 | // create new shared ProductContext |
886 | mySharedPC = new StepBasic_ProductContext; |
887 | Handle(StepBasic_ApplicationContext) anAppContext = GetAP214APD()->Application(); |
888 | mySharedPC->Init( EmptyString, anAppContext, EmptyString ); |
889 | } |
890 | |
891 | } |