0025105: Remove TColgp_DataMapOfIntegerCirc2d
[occt.git] / samples / mfc / standard / Common / ImportExport / ImportExport.cpp
CommitLineData
7fd59977 1// ImportExport.cpp: implementation of the CImportExport class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#include "stdafx.h"
6#include "ImportExport.h"
5c1f974e 7#include <OCC_App.h>
7fd59977 8
9#include "SaveCSFDBDlg.h"
10
11#include "SaveSTEPDlg.h"
12
13#include "TColStd_SequenceOfAsciiString.hxx"
14#include "TColStd_SequenceOfExtendedString.hxx"
15#include "OSD_Timer.hxx"
16
17#include "IGESControl_Reader.hxx"
18#include "STEPControl_Controller.hxx"
19
20#include <BRepAlgo.hxx>
21#include <FSD_File.hxx>
22#include <ShapeSchema.hxx>
23#include <PTopoDS_HShape.hxx>
24#include <Storage_HSeqOfRoot.hxx>
25#include <Storage_Root.hxx>
26#include <PTColStd_PersistentTransientMap.hxx>
27#include <MgtBRep.hxx>
28#include <PTColStd_TransientPersistentMap.hxx>
29#include <IGESControl_Controller.hxx>
30#include <IGESControl_Writer.hxx>
31#include <Interface_Static.hxx>
32#include <STEPControl_Reader.hxx>
33#include <Geom_Curve.hxx>
34#include <STEPControl_Writer.hxx>
35#include <TopoDS_Compound.hxx>
36#include <Geom_Line.hxx>
37#include <StlAPI_Writer.hxx>
38#include <VrmlAPI_Writer.hxx>
39#include <VrmlData_Scene.hxx>
40#include <VrmlData_ShapeConvert.hxx>
41#include <VrmlData_Appearance.hxx>
42#include <VrmlData_Material.hxx>
43#include <VrmlData_Group.hxx>
44#include <VrmlData_ListOfNode.hxx>
45#include <VrmlData_ShapeNode.hxx>
46
47#include <XSControl_WorkSession.hxx>
48#include <STEPConstruct_Styles.hxx>
49#include <TColStd_HSequenceOfTransient.hxx>
50#include <STEPConstruct.hxx>
51#include <StepVisual_StyledItem.hxx>
52
53#ifdef _DEBUG
54#undef THIS_FILE
55static char THIS_FILE[]=__FILE__;
56//#define new DEBUG_NEW
57#endif
58
59//////////////////////////////////////////////////////////////////////
60// Construction/Destruction
61//////////////////////////////////////////////////////////////////////
62
63Handle(TopTools_HSequenceOfShape) CImportExport::BuildSequenceFromContext(const Handle(AIS_InteractiveContext)& anInteractiveContext,
64 Handle(Quantity_HArray1OfColor)& anArrayOfColors,
65 Handle(TColStd_HArray1OfReal)& anArrayOfTransparencies)
66{
67 Handle(TopTools_HSequenceOfShape) aSequence;
68 Standard_Integer nb = anInteractiveContext->NbCurrents(), i = 1;
69 if (!nb)
70 return aSequence;
71
72 aSequence = new TopTools_HSequenceOfShape();
73 anArrayOfColors = new Quantity_HArray1OfColor(1, nb);
74 anArrayOfTransparencies = new TColStd_HArray1OfReal (1, nb);
75
76 Handle(AIS_InteractiveObject) picked;
77 for(anInteractiveContext->InitCurrent();anInteractiveContext->MoreCurrent();anInteractiveContext->NextCurrent())
78 {
79 picked = anInteractiveContext->Current();
80 if (anInteractiveContext->Current()->IsKind(STANDARD_TYPE(AIS_Shape)))
81 {
82 Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast(picked);
83 TopoDS_Shape aShape = aisShape->Shape();
84 aSequence->Append(aShape);
85
86 Quantity_Color color;
87 aisShape->Color(color);
88 anArrayOfColors->SetValue(i, color);
89
90 Standard_Real transparency = aisShape->Transparency();
91 anArrayOfTransparencies->SetValue(i, transparency);
92
93 i++;
94 }
95 }
96 return aSequence;
97}
98
99//======================================================================
100//= =
101//= BREP =
102//= =
103//======================================================================
104
105int CImportExport::ReadBREP(const Handle_AIS_InteractiveContext& anInteractiveContext,LPCTSTR InitialDir /* = NULL*/)
106{
107 Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadBREP(InitialDir);
108 if(aSequence->IsEmpty())
109 return 1;
110 Handle_AIS_Shape aShape;
111 for(int i=1;i<= aSequence->Length();i++){
112 aShape = new AIS_Shape(aSequence->Value(i));
113 anInteractiveContext->SetDisplayMode(aShape, 1, Standard_False);
114 anInteractiveContext->Display(aShape, Standard_False);
115 anInteractiveContext->SetCurrentObject(aShape, Standard_False);
116 }
117 return 0;
118}
119
5c573e69 120Handle(TopTools_HSequenceOfShape) CImportExport::ReadBREP(LPCTSTR /*InitialDir*/ /* = NULL*/) // not by reference --> the sequence is created here !!
7fd59977 121{
122 CFileDialog dlg(TRUE,
5c573e69 123 NULL,
124 NULL,
125 OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
126 "BREP Files (*.brep , *.rle)|*.brep; *.BREP; *.rle; *.RLE; |All Files (*.*)|*.*||",
127 NULL );
7fd59977 128
5c573e69 129 TCHAR tchBuf[80];
7fd59977 130
5c573e69 131 CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
132 CString initdir = (CASROOTValue + "\\..\\data\\occ");
7fd59977 133
5c573e69 134 dlg.m_ofn.lpstrInitialDir = initdir;
7fd59977 135
136 Handle(TopTools_HSequenceOfShape) aSequence= new TopTools_HSequenceOfShape();
137
138 if (dlg.DoModal() == IDOK)
139 {
5c573e69 140 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
141 CString filename = dlg.GetPathName();
7fd59977 142 TopoDS_Shape aShape;
143 Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename;
5c573e69 144 Standard_Boolean result = ReadBREP(aFileName,aShape);
145 if (result)
7fd59977 146 {
5c573e69 147 if (!BRepAlgo::IsValid(aShape))
148 MessageBox(AfxGetMainWnd()->m_hWnd,"Warning: The shape is not valid!","Cascade Warning",MB_ICONWARNING);
149
150 aSequence->Append(aShape);
7fd59977 151 }
152 else
5c573e69 153 MessageBox(AfxGetMainWnd()->m_hWnd,"Error: The file was not read","Cascade Error",MB_ICONERROR);
7fd59977 154
5c573e69 155 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
7fd59977 156 }
157
158 return aSequence;
159}
160//----------------------------------------------------------------------
161
162Standard_Boolean CImportExport::ReadBREP(const Standard_CString& aFileName,
163 TopoDS_Shape& aShape)
164{
165 BRep_Builder aBuilder;
166 Standard_Boolean result = BRepTools::Read(aShape,aFileName,aBuilder);
167 return result;
168}
169
170void CImportExport::SaveBREP(const Handle_AIS_InteractiveContext& anInteractiveContext)
171{
172 anInteractiveContext->InitCurrent();
173 if (anInteractiveContext->NbCurrents() == 0){
174 AfxMessageBox("No shape selected for export!");
175 return;
176 }
177 Handle(TopTools_HSequenceOfShape) aHSequenceOfShape;
178 Handle(Quantity_HArray1OfColor) anArrayOfColors;
179 Handle(TColStd_HArray1OfReal) anArrayOfTransparencies;
180 aHSequenceOfShape = BuildSequenceFromContext(anInteractiveContext, anArrayOfColors, anArrayOfTransparencies);
181 int aLength = aHSequenceOfShape->Length();
182 if (aLength == 1){
183 TopoDS_Shape RES = aHSequenceOfShape->Value(1);
184 CImportExport::SaveBREP(RES);
185 } else {
186 TopoDS_Compound RES;
187 BRep_Builder MKCP;
188 MKCP.MakeCompound(RES);
189 for (Standard_Integer i=1;i<=aLength;i++)
190 {
191 TopoDS_Shape aShape= aHSequenceOfShape->Value(i);
192 if ( aShape.IsNull() )
193 {
194 continue;
195 }
196 MKCP.Add(RES, aShape);
197 }
198 CImportExport::SaveBREP(RES);
199 }
200}
201
202Standard_Boolean CImportExport::SaveBREP(const TopoDS_Shape& aShape)
203{
204 CFileDialog dlg(FALSE,_T("*.brep"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
205 "BREP Files (*.brep)|*.brep;|BREP Files (*.BREP)|*.BREP;||", NULL );
206
207TCHAR tchBuf[80];
208
209CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
210CString initdir = (CASROOTValue + "\\..\\data\\occ");
211
212dlg.m_ofn.lpstrInitialDir = initdir;
213
214 Standard_Boolean result = Standard_False;
215 if (dlg.DoModal() == IDOK)
216 {
217 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
218 CString filename = dlg.GetPathName();
219 Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename;
220 result = SaveBREP(aFileName,aShape);
221 if (!result)
222 MessageBox(0,"Error : The shape or shapes were not saved.",
223 "CasCade Error",MB_ICONERROR);
224 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
225 }
226 return result;
227}
228
229//----------------------------------------------------------------------------------------
230Standard_Boolean CImportExport::SaveBREP(const Standard_CString& aFileName,
231 const TopoDS_Shape& aShape)
232{
233 Standard_Boolean result = BRepTools::Write(aShape,aFileName);
234 return result;
235}
236
237
238//======================================================================
239//= =
240//= CSFDB =
241//= =
242//======================================================================
243
244
245TCollection_AsciiString CImportExport::BuildStorageErrorMessage( Storage_Error anError)
246
247{
248 TCollection_AsciiString aMessage("Storage Status :");
249 switch ( anError ) {
250 case Storage_VSOk :
251 aMessage += "no problem \n";
252 break;
253 case Storage_VSOpenError :
254 aMessage += "OpenError while opening the stream \n";
255 break;
256 case Storage_VSModeError :
257 aMessage += "the stream is opened with a wrong mode for operation \n";
258 break;
259 case Storage_VSCloseError :
260 aMessage += "CloseError while closing the stream \n";
261 break;
262 case Storage_VSAlreadyOpen :
263 aMessage += "stream is already opened \n";
264 break;
265 case Storage_VSNotOpen :
266 aMessage += "stream not opened \n";
267 break;
268 case Storage_VSSectionNotFound :
269 aMessage += "the section is not found \n";
270 break;
271 case Storage_VSWriteError :
272 aMessage += "error during writing \n";
273 break;
274 case Storage_VSFormatError :
275 aMessage += "wrong format error occured while reading \n";
276 break;
277 case Storage_VSUnknownType :
278 aMessage += "try to read an unknown type \n";
279 break;
280 case Storage_VSTypeMismatch :
281 aMessage += "try to read a wrong primitive type (read a char while expecting a real) \n";
282 break;
283 case Storage_VSInternalError :
284 aMessage += "internal error \n ";
285 break;
286 case Storage_VSExtCharParityError :
287 aMessage += "problem with 16bit characters, may be an 8bit character is inserted inside a 16bit string \n";
288 break;
289 default :
290 aMessage += "Unknown Status ";
291 aMessage += anError;
292 aMessage += " \n";
293 break;
294 }
295 return aMessage;
296}
297
298void CImportExport::ReadCSFDB(const Handle(AIS_InteractiveContext)& anInteractiveContext)
299{
300 Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadCSFDB();
301 for(int i=1;i<= aSequence->Length();i++)
302 anInteractiveContext->Display(new AIS_Shape(aSequence->Value(i)), Standard_False);
303}
304
305Handle(TopTools_HSequenceOfShape) CImportExport::ReadCSFDB() // not by reference --> the sequence is created here !!
306{
307 CFileDialog dlg(TRUE,
308 NULL,
309 NULL,
310 OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
311 "CSFDB Files (*.CSFDB , *.csf)|*.csfdb; *.csf; |All Files (*.*)|*.*||",
312 NULL );
313
314TCHAR tchBuf[80];
315
316CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
317CString initdir = (CASROOTValue + "\\..\\data\\csfdb");
318
319dlg.m_ofn.lpstrInitialDir = initdir;
320
321 Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape();;
322 if (dlg.DoModal() == IDOK)
323 {
324 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
325 CString filename = dlg.GetPathName();
326 Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename;
327 TCollection_AsciiString Message;
328 Standard_Boolean result = ReadCSFDB(aFileName,aSequence,Message);
329 if (result)
330 {
331 // Display The Message :
332 MessageBox(0,Message.ToCString(),"CasCade ",MB_OK);
333
334
335 }
336 else
337 MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR);
338 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
339 }
340 return aSequence;
341}
342
343Standard_Boolean CImportExport::ReadCSFDB(const Standard_CString& aFileName,
344 Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, // out parameter
345 TCollection_AsciiString& ReturnMessage) // out parameter
346{
347 // an I/O driver
348 FSD_File f;
349
350 // the applicative Schema
351 Handle(ShapeSchema) s = new ShapeSchema;
352
353 // a Read/Write data object
354 Handle(Storage_Data) d = new Storage_Data;
355
356 d->ClearErrorStatus();
357
358 // Check file type
359 if ( FSD_File::IsGoodFileType( aFileName ) != Storage_VSOk) {
360 ReturnMessage = "Bad file type for ";
361 ReturnMessage += aFileName;
362 ReturnMessage += " \n";
363 return Standard_False;
364 }
365
366 // Open the archive, Read mode
367 Storage_Error err = f.Open(aFileName, Storage_VSRead);
368 // Read all the persistent object in the file with the schema
369 if ( err != Storage_VSOk ) {
370 ReturnMessage += BuildStorageErrorMessage(d->ErrorStatus());
371 return Standard_False;
372 }
373
374 d = s->Read( f );
375 err = d->ErrorStatus() ;
376
377 if ( err != Storage_VSOk ) {
378 ReturnMessage += BuildStorageErrorMessage(d->ErrorStatus());
379 return Standard_False;
380 }
381 // Close the file driver
382 f.Close();
383
384 ReturnMessage += "Application Name :"; ReturnMessage += d->ApplicationName();ReturnMessage += "\n";
385 ReturnMessage += "Application Version :"; ReturnMessage += d->ApplicationVersion();ReturnMessage += "\n";
386 ReturnMessage += "Data type :"; ReturnMessage += d->DataType();ReturnMessage += "\n";
387 ReturnMessage += "== User Infos : ==\n";
388 const TColStd_SequenceOfAsciiString& UserInfo = d->UserInfo();
389 for (int i=1;i<=UserInfo.Length();i++)
390 {ReturnMessage += UserInfo(i);ReturnMessage += "\n";}
391 ReturnMessage += "== Comments : ==\n";
392 const TColStd_SequenceOfExtendedString& Comments=d->Comments();
393 for ( int i=1;i<=Comments.Length();i++)
394 {ReturnMessage += Comments(i);ReturnMessage += "\n";}
395 ReturnMessage += "----------------\n";
396
397
398 // Read all the root objects
399 // Get the root list
400 Handle(Storage_HSeqOfRoot) roots = d->Roots();
401 Handle(Standard_Persistent) p;
402 Handle(Storage_Root) r;
403 Handle(PTopoDS_HShape) aPShape;
404 for ( int i = 1; i <= roots->Length() ; i++ )
405 {
406 // Get the root
407 r = roots->Value(i);
408
409 // Get the persistent application object from the root
410 p = r->Object();
411
412 // Display information
413 ReturnMessage += "Persistent Object "; ReturnMessage += i; ReturnMessage += "\n";
414 ReturnMessage += "Name :"; ReturnMessage += r->Name(); ReturnMessage += "\n";
415 ReturnMessage += "Type :"; ReturnMessage += r->Type(); ReturnMessage += "\n";
416
417 aPShape = Handle(PTopoDS_HShape)::DownCast(p);
418
419 if ( !aPShape.IsNull() )
420 {
421 // To Be ReWriten to suppress the cout,
422 // and provide a CallBack method for dynamic information.
423 // Get the persistent shape
424 PTColStd_PersistentTransientMap aMap;
425 TopoDS_Shape aTShape;
426 MgtBRep::Translate(aPShape,aMap,aTShape,
427 MgtBRep_WithTriangle);
428 aHSequenceOfShape->Append(aTShape);
429 }
430 else
431 {
432 ReturnMessage += "Error -> Unable to read\n";
433 }
434 }
435 return Standard_True;
436}
437//----------------------------------------------------------------------
438void CImportExport::SaveCSFDB(const Handle(AIS_InteractiveContext)& anInteractiveContext)
439{
440 anInteractiveContext->InitCurrent();
441 if (anInteractiveContext->NbCurrents() == 0){
442 AfxMessageBox("No shape selected for export!");
443 return;
444 }
445 Handle(Quantity_HArray1OfColor) anArrayOfColors;
446 Handle(TColStd_HArray1OfReal) anArrayOfTransparencies;
447 CImportExport::SaveCSFDB(BuildSequenceFromContext(anInteractiveContext, anArrayOfColors, anArrayOfTransparencies));
448}
449
450Standard_Boolean CImportExport::SaveCSFDB(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
451{
452 Standard_Boolean result = Standard_False;
5c573e69 453 CFileSaveCSFDBDialog aDlg(NULL);
454 aDlg.m_TriangleMode = MgtBRep_WithTriangle;
455 if (aDlg.DoModal() == IDOK)
456 {
7fd59977 457 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
458 CString filename = aDlg.GetPathName();
459 Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename;
460 TCollection_AsciiString Message;
5c573e69 461 //MgtBRep_TriangleMode selection = aDlg.m_TriangleMode;
7fd59977 462 Standard_Boolean result = SaveCSFDB(aFileName,aHSequenceOfShape,Message);
463 if (result)
464 {
465 // Display The Message :
466 MessageBox(0,Message.ToCString(),"CasCade ",MB_OK);
467 }
468 else
469 MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR);
470 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
471 }
472 return result;
473}
474
475Standard_Boolean CImportExport::SaveCSFDB(const Standard_CString& aFileName,
476 const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape,
477 TCollection_AsciiString& ReturnMessage,// out parameter
5c573e69 478 MgtBRep_TriangleMode /*aTriangleMode*/ /* = MgtBRep_WithTriangle */)
7fd59977 479{
480 Standard_Boolean ReturnValue = Standard_True;
481 if (aHSequenceOfShape->Length() == 0)
482 {
483 MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING);
484 return Standard_False;
485 }
486
487 // an I/O driver
488 FSD_File f;
489
490 // the applicative Schema containing
491 // Pesistent Topology and Geometry
492 Handle(ShapeSchema) s = new ShapeSchema;
493
494 // a Read/Write data object
495 Handle(Storage_Data) d = new Storage_Data;
496
497 d->ClearErrorStatus();
498
499 // To Be ReWriten to suppress the Strings,
500 // and provide a CallBack method for dynamic information.
501
502 d->SetApplicationName (TCollection_ExtendedString("SampleImportExport"));
503 d->SetApplicationVersion("1");
504 d->SetDataType(TCollection_ExtendedString("Shapes"));
505 d->AddToUserInfo("Try to store a Persistent set of Shapes in a flat file");
506 d->AddToComments(TCollection_ExtendedString("application is based on CasCade 2.0"));
507
508 // Open the archive, Write mode
509 Storage_Error err = f.Open(aFileName, Storage_VSWrite);
510
511 if ( err != Storage_VSOk ) {
512 ReturnMessage += BuildStorageErrorMessage(err);
513 return Standard_False;
514 }
515
516 PTColStd_TransientPersistentMap aMap;
517 ReturnMessage += "The Object have be saved in the file ";
518 ReturnMessage += aFileName;
519 ReturnMessage += "\n with the names : ";
520
521 for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++)
522 {
523 TopoDS_Shape aTShape= aHSequenceOfShape->Value(i);
524 TCollection_AsciiString anObjectName("anObjectName_");
525 anObjectName += i;
526 ReturnMessage += anObjectName;
527 ReturnMessage += " \n";
528
529 if ( aTShape.IsNull() )
530 {
531 ReturnMessage += " Error : Invalid shape \n";
532 ReturnValue = Standard_False;
533 continue;
534 }
535
536 //Create the persistent Shape
537
538 Handle(PTopoDS_HShape) aPShape =
539 MgtBRep::Translate(aTShape, aMap, MgtBRep_WithTriangle);
540
541
542 // Add the object in the data structure as root
543 // To Be ReWriten to suppress the cout,
544 // and provide a CallBack method for dynamic information.
545 d->AddRoot(anObjectName, aPShape);
546 }
547
548 // Write the object in the file with the schema
549 s->Write( f, d);
550
551 // Close the driver
552 f.Close();
553
554 if ( d->ErrorStatus() != Storage_VSOk )
555 {
556 ReturnMessage += BuildStorageErrorMessage(d->ErrorStatus());
557 return Standard_False;
558 }
559 return ReturnValue;
560}
561
562
563//======================================================================
564//= =
565//= IGES =
566//= =
567//======================================================================
568
569
570
571void CImportExport::ReadIGES(const Handle(AIS_InteractiveContext)& anInteractiveContext)
572{
573 Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadIGES();
574 for(int i=1;i<= aSequence->Length();i++)
575 anInteractiveContext->Display(new AIS_Shape(aSequence->Value(i)));
576
577}
578
579Handle(TopTools_HSequenceOfShape) CImportExport::ReadIGES()// not by reference --> the sequence is created here !!
580{
581 CFileDialog dlg(TRUE,
582 NULL,
583 NULL,
584 OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
585 "IGES Files (*.iges , *.igs)|*.iges; *.igs|All Files (*.*)|*.*||",
586 NULL );
587
588TCHAR tchBuf[80];
589
590CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
591CString initdir = (CASROOTValue + "\\..\\data\\iges");
592
593dlg.m_ofn.lpstrInitialDir = initdir;
594
595 Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape();
596 if (dlg.DoModal() == IDOK)
597 {
598 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
599 CString C = dlg.GetPathName();
600 Standard_CString aFileName = (Standard_CString)(LPCTSTR)C;
601 Standard_Integer status = ReadIGES(aFileName,aSequence);
602 if (status != IFSelect_RetDone)
603 {
604 MessageBox(0,"Error : The file is not read","CasCade Error",MB_ICONERROR);
605 }
606
607 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
608 }
609 return aSequence;
610}
611//----------------------------------------------------------------------
612
613Standard_Integer CImportExport::ReadIGES(const Standard_CString& aFileName,
614 Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
615{
616
617 IGESControl_Reader Reader;
618
619 Standard_Integer status = Reader.ReadFile(aFileName);
620
621 if (status != IFSelect_RetDone) return status;
622 Reader.TransferRoots();
623 TopoDS_Shape aShape = Reader.OneShape();
624 aHSequenceOfShape->Append(aShape);
625
626 return status;
627}
628//----------------------------------------------------------------------
629
630void CImportExport::SaveIGES(const Handle(AIS_InteractiveContext)& anInteractiveContext)
631{
632 anInteractiveContext->InitCurrent();
633 if (anInteractiveContext->NbCurrents() == 0){
634 AfxMessageBox("No shape selected for export!");
635 return;
636 }
637 Handle(Quantity_HArray1OfColor) anArrayOfColors;
638 Handle(TColStd_HArray1OfReal) anArrayOfTransparencies;
639 CImportExport::SaveIGES(BuildSequenceFromContext(anInteractiveContext, anArrayOfColors, anArrayOfTransparencies));
640}
641
642Standard_Boolean CImportExport::SaveIGES(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
643{
644 if (aHSequenceOfShape->Length() == 0)
645 {
646 MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING);
647 return Standard_False;
648 }
649
650 CFileDialog dlg(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
651 "IGES Files (*.iges )|*.iges;|IGES Files (*.igs )| *.igs;||", NULL );
652
653TCHAR tchBuf[80];
654
655CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
656CString initdir = (CASROOTValue + "\\..\\data\\iges");
657
658dlg.m_ofn.lpstrInitialDir = initdir;
659
660 Standard_Boolean result=Standard_False;
661 if (dlg.DoModal() == IDOK)
662 {
663 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
664 CString C = dlg.GetPathName();
665 Standard_CString aFileName = (Standard_CString)(LPCTSTR)C;
666
667
668 result = SaveIGES(aFileName,aHSequenceOfShape);
669 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
670 }
671 return result;
672}
673//----------------------------------------------------------------------
674
675Standard_Boolean CImportExport::SaveIGES(const Standard_CString& aFileName,
676 const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
677{
678
679 IGESControl_Controller::Init();
680 IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"),
681 Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
682
683 for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++)
684 ICW.AddShape (aHSequenceOfShape->Value(i));
685
686 ICW.ComputeModel();
687 Standard_Boolean result = ICW.Write(aFileName );
688 return result;
689}
690
691//======================================================================
692
693//======================================================================
694//= =
695//= STEP =
696//= =
697//======================================================================
698
699void CImportExport::ReadSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext)
700{
701 Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadSTEP();
702 if (!aSequence.IsNull()) {
703 for(int i=1;i<= aSequence->Length();i++)
704 anInteractiveContext->Display(new AIS_Shape(aSequence->Value(i)), Standard_False);
705 }
706}
707
708Handle(TopTools_HSequenceOfShape) CImportExport::ReadSTEP()// not by reference --> the sequence is created here !!
709{
710 CFileDialog dlg(TRUE,
711 NULL,
712 NULL,
713 OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
714 "STEP Files (*.stp;*.step)|*.stp; *.step|All Files (*.*)|*.*||",
715 NULL );
716
717TCHAR tchBuf[80];
718
719CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
720CString initdir = (CASROOTValue + "\\..\\data\\step");
721
722dlg.m_ofn.lpstrInitialDir = initdir;
723
724 Handle(TopTools_HSequenceOfShape) aSequence= new TopTools_HSequenceOfShape();
725 if (dlg.DoModal() == IDOK)
726 {
727 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
728 CString C = dlg.GetPathName();
729 Standard_CString aFileName = (Standard_CString)(LPCTSTR)C;
730 IFSelect_ReturnStatus ReturnStatus = ReadSTEP(aFileName,aSequence);
731 switch (ReturnStatus)
732 {
733 case IFSelect_RetError :
734 MessageBox(0,"Not a valid Step file","ERROR",MB_ICONWARNING);
735 break;
736 case IFSelect_RetFail :
737 MessageBox(0,"Reading has failed","ERROR",MB_ICONWARNING);
738 break;
739 case IFSelect_RetVoid :
740 MessageBox(0,"Nothing to transfer","ERROR",MB_ICONWARNING);
741 break;
742 }
743 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
744 }
745 return aSequence;
746}
747
748IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName,
749 Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
750{
751 aHSequenceOfShape->Clear();
752
753 // create additional log file
754 STEPControl_Reader aReader;
755 IFSelect_ReturnStatus status = aReader.ReadFile(aFileName);
756 if (status != IFSelect_RetDone)
757 return status;
758
759 aReader.WS()->MapReader()->SetTraceLevel(2); // increase default trace level
760
761 Standard_Boolean failsonly = Standard_False;
762 aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);
763
764 // Root transfers
765 Standard_Integer nbr = aReader.NbRootsForTransfer();
766 aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity);
767 for ( Standard_Integer n = 1; n<=nbr; n++) {
5c573e69 768 /*Standard_Boolean ok =*/ aReader.TransferRoot(n);
7fd59977 769 }
770
771 // Collecting resulting entities
772 Standard_Integer nbs = aReader.NbShapes();
773 if (nbs == 0) {
774 return IFSelect_RetVoid;
775 }
776 for (Standard_Integer i=1; i<=nbs; i++) {
777 aHSequenceOfShape->Append(aReader.Shape(i));
778 }
779
780 return status;
781}
782
783
784//----------------------------------------------------------------------
785void CImportExport::SaveSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext)
786{
787 anInteractiveContext->InitCurrent();
788 if (anInteractiveContext->NbCurrents() == 0){
789 AfxMessageBox("No shape selected for export!");
790 return;
791 }
792 Handle(Quantity_HArray1OfColor) anArrayOfColors;
793 Handle(TColStd_HArray1OfReal) anArrayOfTransparencies;
794 CImportExport::SaveSTEP(BuildSequenceFromContext(anInteractiveContext, anArrayOfColors, anArrayOfTransparencies));
795}
796
797// Return True if no error
798Standard_Boolean TestFacetedBrep(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
799{
800 Standard_Boolean OneErrorFound = Standard_False;
801 for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++)
802 {
803 TopoDS_Shape aShape= aHSequenceOfShape->Value(i);
804
805 TopExp_Explorer Ex(aShape,TopAbs_FACE);
806 while (Ex.More() && !OneErrorFound)
807 {
808 // Get the Geom_Surface outside the TopoDS_Face
809 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(TopoDS::Face(Ex.Current()));
810 // check if it is a plane.
811 if (!aSurface->IsKind(STANDARD_TYPE(Geom_Plane)))
812 OneErrorFound=Standard_True;
813 Ex.Next();
814 }
815 TopExp_Explorer Ex2(aShape,TopAbs_EDGE);
816 while (Ex2.More() && !OneErrorFound)
817 {
818 // Get the Geom_Curve outside the TopoDS_Face
819 Standard_Real FirstDummy,LastDummy;
820 Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(Ex2.Current()),FirstDummy,LastDummy);
821 // check if it is a line.
822 if (!aCurve->IsKind(STANDARD_TYPE(Geom_Line)))
823 OneErrorFound=Standard_True;
824 Ex2.Next();
825 }
826 }
827 return !OneErrorFound;
828}
829
830IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
831{
832 if (aHSequenceOfShape->Length() == 0)
833 {
834 MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING);
835 return IFSelect_RetError;
836 }
837
5c573e69 838 IFSelect_ReturnStatus status = IFSelect_RetVoid;
7fd59977 839
840 CFileSaveSTEPDialog aDlg(NULL);
841
842 aDlg.m_Cc1ModelType = STEPControl_ManifoldSolidBrep;
843
844 if (aDlg.DoModal() == IDOK) {
845 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
846 CString C = aDlg.GetPathName();
847 Standard_CString aFileName = (Standard_CString)(LPCTSTR)C;
848
849 STEPControl_StepModelType selection = aDlg.m_Cc1ModelType;
850
851 if(selection == STEPControl_FacetedBrep)
852
853 if (!TestFacetedBrep(aHSequenceOfShape))
854 {
855 MessageBox(0,"At least one shape doesn't contain facetes","CasCade Warning",MB_ICONWARNING);
856 return IFSelect_RetError;
857 }
858
859
860 status = SaveSTEP(aFileName,aHSequenceOfShape,selection);
861 switch (status)
862 {
863 case IFSelect_RetError:
864 MessageBox(0,"Incorrect Data","ERROR",MB_ICONWARNING);
865 break;
866 case IFSelect_RetFail:
867 MessageBox(0,"Writing has failed","ERROR",MB_ICONWARNING);
868 break;
869 case IFSelect_RetVoid:
870 MessageBox(0,"Nothing to transfer","ERROR",MB_ICONWARNING);
871 break;
872 }
873 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
874 }
875 return status;
876}
877//----------------------------------------------------------------------------------------
878IFSelect_ReturnStatus CImportExport::SaveSTEP(const Standard_CString& aFileName,
879 const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape,
880
881const STEPControl_StepModelType aValue /* =TopoDSToCc1Act_ManifoldSolidBrep */ )
882
883{
884 // CREATE THE WRITER
885
886 STEPControl_Writer aWriter;
887
888 IFSelect_ReturnStatus status;
889 for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++)
890 {
891 status = aWriter.Transfer(aHSequenceOfShape->Value(i), aValue);
892 if ( status != IFSelect_RetDone ) return status;
893 }
894 status = aWriter.Write(aFileName);
895 return status;
896}
897
898
899
900//======================================================================
901//= =
902//= STL =
903//= =
904//======================================================================
905
906void CImportExport::SaveSTL(const Handle(AIS_InteractiveContext)& anInteractiveContext)
907{
908 anInteractiveContext->InitCurrent();
909 if (anInteractiveContext->NbCurrents() == 0){
910 AfxMessageBox("No shape selected for export!");
911 return;
912 }
913 Handle(Quantity_HArray1OfColor) anArrayOfColors;
914 Handle(TColStd_HArray1OfReal) anArrayOfTransparencies;
915 CImportExport::SaveSTL(BuildSequenceFromContext(anInteractiveContext, anArrayOfColors, anArrayOfTransparencies));
916}
917
918Standard_Boolean CImportExport::SaveSTL(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape)
919{
920 CFileDialog dlg(FALSE,_T("*.stl"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
921 "stl Files (*.stl)|*.stl;|STL Files (*.STL)|*.STL;||", NULL );
922
923TCHAR tchBuf[80];
924
925CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
926CString initdir = (CASROOTValue + "\\..\\data\\stl");
927
928dlg.m_ofn.lpstrInitialDir = initdir;
929
930 Standard_Boolean result;
931
932 if (dlg.DoModal() == IDOK) {
933 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
934 CString C = dlg.GetPathName();
935 Standard_CString aFileName = (Standard_CString)(LPCTSTR)C;
936 TCollection_AsciiString Message;
937 result = SaveSTL(aFileName,aHSequenceOfShape,Message);
938 if (result)
939 {
940 // Display The Message :
941 MessageBox(0,Message.ToCString(),"CasCade ",MB_OK);
942 }
943 else
944 MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR);
945 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
946 }
947 return result;
948}
949
950Standard_Boolean CImportExport::SaveSTL(const Standard_CString& aFileName,
951 const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape,
952 TCollection_AsciiString& ReturnMessage)
953{
954 Standard_Boolean ReturnValue = Standard_True;
955 if (aHSequenceOfShape->Length() == 0)
956 {
957 MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING);
958 return Standard_False;
959 }
960
961 PTColStd_TransientPersistentMap aMap;
962 ReturnMessage += "The Object have be saved in the file ";
963 ReturnMessage += aFileName;
964 ReturnMessage += "\n with the names : ";
965
966 TopoDS_Compound RES;
967 BRep_Builder MKCP;
968 MKCP.MakeCompound(RES);
969
970 for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++)
971 {
972 TopoDS_Shape aShape= aHSequenceOfShape->Value(i);
973 TCollection_AsciiString anObjectName("anObjectName_");
974 anObjectName += i;
975 ReturnMessage += anObjectName;
976 ReturnMessage += " \n";
977
978 if ( aShape.IsNull() )
979 {
980 ReturnMessage += " Error : Invalid shape \n";
981 ReturnValue = Standard_False;
982 continue;
983 }
984
985 MKCP.Add(RES, aShape);
986 }
987
988 StlAPI_Writer myStlWriter;
989 myStlWriter.Write(RES, aFileName);
990
991 return ReturnValue;
992}
993
994
995//======================================================================
996//= =
997//= VRML =
998//= =
999//======================================================================
1000
1001void CImportExport::SaveVRML(const Handle(AIS_InteractiveContext)& anInteractiveContext)
1002{
1003 anInteractiveContext->InitCurrent();
1004 if (anInteractiveContext->NbCurrents() == 0){
1005 AfxMessageBox("No shape selected for export!");
1006 return;
1007 }
1008 Handle(Quantity_HArray1OfColor) anArrayOfColors;
1009 Handle(TColStd_HArray1OfReal) anArrayOfTransparencies;
1010 CImportExport::SaveVRML(BuildSequenceFromContext(anInteractiveContext, anArrayOfColors, anArrayOfTransparencies),
1011 anArrayOfColors, anArrayOfTransparencies);
1012}
1013
1014Standard_Boolean CImportExport::SaveVRML(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape,
1015 const Handle(Quantity_HArray1OfColor)& anArrayOfColors,
1016 const Handle(TColStd_HArray1OfReal)& anArrayOfTransparencies)
1017{
1018 CFileDialog dlg(FALSE,_T("*.vrml"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
1019 "vrml Files (*.vrml)|*.vrml;|vrm Files (*.vrm)|*.vrm;||", NULL );
1020
1021TCHAR tchBuf[80];
1022
1023CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
1024CString initdir = (CASROOTValue + "\\..\\data\\vrml");
1025
1026dlg.m_ofn.lpstrInitialDir = initdir;
1027
1028 Standard_Boolean result;
1029
1030 if (dlg.DoModal() == IDOK) {
1031 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
1032 CString C = dlg.GetPathName();
1033 Standard_CString aFileName = (Standard_CString)(LPCTSTR)C;
1034 TCollection_AsciiString Message;
1035 result = SaveVRML(aFileName,aHSequenceOfShape,anArrayOfColors, anArrayOfTransparencies, Message);
1036 if (result)
1037 {
1038 // Display The Message :
1039 MessageBox(0,Message.ToCString(),"CasCade ",MB_OK);
1040 }
1041 else
1042 MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR);
1043 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
1044 }
1045 return result;
1046}
1047
1048Standard_Boolean CImportExport::SaveVRML(const Standard_CString& aFileName,
1049 const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape,
1050 const Handle(Quantity_HArray1OfColor)& anArrayOfColors,
1051 const Handle(TColStd_HArray1OfReal)& anArrayOfTransparencies,
1052 TCollection_AsciiString& ReturnMessage)
1053{
1054 Standard_Boolean ReturnValue = Standard_True;
1055 if (aHSequenceOfShape->Length() == 0)
1056 {
1057 MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING);
1058 return Standard_False;
1059 }
1060
1061 PTColStd_TransientPersistentMap aMap;
1062 ReturnMessage += "The Object has been saved in the file ";
1063 ReturnMessage += aFileName;
1064 ReturnMessage += "\n with the names : ";
1065
1066 // VRML scene.
1067 VrmlData_Scene scene;
1068 VrmlData_ShapeConvert converter(scene/*, 0.001*/); // from mm to meters
1069 Standard_Integer iShape = 1; // Counter of shapes
1070
1071 for ( int i = 1; i <= aHSequenceOfShape->Length(); i++ )
1072 {
1073 // Shape
1074 TopoDS_Shape shape = aHSequenceOfShape->Value( i );
1075 if ( shape.IsNull() )
1076 {
1077 ReturnMessage += " Error : Invalid shape \n";
1078 ReturnValue = Standard_False;
1079 continue;
1080 }
1081
1082 // Color
1083 Quantity_Color color; // yellow
1084 if (!anArrayOfColors.IsNull())
1085 color = anArrayOfColors->Value(i);
1086
1087 // Transparency
1088 Standard_Real transparency = 0.0;
1089 if (!anArrayOfTransparencies.IsNull())
1090 transparency = anArrayOfTransparencies->Value(i);
1091
1092 // Give a name to the shape.
1093 TCollection_AsciiString name("Shape");
1094 name += TCollection_AsciiString(iShape++);
1095 converter.AddShape(shape, name.ToCString());
1096 ReturnMessage += name;
1097 ReturnMessage += '\n';
1098
1099 // Check presence of faces in the shape.
1100 TopExp_Explorer expl(shape, TopAbs_FACE);
1101 if (expl.More())
1102 converter.Convert(true, false, 0.01); // faces only
1103 else
1104 converter.Convert(false, true, 0.01); // edges only
1105
1106 // Name of the color & transparency.
1107 // It will be uniquely saved in VRML file.
1108 TCollection_AsciiString cname = Quantity_Color::StringName(color.Name());
1109 cname += transparency;
1110
1111 // Make the appearance (VRML attribute)
1112 Handle(VrmlData_Appearance) appearance = Handle(VrmlData_Appearance)::DownCast(scene.FindNode(cname.ToCString()));
1113 if (appearance.IsNull())
1114 {
1115 // Not found ... create a new one.
1116 Handle(VrmlData_Material) material = new VrmlData_Material(scene, cname.ToCString(), 0.2, 0.2, transparency);
1117 material->SetDiffuseColor(color);
1118 material->SetEmissiveColor(color);
1119 material->SetSpecularColor(color);
1120 scene.AddNode(material, false);
1121 appearance = new VrmlData_Appearance(scene, cname.ToCString());
1122 appearance->SetMaterial(material);
1123 scene.AddNode(appearance, false);
1124 }
1125
1126 // Apply the material to the shape of entity.
1127 Handle(VrmlData_Group) group = Handle(VrmlData_Group)::DownCast(scene.FindNode(name.ToCString()));
1128 if (!group.IsNull())
1129 {
1130 VrmlData_ListOfNode::Iterator itr = group->NodeIterator();
1131 for (; itr.More(); itr.Next())
1132 {
1133 Handle(VrmlData_Node) node = itr.Value();
1134 if (node->DynamicType() == STANDARD_TYPE(VrmlData_ShapeNode))
1135 {
1136 Handle(VrmlData_ShapeNode) shape = Handle(VrmlData_ShapeNode)::DownCast(node);
1137 shape->SetAppearance(appearance);
1138 }
1139 else if (itr.Value()->DynamicType() == STANDARD_TYPE(VrmlData_Group))
1140 {
1141 Handle(VrmlData_Group) groupc = Handle(VrmlData_Group)::DownCast(itr.Value());
1142 VrmlData_ListOfNode::Iterator itrc = groupc->NodeIterator();
1143 for (; itrc.More(); itrc.Next())
1144 {
1145 Handle(VrmlData_Node) nodec = itrc.Value();
1146 if (nodec->DynamicType() == STANDARD_TYPE(VrmlData_ShapeNode))
1147 {
1148 Handle(VrmlData_ShapeNode) shapec = Handle(VrmlData_ShapeNode)::DownCast(nodec);
1149 shapec->SetAppearance(appearance);
1150 }
1151 } // for of group nodes...
1152 } // if (it is a shape node...
1153 } // for of group nodes...
1154 } // if (!group.IsNull...
1155 } // iterator of shapes
1156
1157 // Call VRML writer
1158 ofstream writer(aFileName);
1159 writer<<scene;
1160 writer.close();
1161
1162 /* Old approach to store shapes in VRML (without color & transparency).
1163 TopoDS_Compound RES;
1164 BRep_Builder MKCP;
1165 MKCP.MakeCompound(RES);
1166
1167 for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++)
1168 {
1169 TopoDS_Shape aShape= aHSequenceOfShape->Value(i);
1170 TCollection_AsciiString anObjectName("anObjectName_");
1171 anObjectName += i;
1172 ReturnMessage += anObjectName;
1173 ReturnMessage += " \n";
1174
1175 if ( aShape.IsNull() )
1176 {
1177 ReturnMessage += " Error : Invalid shape \n";
1178 ReturnValue = Standard_False;
1179 continue;
1180 }
1181
1182 MKCP.Add(RES, aShape);
1183 }
1184
1185 VrmlAPI_Writer myVrmlWriter;
1186 myVrmlWriter.Write(RES, aFileName);
1187 */
1188
1189 return ReturnValue;
1190}
1191
1192
1193
1194