DATAKIT SDK  V2026.3
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 );
21  Dtk_ErrorStatus GetFileVersion( const Dtk_string& inInputFile, Dtk_string& outVersion );
22  Dtk_ErrorStatus GetFilePreview( const Dtk_string& inInputFile, Dtk_PreviewPtr& outPreview );
23 
24  Dtk_ErrorStatus PopulateComponentsTree( const Dtk_string& inInputFile, Dtk_MainDocPtr& inoutDocument, Dtk_ComponentPtr& outRootComponent );
25  Dtk_ErrorStatus PopulateComponentsTree( const Dtk_tab< Dtk_StreamPtr >& inArrayStream, Dtk_MainDocPtr& inoutDocument, Dtk_ComponentPtr& outRootComponent );
27 
28  Dtk_ErrorStatus ReadComponent( const Dtk_ComponentPtr& inComponent, Dtk_NodePtr& outRootNode );
31 
34 
37 
40 
42 
43  //! [Options]
44  // ==== Specific settings for STEP Read ====
45  //! \ingroup step
46  //! \brief Select Parsing Mode on Reading
47  //! \param [in] inModeReader : 1 to use Datakit parser with full computation, 2 to use Datakit parser with light computation.
48  //! \remark Default mode is 1.
49  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
50  static Dtk_ErrorStatus SetParseMode( const int inModeReader );
51 
52  //! \ingroup step
53  //! \brief Select Mode to give priority to specific STEP PRODUCT fields for Dtk_Component naming
54  //! \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)
55  //! \remark Default mode is 1.
56  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
57  static Dtk_ErrorStatus SetComponentNameMode( const int inModeName );
58 
59 
60  enum class FDTRepresentation
61  {
62  GraphicalOnly = 0,
63  SemanticWithFrozenGraphicPriority = 1, //In cases where multiple graphical representation exist for a same FDT, give priority to the purely graphical one.
64  SemanticWithPlaceholderPriority = 2 //In cases where multiple graphical representation exist for a same FDT, give priority to the placeholder one.
65  };
66  //! \ingroup step
67  //! \brief Choose a representation mode for FDT. See FDTRepresentation enum for more details.
68  //! \param The desired FDTRepresentation
69  //! \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.
70  //! \remark Default mode is SemanticWithFrozenGraphicPriority.
71  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
73 
74  //! \ingroup step
75  //! \brief Set Mode to read properties and attributes (PROPERTY_DEFINITION), and to compute Validation Properties when present (result in the log file).
76  //! \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
77  //! \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.
78  //! \remark Computation of validation properties can be CPU consuming, that's why several levels of computation are proposed
79  //! \remark Default mode for properties is 0. Default mode for validation properties is 0.
80  //! //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
81  static Dtk_ErrorStatus SetModeProperty( const int inModeProp, const int inModeValProp = 0 );
82 
83  //! \ingroup step
84  //! \brief Set mode to choose the code page or encoding to be used in case of non-standard ASCII characters encountered
85  //! \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).
86  //! \remark These characters are NOT ALLOWED, but some writers can use them anyway.
87  //! \remark Default mode is 0.
88  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
89  static Dtk_ErrorStatus SetReadExtendedAsciiMode( const int inMode );
90 
91  //! \ingroup step
92  //! \brief Set Mode to read colors not correctly defined (that is, not in a list).
93  //! \param [in] inMode : 0 to ignore them, 1 to ignore them only if some colors are correctly defined, 2 to read them all.
94  //! \remark Default mode is 0.
95  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
96  static Dtk_ErrorStatus SetModeColorUnlisted( const int inMode );
97 
98  //! \ingroup step
99  //! \brief Set Mode to read orphan bodies (not belonging to a product), depending on the product structure of the STEP file.
100  //! \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.
101  //! \remark Default mode is 0.
102  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
103  static Dtk_ErrorStatus SetModeOrphanBody( const int inMode );
104 
105  //! \ingroup step
106  //! \brief Set Mode to propagate colors of a body (solid, surfacic ..) to its faces.
107  //! \param [in] inMode : DTK_TRUE to allow propagation, DTK_FALSE otherwise.
108  //! \remark Default mode is DTK_TRUE.
109  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
111 
112  //! \ingroup step
113  //! \brief Select Mode to get Description of Layer added to its name.
114  //! \param [in] inModeLayerName : DTK_FALSE to deactivate this mode, DTK_TRUE otherwise.
115  //! \remark When active, a LayerInfoSet is created with a Layer Filter per Layer, with its name and description, if not empty
116  //! \remark Default mode is DTK_FALSE.
117  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
119 
120  //! \ingroup step
121  //! \brief Define if we should try to process potentially corrupted file.
122  //! \param [in] inMode DTK_TRUE to allow invalid file reading, DTK_FALSE otherwise.
123  //! \remark Default mode is DTK_FALSE.
124  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
126  //! [Options]
127 
128  //! \ingroup step
129  //! \brief Activates/Deactivates Reading of FDT
130  //! \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
131  //! \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.
132  //! \remark Default mode is 2.
133  //! \warning call it after Dtk_API initialization and before the Dtk_API::OpenDocument call.
134  //! \deprecated Use StepReader::SetModeFDTRepresentation method instead.
135  SetAsDeprecated( "2025.4", "Use StepReader::SetModeFDTRepresentation method instead." )
136  static Dtk_ErrorStatus SetModeReadFDT( const int inMode );
137 
138  // ==== Fields and internal actions ====
139 
140 protected:
141 
142  class StepReader_Handle;
143  StepReader_Handle* _Private;
144 
145  Dtk_ErrorStatus InitReader( const Dtk_string& inInputFile );
146 
147 };
148 
149 #endif
150 
StepReader::SetComponentNameMode
static Dtk_ErrorStatus SetComponentNameMode(const int inModeName)
Select Mode to give priority to specific STEP PRODUCT fields for Dtk_Component naming.
StepReader::FDTRepresentation::SemanticWithFrozenGraphicPriority
@ SemanticWithFrozenGraphicPriority
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::FDTRepresentation::GraphicalOnly
@ GraphicalOnly
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:142
StepReader::Enable
static Dtk_bool Enable()
Dtk_bool
char Dtk_bool
Definition: define.h:724
StepReader::FDTRepresentation
FDTRepresentation
Definition: dtk_StepReader.hpp:61
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:236
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:686
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)
[Options]
StepReader::CreateDocumentGraphical
Dtk_ErrorStatus CreateDocumentGraphical(const Dtk_string &inInputFile, Dtk_MainDocPtr &outDocument)
StepReader::GetFilePreview
Dtk_ErrorStatus GetFilePreview(const Dtk_string &inInputFile, Dtk_PreviewPtr &outPreview)
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...
StepReader::ReadComponentGraphic
Dtk_ErrorStatus ReadComponentGraphic(const Dtk_ComponentPtr &inComponent, Dtk_GraphicalDataPtr &outGraphicalData)
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
StepReader::FDTRepresentation::SemanticWithPlaceholderPriority
@ SemanticWithPlaceholderPriority
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:560
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...