DATAKIT SDK  V2026.2
dtk_StepReader.hpp
Go to the documentation of this file.
1 /**********************************************************
2  STR_VR.H
3 ***********************************************************/
4 #ifndef _DTK_STEP_READER_H_
5 #define _DTK_STEP_READER_H_
6 #include "util/dtk_reader.hpp"
7 #include "def/define.h"
8 
9 class StepReader : public Dtk_Reader
10 {
11 public:
12 
14  virtual ~StepReader();
15 
16  static Dtk_bool Enable();
17 
18  // ==== General inherited actions ====
19  Dtk_ErrorStatus CreateDocument( const Dtk_string& inInputFile, Dtk_MainDocPtr& outDocument );
20  Dtk_ErrorStatus GetFileVersion( const Dtk_string& inInputFile, Dtk_string& outVersion );
21 
22  Dtk_ErrorStatus PopulateComponentsTree( const Dtk_string& inInputFile, Dtk_MainDocPtr& inoutDocument, Dtk_ComponentPtr& outRootComponent );
23  Dtk_ErrorStatus PopulateComponentsTree( const Dtk_tab< Dtk_StreamPtr >& inArrayStream, Dtk_MainDocPtr& inoutDocument, Dtk_ComponentPtr& outRootComponent );
25 
26  Dtk_ErrorStatus ReadComponent( const Dtk_ComponentPtr& inComponent, Dtk_NodePtr& outRootNode );
28 
31 
34 
37 
39 
40  //! [Options]
41  // ==== Specific settings for STEP Read ====
42  //! \ingroup step
43  //! \brief Select Parsing Mode on Reading
44  //! \param [in] inModeReader : 1 to use Datakit parser with full computation, 2 to use Datakit parser with light computation.
45  //! \remark Default mode is 1.
46  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
47  static Dtk_ErrorStatus SetParseMode( const int inModeReader );
48 
49  //! \ingroup step
50  //! \brief Select Mode to give priority to specific STEP PRODUCT fields for Dtk_Component naming
51  //! \param [in] inModeReader : 0 to consider only PRODUCT.ID, 1 to give priority to PRODUCT.ID, over PRODUCT.NAME (if not empty), 2 to give priority to PRODUCT.NAME, over PRODUCT.ID (if not empty), 3 to concatenate PRODUCT.ID and PRODUCT.NAME (if different)
52  //! \remark Default mode is 1.
53  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
54  static Dtk_ErrorStatus SetComponentNameMode( const int inModeName );
55 
56  //! \ingroup step
57  //! \brief Activates/Deactivates Reading of FDT
58  //! \param [in] inMode : 1 to read only FDT graphical information, 2 to read fully semantic FDT, and give priorirty to "frozen" graphics (3D tessellation, polylines), 3 to read fully semantic and give priorirty to the "placeholder" graphics
59  //! \remark "Placeholder" is a notion introduced in AP242E3, allowing to represent FDT graphics with light and minimal information. The receiving system is in charge of recreated the graphics based on those information.
60  //! \remark Default mode is 2.
61  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
62  //! \deprecated Use StepReader::SetModeFDTRepresentation method instead.
63  SetAsDeprecated( "2025.4", "Use StepReader::SetModeFDTRepresentation method instead." )
64  static Dtk_ErrorStatus SetModeReadFDT( const int inMode );
65 
66  enum class FDTRepresentation
67  {
68  GraphicalOnly = 0,
69  SemanticWithFrozenGraphicPriority = 1, //In cases where multiple graphical representation exist for a same FDT, give priority to the purely graphical one.
70  SemanticWithPlaceholderPriority = 2 //In cases where multiple graphical representation exist for a same FDT, give priority to the placeholder one.
71  };
72  //! \ingroup step
73  //! \brief Choose a representation mode for FDT. See FDTRepresentation enum for more details.
74  //! \param The desired FDTRepresentation
75  //! \remark "Placeholder" is a notion introduced in AP242E3, allowing to represent FDT graphics with light and minimal information. The receiving system is in charge of recreated the graphics based on those information.
76  //! \remark Default mode is SemanticWithFrozenGraphicPriority.
77  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
79 
80  //! \ingroup step
81  //! \brief Set Mode to read properties and attributes (PROPERTY_DEFINITION), and to compute Validation Properties when present (result in the log file).
82  //! \param [in] inModeProp : 0 to deactivate properties reading (default), 1 to read properties and record them in Dtk_Info, 2 to also read properties concerning Dtk_Component and record them as Dtk_Metadata, 3 to also read properties concerning Dtk_Component and record them both in Dtk_Info and as Dtk_Metadata
83  //! \param [in] inModeValProp optional : 0 to deactivate validation properties computation (default), 1 to compute only light validation properties (counts), 2 to compute also geometry-based validation properties (volume, area, center), 3 to compute cloud-of-points-based validation properties.
84  //! \remark Computation of validation properties can be CPU consuming, that's why several levels of computation are proposed
85  //! \remark Default mode for properties is 0. Default mode for validation properties is 0.
86  //! //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
87  static Dtk_ErrorStatus SetModeProperty( const int inModeProp, const int inModeValProp = 0 );
88 
89  //! \ingroup step
90  //! \brief Set mode to choose the code page or encoding to be used in case of non-standard ASCII characters encountered
91  //! \param [in] inModeExtAscii : 0 to use UTF-8, 1 to use code page 936 (Microsfot Windows, simplified chinese), 2 to use code page 855 (Cyrillic).
92  //! \remark These characters are NOT ALLOWED, but some writers can use them anyway.
93  //! \remark Default mode is 0.
94  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
95  static Dtk_ErrorStatus SetReadExtendedAsciiMode( const int inMode );
96 
97  //! \ingroup step
98  //! \brief Set Mode to read colors not correctly defined (that is, not in a list).
99  //! \param [in] inMode : 0 to ignore them, 1 to ignore them only if some colors are correctly defined, 2 to read them all.
100  //! \remark Default mode is 0.
101  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
102  static Dtk_ErrorStatus SetModeColorUnlisted( const int inMode );
103 
104  //! \ingroup step
105  //! \brief Set Mode to read orphan bodies (not belonging to a product), depending on the product structure of the STEP file.
106  //! \param [in] inMode : 0 to ingore them , 1 to ignore them only if no product is defined, 2 to ignore them only if no product is defined, or several products are defined but no assembly, 3 to read them all.
107  //! \remark Default mode is 0.
108  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
109  static Dtk_ErrorStatus SetModeOrphanBody( const int inMode );
110 
111  //! \ingroup step
112  //! \brief Set Mode to propagate colors of a body (solid, surfacic ..) to its faces.
113  //! \param [in] inMode : DTK_TRUE to allow propagation, DTK_FALSE otherwise.
114  //! \remark Default mode is DTK_TRUE.
115  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
117 
118  //! \ingroup step
119  //! \brief Select Mode to get Description of Layer added to its name.
120  //! \param [in] inModeLayerName : DTK_FALSE to deactivate this mode, DTK_TRUE otherwise.
121  //! \remark When active, a LayerInfoSet is created with a Layer Filter per Layer, with its name and description, if not empty
122  //! \remark Default mode is DTK_FALSE.
123  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
125 
126  //! \ingroup step
127  //! \brief Define if we should try to process potentially corrupted file.
128  //! \param [in] inMode DTK_TRUE to allow invalid file reading, DTK_FALSE otherwise.
129  //! \remark Default mode is DTK_FALSE.
130  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
132  //! [Options]
133 
134 
135  // ==== Fields and internal actions ====
136 
137 protected:
138 
139  class StepReader_Handle;
140  StepReader_Handle* _Private;
141 
142  Dtk_ErrorStatus InitReader( const Dtk_string& inInputFile );
143 
144 };
145 
146 #endif
147 
StepReader::SetComponentNameMode
static Dtk_ErrorStatus SetComponentNameMode(const int inModeName)
Select Mode to give priority to specific STEP PRODUCT fields for Dtk_Component naming.
StepReader::ReadAdditionalInfos
Dtk_ErrorStatus ReadAdditionalInfos(Dtk_Node &inNode, Dtk_ObjectPtr &outEntity)
StepReader::ReadEntity
Dtk_ErrorStatus ReadEntity(Dtk_Node &inNode, Dtk_EntityPtr &outEntity)
StepReader::PopulateComponentsTree
Dtk_ErrorStatus PopulateComponentsTree(const Dtk_tab< Dtk_StreamPtr > &inArrayStream, Dtk_MainDocPtr &inoutDocument, Dtk_ComponentPtr &outRootComponent)
StepReader::SetModeOrphanBody
static Dtk_ErrorStatus SetModeOrphanBody(const int inMode)
Set Mode to read orphan bodies (not belonging to a product), depending on the product structure of th...
StepReader::EndPopulateComponentsTree
Dtk_ErrorStatus EndPopulateComponentsTree()
Dtk_Reader
Definition: dtk_reader.hpp:15
StepReader::SetParseMode
static Dtk_ErrorStatus SetParseMode(const int inModeReader)
[Options]
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
StepReader::GetVersion
Dtk_Int32 GetVersion()
StepReader::SetModeColorUnlisted
static Dtk_ErrorStatus SetModeColorUnlisted(const int inMode)
Set Mode to read colors not correctly defined (that is, not in a list).
StepReader::_Private
StepReader_Handle * _Private
Definition: dtk_StepReader.hpp:139
StepReader::Enable
static Dtk_bool Enable()
Dtk_bool
char Dtk_bool
Definition: define.h:717
StepReader::FDTRepresentation
FDTRepresentation
Definition: dtk_StepReader.hpp:67
StepReader::PopulateComponentsTree
Dtk_ErrorStatus PopulateComponentsTree(const Dtk_string &inInputFile, Dtk_MainDocPtr &inoutDocument, Dtk_ComponentPtr &outRootComponent)
StepReader::GetAssociatedEntities
Dtk_ErrorStatus GetAssociatedEntities(Dtk_Node &inNode, Dtk_tab< Dtk_NodeConnectorPtr > &outAssociatedEntities)
StepReader::GetConnectorsPointingToThisComponent
Dtk_ErrorStatus GetConnectorsPointingToThisComponent(Dtk_Component &inCompo, Dtk_tab< Dtk_NodeConnectorPtr > &outConnectedEntities)
StepReader::ReadComponent
Dtk_ErrorStatus ReadComponent(const Dtk_ComponentPtr &inComponent, Dtk_NodePtr &outRootNode)
StepReader::ActivateReader
Dtk_ErrorStatus ActivateReader()
StepReader::SetAllowReadInvalidFiles
static Dtk_ErrorStatus SetAllowReadInvalidFiles(const Dtk_bool inMode)
Define if we should try to process potentially corrupted file.
StepReader::DesactivateReader
Dtk_ErrorStatus DesactivateReader()
StepReader::InitReader
Dtk_ErrorStatus InitReader(const Dtk_string &inInputFile)
Dtk_Node
This is the Node Class.
Definition: dtk_maindoc.hpp:231
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:679
StepReader::SetLayerDescriptionMode
static Dtk_ErrorStatus SetLayerDescriptionMode(const Dtk_bool inMode)
Select Mode to get Description of Layer added to its name.
StepReader::SetModePropagateColor
static Dtk_ErrorStatus SetModePropagateColor(const Dtk_bool inMode)
Set Mode to propagate colors of a body (solid, surfacic ..) to its faces.
StepReader::StepReader
StepReader()
StepReader::CreateDocument
Dtk_ErrorStatus CreateDocument(const Dtk_string &inInputFile, Dtk_MainDocPtr &outDocument)
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
StepReader::SetAsDeprecated
SetAsDeprecated("2025.4", "Use StepReader::SetModeFDTRepresentation method instead.") static Dtk_ErrorStatus SetModeReadFDT(const int inMode)
Activates/Deactivates Reading of FDT.
define.h
StepReader
Definition: dtk_StepReader.hpp:10
StepReader::SetReadExtendedAsciiMode
static Dtk_ErrorStatus SetReadExtendedAsciiMode(const int inMode)
Set mode to choose the code page or encoding to be used in case of non-standard ASCII characters enco...
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
StepReader::EndComponent
Dtk_ErrorStatus EndComponent(Dtk_ComponentPtr &inComponent)
Dtk_Component
This is the Component Class. The Dtk_ComponentPtr object is used as element into an assembly tree....
Definition: dtk_maindoc.hpp:555
StepReader::~StepReader
virtual ~StepReader()
dtk_reader.hpp
StepReader::GetFileVersion
Dtk_ErrorStatus GetFileVersion(const Dtk_string &inInputFile, Dtk_string &outVersion)
StepReader::SetModeFDTRepresentation
static Dtk_ErrorStatus SetModeFDTRepresentation(FDTRepresentation)
Choose a representation mode for FDT. See FDTRepresentation enum for more details.
StepReader::SetModeProperty
static Dtk_ErrorStatus SetModeProperty(const int inModeProp, const int inModeValProp=0)
Set Mode to read properties and attributes (PROPERTY_DEFINITION), and to compute Validation Propertie...