Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:05

0001 // Created on: 1996-07-08
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _STEPControl_Writer_HeaderFile
0018 #define _STEPControl_Writer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Real.hxx>
0025 #include <IFSelect_ReturnStatus.hxx>
0026 #include <StepData_ConfParameters.hxx>
0027 #include <STEPControl_StepModelType.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <Message_ProgressRange.hxx>
0030 
0031 class XSControl_WorkSession;
0032 class StepData_StepModel;
0033 class TopoDS_Shape;
0034 
0035 
0036 //! This class creates and writes
0037 //! STEP files from Open CASCADE models. A STEP file can be
0038 //! written to an existing STEP file or to a new one.
0039 //! Translation can be performed in one or several operations. Each
0040 //! translation operation outputs a distinct root entity in the STEP file.
0041 class STEPControl_Writer 
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   
0048   //! Creates a Writer from scratch
0049   Standard_EXPORT STEPControl_Writer();
0050   
0051   //! Creates a Writer from an already existing Session
0052   //! If <scratch> is True (D), clears already recorded data
0053   Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
0054   
0055   //! Sets a length-measure value that
0056   //! will be written to uncertainty-measure-with-unit
0057   //! when the next shape is translated.
0058   Standard_EXPORT void SetTolerance (const Standard_Real Tol);
0059   
0060   //! Unsets the tolerance formerly forced by SetTolerance
0061   Standard_EXPORT void UnsetTolerance();
0062   
0063   //! Sets a specific session to <me>
0064   Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
0065   
0066   //! Returns the session used in <me>
0067   Standard_EXPORT Handle(XSControl_WorkSession) WS() const;
0068   
0069   //! Returns the produced model. Produces a new one if not yet done
0070   //! or if <newone> is True
0071   //! This method allows for instance to edit product or header
0072   //! data before writing.
0073   Standard_EXPORT Handle(StepData_StepModel) Model (const Standard_Boolean newone = Standard_False);
0074   
0075   //! Translates shape sh to a STEP
0076   //! entity. mode defines the STEP entity type to be output:
0077   //! - STEPControlStd_AsIs translates a shape to its highest possible
0078   //! STEP representation.
0079   //! - STEPControlStd_ManifoldSolidBrep translates a shape to a STEP
0080   //! manifold_solid_brep or brep_with_voids entity.
0081   //! - STEPControlStd_FacetedBrep translates a shape into a STEP
0082   //! faceted_brep entity.
0083   //! - STEPControlStd_ShellBasedSurfaceModel translates a shape into a STEP
0084   //! shell_based_surface_model entity.
0085   //! - STEPControlStd_GeometricCurveSet translates a shape into a STEP
0086   //! geometric_curve_set entity.
0087   Standard_EXPORT IFSelect_ReturnStatus Transfer
0088                    (const TopoDS_Shape& sh,
0089                     const STEPControl_StepModelType mode,
0090                     const Standard_Boolean compgraph = Standard_True,
0091                     const Message_ProgressRange& theProgress = Message_ProgressRange());
0092 
0093   //! Translates shape sh to a STEP entity
0094   Standard_EXPORT IFSelect_ReturnStatus Transfer
0095                    (const TopoDS_Shape& sh,
0096                     const STEPControl_StepModelType mode,
0097                     const StepData_ConfParameters& theParams,
0098                     const Standard_Boolean compgraph = Standard_True,
0099                     const Message_ProgressRange& theProgress = Message_ProgressRange());
0100 
0101   //! Writes a STEP model in the file identified by filename.
0102   Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
0103 
0104   //! Writes a STEP model in the std::ostream.
0105   Standard_EXPORT IFSelect_ReturnStatus WriteStream (std::ostream& theOStream);
0106 
0107   //! Displays the statistics for the
0108   //! last translation. what defines the kind of statistics that are displayed:
0109   //! - 0 gives general statistics   (number of translated roots,
0110   //! number of warnings, number of   fail messages),
0111   //! - 1 gives root results,
0112   //! - 2 gives statistics for all checked entities,
0113   //! - 3 gives the list of translated entities,
0114   //! - 4 gives warning and fail messages,
0115   //! - 5 gives fail messages only.
0116   //! mode is used according to the use of what. If what is 0, mode is
0117   //! ignored. If what is 1, 2 or 3, mode defines the following:
0118   //! - 0 lists the numbers of STEP entities in a STEP model,
0119   //! - 1 gives the number, identifier, type and result type for each
0120   //! STEP entity and/or its status (fail, warning, etc.),
0121   //! - 2 gives maximum information for each STEP entity (i.e. checks),
0122   //! - 3 gives the number of entities by the type of a STEP entity,
0123   //! - 4 gives the number of of STEP entities per result type and/or status,
0124   //! - 5 gives the number of pairs (STEP or result type and status),
0125   //! - 6 gives the number of pairs (STEP or result type and status)
0126   //! AND the list of entity numbers in the STEP model.
0127   Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
0128 
0129 
0130 
0131 
0132 protected:
0133 
0134 
0135 
0136 
0137 
0138 private:
0139 
0140 
0141 
0142   Handle(XSControl_WorkSession) thesession;
0143 
0144 
0145 };
0146 
0147 
0148 
0149 
0150 
0151 
0152 
0153 #endif // _STEPControl_Writer_HeaderFile