summaryrefslogtreecommitdiff
path: root/inc/StlAPI_Writer.hxx
blob: 3b6ccfc2e51b70bc1d99b698f4aa60e58486a910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _StlAPI_Writer_HeaderFile
#define _StlAPI_Writer_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Handle_StlMesh_Mesh_HeaderFile
#include <Handle_StlMesh_Mesh.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
class StlMesh_Mesh;
class TopoDS_Shape;


//! This class creates and writes <br>
//! STL files from Open CASCADE shapes. An STL file can be <br>
//! written to an existing STL file or to a new one.. <br>
class StlAPI_Writer  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Creates a writer object with <br>
//! default parameters: ASCIIMode, RelativeMode, SetCoefficent, <br>
//! SetDeflection. These parameters may be modified. <br>
  Standard_EXPORT   StlAPI_Writer();
  //! Sets the deflection of the meshing algorithm. <br>
//!    Deflection is used, only if relative mode is false <br>
  Standard_EXPORT     void SetDeflection(const Standard_Real aDeflection) ;
  //! Sets the coeffiecient for computation of deflection through <br>
//!          relative size of shape. Default value = 0.001 <br>
  Standard_EXPORT     void SetCoefficient(const Standard_Real aCoefficient) ;
  //! Returns the address to the <br>
//! flag defining the relative mode for writing the file. <br>
//! This address may be used to either read or change the flag. <br>
//! If the mode returns True (default value), the <br>
//! deflection is calculated from the relative size of the <br>
//! shape. If the mode returns False, the user defined deflection is used. <br>
//! Example <br>
//! Read: <br>
//! Standard_Boolean val = Writer.RelativeMode( ); <br>
//! Modify: <br>
//! Writer.RelativeMode( ) = Standard_True; <br>
  Standard_EXPORT     Standard_Boolean& RelativeMode() ;
  //! Returns the address to the <br>
//! flag defining the mode for writing the file. This address <br>
//! may be used to either read or change the flag. <br>
//! If the mode returns True (default value) the generated <br>
//! file is an ASCII file. If the mode returns False, the <br>
//! generated file is a binary file. <br>
  Standard_EXPORT     Standard_Boolean& ASCIIMode() ;
  //! Converts a given shape to STL format and writes it to file with a given filename. <br>
  Standard_EXPORT     void Write(const TopoDS_Shape& aShape,const Standard_CString aFileName) ;





protected:





private:



Standard_Boolean theRelativeMode;
Standard_Boolean theASCIIMode;
Standard_Real theDeflection;
Standard_Real theCoefficient;
Handle_StlMesh_Mesh theStlMesh;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif