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