42cf5bc1 |
1 | // Created on: 1996-07-08 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1996-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 _STEPControl_Writer_HeaderFile |
18 | #define _STEPControl_Writer_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <IFSelect_ReturnStatus.hxx> |
27 | #include <STEPControl_StepModelType.hxx> |
28 | #include <Standard_CString.hxx> |
29 | #include <Standard_Integer.hxx> |
7e785937 |
30 | #include <Message_ProgressRange.hxx> |
31 | |
42cf5bc1 |
32 | class XSControl_WorkSession; |
33 | class StepData_StepModel; |
34 | class TopoDS_Shape; |
35 | |
36 | |
37 | //! This class creates and writes |
38 | //! STEP files from Open CASCADE models. A STEP file can be |
39 | //! written to an existing STEP file or to a new one. |
40 | //! Translation can be performed in one or several operations. Each |
41 | //! translation operation outputs a distinct root entity in the STEP file. |
42 | class STEPControl_Writer |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
49 | //! Creates a Writer from scratch |
50 | Standard_EXPORT STEPControl_Writer(); |
51 | |
52 | //! Creates a Writer from an already existing Session |
53 | //! If <scratch> is True (D), clears already recorded data |
54 | Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); |
55 | |
56 | //! Sets a length-measure value that |
57 | //! will be written to uncertainty-measure-with-unit |
58 | //! when the next shape is translated. |
59 | Standard_EXPORT void SetTolerance (const Standard_Real Tol); |
60 | |
61 | //! Unsets the tolerance formerly forced by SetTolerance |
62 | Standard_EXPORT void UnsetTolerance(); |
63 | |
64 | //! Sets a specific session to <me> |
65 | Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); |
66 | |
67 | //! Returns the session used in <me> |
68 | Standard_EXPORT Handle(XSControl_WorkSession) WS() const; |
69 | |
70 | //! Returns the produced model. Produces a new one if not yet done |
71 | //! or if <newone> is True |
72 | //! This method allows for instance to edit product or header |
73 | //! data before writing. |
74 | Standard_EXPORT Handle(StepData_StepModel) Model (const Standard_Boolean newone = Standard_False); |
75 | |
76 | //! Translates shape sh to a STEP |
77 | //! entity. mode defines the STEP entity type to be output: |
78 | //! - STEPControlStd_AsIs translates a shape to its highest possible |
79 | //! STEP representation. |
80 | //! - STEPControlStd_ManifoldSolidBrep translates a shape to a STEP |
81 | //! manifold_solid_brep or brep_with_voids entity. |
82 | //! - STEPControlStd_FacetedBrep translates a shape into a STEP |
83 | //! faceted_brep entity. |
84 | //! - STEPControlStd_ShellBasedSurfaceModel translates a shape into a STEP |
85 | //! shell_based_surface_model entity. |
86 | //! - STEPControlStd_GeometricCurveSet translates a shape into a STEP |
87 | //! geometric_curve_set entity. |
7e785937 |
88 | Standard_EXPORT IFSelect_ReturnStatus Transfer |
89 | (const TopoDS_Shape& sh, |
90 | const STEPControl_StepModelType mode, |
91 | const Standard_Boolean compgraph = Standard_True, |
92 | const Message_ProgressRange& theProgress = Message_ProgressRange()); |
42cf5bc1 |
93 | |
94 | //! Writes a STEP model in the file identified by filename. |
95 | Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename); |
96 | |
97 | //! Displays the statistics for the |
98 | //! last translation. what defines the kind of statistics that are displayed: |
99 | //! - 0 gives general statistics (number of translated roots, |
100 | //! number of warnings, number of fail messages), |
101 | //! - 1 gives root results, |
102 | //! - 2 gives statistics for all checked entities, |
103 | //! - 3 gives the list of translated entities, |
104 | //! - 4 gives warning and fail messages, |
105 | //! - 5 gives fail messages only. |
106 | //! mode is used according to the use of what. If what is 0, mode is |
107 | //! ignored. If what is 1, 2 or 3, mode defines the following: |
108 | //! - 0 lists the numbers of STEP entities in a STEP model, |
109 | //! - 1 gives the number, identifier, type and result type for each |
110 | //! STEP entity and/or its status (fail, warning, etc.), |
111 | //! - 2 gives maximum information for each STEP entity (i.e. checks), |
112 | //! - 3 gives the number of entities by the type of a STEP entity, |
113 | //! - 4 gives the number of of STEP entities per result type and/or status, |
114 | //! - 5 gives the number of pairs (STEP or result type and status), |
115 | //! - 6 gives the number of pairs (STEP or result type and status) |
116 | //! AND the list of entity numbers in the STEP model. |
117 | Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const; |
118 | |
119 | |
120 | |
121 | |
122 | protected: |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | private: |
129 | |
130 | |
131 | |
132 | Handle(XSControl_WorkSession) thesession; |
133 | |
134 | |
135 | }; |
136 | |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | #endif // _STEPControl_Writer_HeaderFile |