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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _STEPControl_Writer_HeaderFile
18 #define _STEPControl_Writer_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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>
30 class XSControl_WorkSession;
31 class StepData_StepModel;
35 //! This class creates and writes
36 //! STEP files from Open CASCADE models. A STEP file can be
37 //! written to an existing STEP file or to a new one.
38 //! Translation can be performed in one or several operations. Each
39 //! translation operation outputs a distinct root entity in the STEP file.
40 class STEPControl_Writer
47 //! Creates a Writer from scratch
48 Standard_EXPORT STEPControl_Writer();
50 //! Creates a Writer from an already existing Session
51 //! If <scratch> is True (D), clears already recorded data
52 Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
54 //! Sets a length-measure value that
55 //! will be written to uncertainty-measure-with-unit
56 //! when the next shape is translated.
57 Standard_EXPORT void SetTolerance (const Standard_Real Tol);
59 //! Unsets the tolerance formerly forced by SetTolerance
60 Standard_EXPORT void UnsetTolerance();
62 //! Sets a specific session to <me>
63 Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
65 //! Returns the session used in <me>
66 Standard_EXPORT Handle(XSControl_WorkSession) WS() const;
68 //! Returns the produced model. Produces a new one if not yet done
69 //! or if <newone> is True
70 //! This method allows for instance to edit product or header
71 //! data before writing.
72 Standard_EXPORT Handle(StepData_StepModel) Model (const Standard_Boolean newone = Standard_False);
74 //! Translates shape sh to a STEP
75 //! entity. mode defines the STEP entity type to be output:
76 //! - STEPControlStd_AsIs translates a shape to its highest possible
77 //! STEP representation.
78 //! - STEPControlStd_ManifoldSolidBrep translates a shape to a STEP
79 //! manifold_solid_brep or brep_with_voids entity.
80 //! - STEPControlStd_FacetedBrep translates a shape into a STEP
81 //! faceted_brep entity.
82 //! - STEPControlStd_ShellBasedSurfaceModel translates a shape into a STEP
83 //! shell_based_surface_model entity.
84 //! - STEPControlStd_GeometricCurveSet translates a shape into a STEP
85 //! geometric_curve_set entity.
86 Standard_EXPORT IFSelect_ReturnStatus Transfer (const TopoDS_Shape& sh, const STEPControl_StepModelType mode, const Standard_Boolean compgraph = Standard_True);
88 //! Writes a STEP model in the file identified by filename.
89 Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString filename);
91 //! Displays the statistics for the
92 //! last translation. what defines the kind of statistics that are displayed:
93 //! - 0 gives general statistics (number of translated roots,
94 //! number of warnings, number of fail messages),
95 //! - 1 gives root results,
96 //! - 2 gives statistics for all checked entities,
97 //! - 3 gives the list of translated entities,
98 //! - 4 gives warning and fail messages,
99 //! - 5 gives fail messages only.
100 //! mode is used according to the use of what. If what is 0, mode is
101 //! ignored. If what is 1, 2 or 3, mode defines the following:
102 //! - 0 lists the numbers of STEP entities in a STEP model,
103 //! - 1 gives the number, identifier, type and result type for each
104 //! STEP entity and/or its status (fail, warning, etc.),
105 //! - 2 gives maximum information for each STEP entity (i.e. checks),
106 //! - 3 gives the number of entities by the type of a STEP entity,
107 //! - 4 gives the number of of STEP entities per result type and/or status,
108 //! - 5 gives the number of pairs (STEP or result type and status),
109 //! - 6 gives the number of pairs (STEP or result type and status)
110 //! AND the list of entity numbers in the STEP model.
111 Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
126 Handle(XSControl_WorkSession) thesession;
137 #endif // _STEPControl_Writer_HeaderFile