42cf5bc1 |
1 | // Created on: 1994-10-13 |
2 | // Created by: Marc LEGAY |
3 | // Copyright (c) 1994-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _RWStl_HeaderFile |
18 | #define _RWStl_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
e8862cf4 |
23 | #include <Message_ProgressIndicator.hxx> |
42cf5bc1 |
24 | |
42cf5bc1 |
25 | class StlMesh_Mesh; |
26 | class OSD_Path; |
42cf5bc1 |
27 | |
28 | //! This package contains the methods to be used in |
29 | //! the Stereo Lithograpy Application. The main |
30 | //! features of this application are ,starting from a |
31 | //! Shape : |
32 | //! - mesh this shape with a maximun tolerance, |
33 | //! - display the meshing, |
34 | //! - write the meshing in a file (binary or ascii), |
35 | //! - read of file (binary or ascii) and display it, |
36 | //! - translate a binary file to an ascii file, |
37 | //! - translate an ascii file to an binary file. |
38 | class RWStl |
39 | { |
40 | public: |
41 | |
42 | DEFINE_STANDARD_ALLOC |
43 | |
44 | |
45 | //! write the meshing in a file following the |
46 | //! binary format of an STL file. |
47 | //! Returns false if the cannot be opened; |
48 | Standard_EXPORT static Standard_Boolean WriteBinary (const Handle(StlMesh_Mesh)& aMesh, const OSD_Path& aPath, const Handle(Message_ProgressIndicator)& aProgInd = NULL); |
49 | |
50 | //! write the meshing in a file following the |
51 | //! Ascii format of an STL file. |
52 | //! Returns false if the cannot be opened; |
53 | Standard_EXPORT static Standard_Boolean WriteAscii (const Handle(StlMesh_Mesh)& aMesh, const OSD_Path& aPath, const Handle(Message_ProgressIndicator)& aProgInd = NULL); |
54 | |
55 | //! This method will chwck if the file is a binary |
56 | //! file or an AsciiFile testing the 5 first |
57 | //! characters of the file wich are :"solid" in an |
58 | //! ascii file. If we do not find that word we assume |
59 | //! that it is a binary file. |
60 | Standard_EXPORT static Handle(StlMesh_Mesh) ReadFile (const OSD_Path& aPath, const Handle(Message_ProgressIndicator)& aProgInd = NULL); |
61 | |
62 | //! Read a meshing from a binary file |
63 | //! Raises NoMoreObject from Standard if a statement |
64 | //! does not contain the right number of tokens |
65 | //! Raises TypeMisMatch if a token has not the good |
66 | //! type (often real) |
67 | Standard_EXPORT static Handle(StlMesh_Mesh) ReadBinary (const OSD_Path& aPath, const Handle(Message_ProgressIndicator)& aProgInd = NULL); |
68 | |
69 | //! Read a meshing from a binary file |
70 | //! Raises NoMoreObject from Standard if a statement |
71 | //! does not contain the right number of tokens |
72 | //! Raises TypeMisMatch if a token has not the good |
73 | //! type (often real) |
74 | //! Raises MoMoreObject if a file is finished before |
75 | //! having found the word endsolid; |
76 | Standard_EXPORT static Handle(StlMesh_Mesh) ReadAscii (const OSD_Path& aPath, const Handle(Message_ProgressIndicator)& aProgInd = NULL); |
77 | |
78 | |
79 | |
80 | |
81 | protected: |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | private: |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | }; |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | #endif // _RWStl_HeaderFile |