|
|
|||
File indexing completed on 2026-06-22 08:30:46
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 <ShapeProcess.hxx> 0021 #include <Standard.hxx> 0022 #include <Standard_DefineAlloc.hxx> 0023 #include <Standard_Handle.hxx> 0024 #include <Standard_Real.hxx> 0025 #include <IFSelect_ReturnStatus.hxx> 0026 #include <DESTEP_Parameters.hxx> 0027 #include <STEPControl_StepModelType.hxx> 0028 #include <Standard_Integer.hxx> 0029 #include <Message_ProgressRange.hxx> 0030 #include <XSAlgo_ShapeProcessor.hxx> 0031 0032 #include <unordered_map> 0033 0034 struct DE_ShapeFixParameters; 0035 class XSControl_WorkSession; 0036 class StepData_StepModel; 0037 class TopoDS_Shape; 0038 class Transfer_ActorOfFinderProcess; 0039 0040 //! This class creates and writes 0041 //! STEP files from Open CASCADE models. A STEP file can be 0042 //! written to an existing STEP file or to a new one. 0043 //! Translation can be performed in one or several operations. Each 0044 //! translation operation outputs a distinct root entity in the STEP file. 0045 class STEPControl_Writer 0046 { 0047 public: 0048 DEFINE_STANDARD_ALLOC 0049 0050 //! Creates a Writer from scratch 0051 Standard_EXPORT STEPControl_Writer(); 0052 0053 //! Creates a Writer from an already existing Session 0054 //! If <scratch> is True (D), clears already recorded data 0055 Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS, 0056 const Standard_Boolean scratch = Standard_True); 0057 0058 //! Sets a length-measure value that 0059 //! will be written to uncertainty-measure-with-unit 0060 //! when the next shape is translated. 0061 Standard_EXPORT void SetTolerance(const Standard_Real Tol); 0062 0063 //! Unsets the tolerance formerly forced by SetTolerance 0064 Standard_EXPORT void UnsetTolerance(); 0065 0066 //! Sets a specific session to <me> 0067 Standard_EXPORT void SetWS(const Handle(XSControl_WorkSession)& WS, 0068 const Standard_Boolean scratch = Standard_True); 0069 0070 //! Returns the session used in <me> 0071 Standard_EXPORT Handle(XSControl_WorkSession) WS() const; 0072 0073 //! Returns the produced model. Produces a new one if not yet done 0074 //! or if <newone> is True 0075 //! This method allows for instance to edit product or header 0076 //! data before writing. 0077 Standard_EXPORT Handle(StepData_StepModel) Model(const Standard_Boolean newone = Standard_False); 0078 0079 //! Translates shape sh to a STEP 0080 //! entity. mode defines the STEP entity type to be output: 0081 //! - STEPControlStd_AsIs translates a shape to its highest possible 0082 //! STEP representation. 0083 //! - STEPControlStd_ManifoldSolidBrep translates a shape to a STEP 0084 //! manifold_solid_brep or brep_with_voids entity. 0085 //! - STEPControlStd_FacetedBrep translates a shape into a STEP 0086 //! faceted_brep entity. 0087 //! - STEPControlStd_ShellBasedSurfaceModel translates a shape into a STEP 0088 //! shell_based_surface_model entity. 0089 //! - STEPControlStd_GeometricCurveSet translates a shape into a STEP 0090 //! geometric_curve_set entity. 0091 Standard_EXPORT IFSelect_ReturnStatus 0092 Transfer(const TopoDS_Shape& sh, 0093 const STEPControl_StepModelType mode, 0094 const Standard_Boolean compgraph = Standard_True, 0095 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0096 0097 //! Translates shape sh to a STEP entity 0098 Standard_EXPORT IFSelect_ReturnStatus 0099 Transfer(const TopoDS_Shape& sh, 0100 const STEPControl_StepModelType mode, 0101 const DESTEP_Parameters& theParams, 0102 const Standard_Boolean compgraph = Standard_True, 0103 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0104 0105 //! Writes a STEP model in the file identified by filename. 0106 Standard_EXPORT IFSelect_ReturnStatus Write(const Standard_CString theFileName); 0107 0108 //! Writes a STEP model in the std::ostream. 0109 Standard_EXPORT IFSelect_ReturnStatus WriteStream(std::ostream& theOStream); 0110 0111 //! Displays the statistics for the 0112 //! last translation. what defines the kind of statistics that are displayed: 0113 //! - 0 gives general statistics (number of translated roots, 0114 //! number of warnings, number of fail messages), 0115 //! - 1 gives root results, 0116 //! - 2 gives statistics for all checked entities, 0117 //! - 3 gives the list of translated entities, 0118 //! - 4 gives warning and fail messages, 0119 //! - 5 gives fail messages only. 0120 //! mode is used according to the use of what. If what is 0, mode is 0121 //! ignored. If what is 1, 2 or 3, mode defines the following: 0122 //! - 0 lists the numbers of STEP entities in a STEP model, 0123 //! - 1 gives the number, identifier, type and result type for each 0124 //! STEP entity and/or its status (fail, warning, etc.), 0125 //! - 2 gives maximum information for each STEP entity (i.e. checks), 0126 //! - 3 gives the number of entities by the type of a STEP entity, 0127 //! - 4 gives the number of of STEP entities per result type and/or status, 0128 //! - 5 gives the number of pairs (STEP or result type and status), 0129 //! - 6 gives the number of pairs (STEP or result type and status) 0130 //! AND the list of entity numbers in the STEP model. 0131 Standard_EXPORT void PrintStatsTransfer(const Standard_Integer what, 0132 const Standard_Integer mode = 0) const; 0133 0134 //! Sets parameters for shape processing. 0135 //! @param theParameters the parameters for shape processing. 0136 Standard_EXPORT void SetShapeFixParameters( 0137 const XSAlgo_ShapeProcessor::ParameterMap& theParameters); 0138 0139 //! Sets parameters for shape processing. 0140 //! Parameters are moved from the input map. 0141 //! @param theParameters the parameters for shape processing. 0142 Standard_EXPORT void SetShapeFixParameters(XSAlgo_ShapeProcessor::ParameterMap&& theParameters); 0143 0144 //! Sets parameters for shape processing. 0145 //! Parameters from @p theParameters are copied to the internal map. 0146 //! Parameters from @p theAdditionalParameters are copied to the internal map 0147 //! if they are not present in @p theParameters. 0148 //! @param theParameters the parameters for shape processing. 0149 //! @param theAdditionalParameters the additional parameters for shape processing. 0150 Standard_EXPORT void SetShapeFixParameters( 0151 const DE_ShapeFixParameters& theParameters, 0152 const XSAlgo_ShapeProcessor::ParameterMap& theAdditionalParameters = {}); 0153 0154 //! Returns parameters for shape processing that was set by SetParameters() method. 0155 //! @return the parameters for shape processing. Empty map if no parameters were set. 0156 Standard_EXPORT const XSAlgo_ShapeProcessor::ParameterMap& GetShapeFixParameters() const; 0157 0158 //! Sets flags defining operations to be performed on shapes. 0159 //! @param theFlags The flags defining operations to be performed on shapes. 0160 Standard_EXPORT void SetShapeProcessFlags(const ShapeProcess::OperationsFlags& theFlags); 0161 0162 //! Returns flags defining operations to be performed on shapes. 0163 //! @return Pair of values defining operations to be performed on shapes and a boolean value 0164 //! that indicates whether the flags were set. 0165 Standard_EXPORT const XSAlgo_ShapeProcessor::ProcessingFlags& GetShapeProcessFlags() const; 0166 0167 private: 0168 //! Returns the Actor for the Transfer of an Entity. 0169 //! This Actor is used by the Writer to perform the Transfer. 0170 //! @return the Actor for the Transfer of an Entity. May be nullptr. 0171 Handle(Transfer_ActorOfFinderProcess) GetActor() const; 0172 0173 //! If parameters haven't yet been provided, initializes them with default values 0174 //! provided by GetDefaultShapeFixParameters() method. 0175 void InitializeMissingParameters(); 0176 0177 private: 0178 Handle(XSControl_WorkSession) thesession; 0179 }; 0180 0181 #endif // _STEPControl_Writer_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|