DATAKIT SDK  V2026.2
ugw.hpp
Go to the documentation of this file.
1 /**********************************************************
2 UGW.H
3 ***********************************************************/
4 #ifndef _UGW_H
5 #define _UGW_H
6 
7 #define DTK_UGW_VERSION_NX5 45
8 #define DTK_UGW_VERSION_NX1980 60
9 #define DTK_UGW_VERSION_NX2212 63
10 
11 namespace Ugw
12 {
14  {
15  enum Unit
16  {
17  inch = 0, millimeters = 1
18  };
22  {
25  double density;
27  {
29  };
32  density( 7830.640 ), density_unit( kg_m3 )
33  {}
34  };
38  {
39  struct General
40  {
43  General():width(0.35) {} // or default (-1)
44  };
47  {
48  def.col = Dtk_RGB( 0, 0, 192 );
49  def.width = 0.70;
50  }
51  };
53 
55  background_color_bottom( Dtk_RGB( 230, 230, 230 ) )
56  {}
57  };
58 
59  //! \ingroup UG_write
60  //! \brief Initialize UG Writer.
61  //! \param [in] inFilename : Name of output file to write.
62  //! \param [in] inVersiontowrite : Version to write, only UGW_VERSION_NX5 available for now
63  //! \param [in] inDef : Default datas
64  //! \return dtkNoError if ok.
65  Dtk_ErrorStatus InitFile( const Dtk_string& inFilename, int inVersiontowrite = DTK_UGW_VERSION_NX5, const DefaultParameters& inDef = DefaultParameters() );
66 
67  //! Deprecated
68  Dtk_ErrorStatus InitFile( const Dtk_string& inFilename,
69  int inVersiontowrite, int inUnitasmm, int inMultithread = 0 );
70 
71 
72  //! \ingroup UG_write
73  //! \brief Add a body inside the file.
74  //! \param [in] inBody : Body to add.
75  //! \remark Body Infos->AddAttribute("NXGROUPS",chain) to set groups, see example.
76  //! \return dtkNoError if ok.
78 
79  //! \ingroup UG_write
80  //! \brief Add a mesh inside the file.
81  //! \param [in] inMesh : Mesh to add.
82  //! \return dtkNoError if ok.
84 
85 
86  //! \ingroup UG_write
87  //! \brief Add a pmi inside the file.
88  //! \param [in] inPmi : Pmi to add.
89  //! \remark Actually just some annotations are supported, see documentation
90  //! \return dtkNoError if ok, dtkErrorCannotCompute if not supported Pmi
92 
93  //! \ingroup UG_write
94  //! \brief Add an axis system into the current node.
95  //! \param [in] inAxisSystem : axis system to Write.
96  //! \remark, in info field, SetName to set FeatureName, AddAttribute("NXNAME") to set the object name
97  //! \return dtkNoError if ok.
99 
100  //! \ingroup UG_write
101  //! \brief Add a reference geometry into the current node.
102  //! \remark Stored is a body as one face with plane for reference plane, trimmed reference plane for fixed reference plane, wire segment for reference axis, wire point for reference point
103  //! \param [in] inRefgeom : reference geometry to Write.
104  //! \remark, in info field, SetName to set FeatureName, AddAttribute("NXNAME") to set the object name
105  //! \return dtkNoError if ok.
107 
108  //! \ingroup UG_write
109  //! \brief Add a MetaData in the current component
110  //! \param [in] inMeta : Metadata to add.
111  //! \remark Special Metadatas with Category = "Modeling Preferences"
112  //! \remark Title = "Distance Tolerance" & Value = tolerance in mm
113  //! \remark Title = "Angle Tolerance" & Value = tolerance in degree
114  //! \remark Title = "Density" & Value = Density
115  //! \remark Title = "Density Units" & Value = "lb/in3" or "lb/ft3" or "g/m3" or "kg/m3"
116  //! \return dtkNoError if ok.
118 
119  //! \ingroup UG_write
120  //! \brief deprecated
122  const Dtk_string& inProtoFileName,
123  Dtk_bool& outWasAlreadyInstancied,
124  const Dtk_transfo& inTrans,
125  const Dtk_RGB& inRgb);
126  //! \ingroup UG_write
127  //! \brief Open an child instance to write an assembly
128  //! \param [in] inProtoFileName : Prototypename, also file name : for a subassembly reinstancied, this name must be the same for all instances
129  //! \param [in] inTrans : Matrix of this instance. Dtk_transfo() for identity Matrix
130  //! \param [in] inInfos : Additional informations, see options supported
131  //! \remark inInfos->SetName(InstanceName) to give an instance name (default instance has same name as part)
132  //! \remark inInfos->SetColor(Dtk_Rgb) to give an instance color
133  //! \remark inInfos->SetBlankedStatus(1) to set component as invisible
134  //! \remark inInfos->SetLayer(l) to set a specific component layer
135  //! \return dtkNoError if ok.
136  Dtk_ErrorStatus OpenInstance(const Dtk_string& inProtoFileName,
137  const Dtk_transfo& inTrans, Dtk_InfoPtr inInfos);
138 
139  //! \ingroup UG_write
140  //! \brief Open an extern file to add as instance in current assembly, inProtoFileName must be in the output directory. Just give name without path and extension
141  //! \param [in] inProtoFileName : Prototypename, also file name : for a subassembly reinstancied, this name must be the same for all instances
142  //! \param [in] inTrans : Matrix of this instance. Dtk_transfo() for identity Matrix
143  //! \param [in] inInfos : Additional informations, see options supported; same as OpenInstance
144  //! \param [in] innxread_getdata : Function nxread_getdata of Datakit NXReader, retrieving subassemblies from extern, can be NULL.
146  const Dtk_transfo& inTrans, Dtk_InfoPtr inInfos, void(*innxread_getdata)(const Dtk_string&, void*&));
147 
148  //! \ingroup UG_write
149  //! \brief Get color value and color name from the palette
150  //! \param [in] inIth : Color index, from 0 (background) to 216 (max color index)
151  //! \param [out] outColor : Color to retrieve
152  //! \param [out] outColorname : Color name to retrieve
153  //! \return dtkNoError if ok.
154  Dtk_ErrorStatus GetColorInTable(size_t inIth, Dtk_RGB& outColor, Dtk_string& outColorname);
155 
156  //! \ingroup UG_write
157  //! \brief Replace color value and color name on the palette
158  //! \param [in] inIth : Color index, from 0 (background) to 216 included (max color index)
159  //! \param [in] inColor : Color to set
160  //! \param [in] inColorname : Color name to set
161  //! \return dtkNoError if ok.
162  Dtk_ErrorStatus SetColorInTable(size_t inIth, const Dtk_RGB& inColor, const Dtk_string& inColorname);
163 
164  //! \ingroup UG_write
165  //! \brief Import a color palette
166  //! \param [in] InCdfFile : Cdf file to import
167  //! \return dtkNoError if ok.
169 
170  //! \ingroup UG_write
171  //! \brief define Data for layers
172  //! \param [in] inLayerDataSet : LayerDataSet, see example
173  //! \remark default visibles and selectables
175  const Dtk_tab<Dtk_Int32> & unused2 = Dtk_tab<Dtk_Int32>());
176 
177  //! \remark Deprecated, use SetGroupDatas
178  Dtk_ErrorStatus SetGroupVisibility(const Dtk_string& inGroupName, Dtk_bool inVisible);
179 
180  //! \ingroup UG_write
181  //! \brief define Visibility for a specific group
182  //! \param [in] inGroupName : Name of group
183  //! \param [in] inInfos : Additional informations, see options supported
184  //! \remark inInfos->SetBlankedStatus(1) to set component as invisible
185  //! \remark inInfos->SetLayer(l) to set a specific component layer
186  //! \remark inInfos->AddAttribute("NXGROUPS",chain) create an empty group, see example
187  Dtk_ErrorStatus SetGroupDatas(const Dtk_string& inGroupName, Dtk_InfoPtr inInfos);
188 
189  //! \ingroup UG_write
190  //! \brief Add a Parasolid file as body inside the file.
191  //! \param [in] inFlux : Raw parasolid file to add.
192  //! \param [in] inSize : Size of flux.
193  //! \param [in] inInf : Additionnal informations. (name, visibility, default colors)
194  //! \return dtkNoError if ok.
195  Dtk_ErrorStatus WriteExternParasolidBody(const char* inFlux, size_t inSize, const Dtk_InfoPtr& inInf);
196 
197  //! \ingroup UG_write
198  //! \brief Add a JT file as lightweight body inside the file.
199  //! \param [in] inFlux : Raw JT file to add.
200  //! \param [in] inSize : Size of flux.
201  //! \param [in] inInf : Additionnal informations. (name, visibility, default colors)
202  //! \return dtkNoError if ok.
203  Dtk_ErrorStatus WriteExternJtMesh(const char* inFlux, size_t inSize, const Dtk_InfoPtr& inInf);
204 
205  //! \ingroup UG_write
206  //! \brief Close the last instance
207  //! \return dtkNoError if ok.
209 
210  //! \ingroup UG_write.
211  //! \brief Close the UG file.
212  //! \return dtkNoError if ok.
214 
215 }
216 
217 #endif
218 
Ugw::DefaultParameters
Definition: ugw.hpp:14
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Ugw::DefaultParameters::ObjectPreferences::solid_body
General solid_body
Definition: ugw.hpp:45
Ugw::DefaultParameters::inch
@ inch
Definition: ugw.hpp:17
Ugw::ImportCdfColorfile
Dtk_ErrorStatus ImportCdfColorfile(const Dtk_string &InCdfFile)
Import a color palette.
Ugw::WriteAxisSystem
Dtk_ErrorStatus WriteAxisSystem(const Dtk_AxisSystemPtr &inAxisSystem)
Add an axis system into the current node.
Ugw::DefaultParameters::objectpreferences
ObjectPreferences objectpreferences
Definition: ugw.hpp:52
Ugw::SetColorInTable
Dtk_ErrorStatus SetColorInTable(size_t inIth, const Dtk_RGB &inColor, const Dtk_string &inColorname)
Replace color value and color name on the palette.
Ugw::SetLayerData
Dtk_ErrorStatus SetLayerData(const Dtk_LayerInfosSetPtr &inLayerDataSet, const Dtk_tab< Dtk_Int32 > &unused1=Dtk_tab< Dtk_Int32 >(), const Dtk_tab< Dtk_Int32 > &unused2=Dtk_tab< Dtk_Int32 >())
define Data for layers
Ugw::DefaultParameters::ModelingPreferences::DensityUnit
DensityUnit
Definition: ugw.hpp:27
Ugw::AddExternInstance
Dtk_ErrorStatus AddExternInstance(const Dtk_string &inProtoFileName, const Dtk_transfo &inTrans, Dtk_InfoPtr inInfos, void(*innxread_getdata)(const Dtk_string &, void *&))
Open an extern file to add as instance in current assembly, inProtoFileName must be in the output dir...
Ugw::DefaultParameters::millimeters
@ millimeters
Definition: ugw.hpp:17
DTK_UGW_VERSION_NX5
#define DTK_UGW_VERSION_NX5
Definition: ugw.hpp:7
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Ugw::WriteReferenceGeometry
Dtk_ErrorStatus WriteReferenceGeometry(const Dtk_BodyPtr &inRefgeom)
Add a reference geometry into the current node.
Ugw::DefaultParameters::ModelingPreferences::ModelingPreferences
ModelingPreferences()
Definition: ugw.hpp:31
Ugw::WriteExternJtMesh
Dtk_ErrorStatus WriteExternJtMesh(const char *inFlux, size_t inSize, const Dtk_InfoPtr &inInf)
Add a JT file as lightweight body inside the file.
Ugw::WriteBody
Dtk_ErrorStatus WriteBody(const Dtk_BodyPtr &inBody)
Add a body inside the file.
Dtk_bool
char Dtk_bool
Definition: define.h:717
Dtk_Double64
double Dtk_Double64
Definition: define.h:691
Ugw::DefaultParameters::asm_multithread
bool asm_multithread
Definition: ugw.hpp:20
Ugw::DefaultParameters::ObjectPreferences::General::col
Dtk_RGB col
Definition: ugw.hpp:41
Ugw::DefaultParameters::ModelingPreferences::g_m3
@ g_m3
Definition: ugw.hpp:28
Ugw::DefaultParameters::ModelingPreferences::distance_tolerance
double distance_tolerance
Definition: ugw.hpp:23
Ugw::WritePMI
Dtk_ErrorStatus WritePMI(const Dtk_FdtPtr &inPmi)
Add a pmi inside the file.
Ugw::WriteExternParasolidBody
Dtk_ErrorStatus WriteExternParasolidBody(const char *inFlux, size_t inSize, const Dtk_InfoPtr &inInf)
Add a Parasolid file as body inside the file.
Ugw::DefaultParameters::ObjectPreferences::General::General
General()
Definition: ugw.hpp:43
Ugw::CloseLastInstance
Dtk_ErrorStatus CloseLastInstance()
Close the last instance.
Ugw::DefaultParameters::background_color_top
Dtk_RGB background_color_top
Definition: ugw.hpp:36
Ugw::SetGroupDatas
Dtk_ErrorStatus SetGroupDatas(const Dtk_string &inGroupName, Dtk_InfoPtr inInfos)
define Visibility for a specific group
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Ugw::DefaultParameters::ObjectPreferences::def
General def
Definition: ugw.hpp:45
Ugw::SetGroupVisibility
Dtk_ErrorStatus SetGroupVisibility(const Dtk_string &inGroupName, Dtk_bool inVisible)
Ugw::DefaultParameters::ObjectPreferences
Definition: ugw.hpp:38
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
Ugw::GetColorInTable
Dtk_ErrorStatus GetColorInTable(size_t inIth, Dtk_RGB &outColor, Dtk_string &outColorname)
Get color value and color name from the palette.
Ugw::DefaultParameters::background_color_bottom
Dtk_RGB background_color_bottom
Definition: ugw.hpp:36
Ugw::DefaultParameters::modelingpreferences
ModelingPreferences modelingpreferences
Definition: ugw.hpp:35
Ugw::DefaultParameters::unit
Unit unit
Definition: ugw.hpp:19
Ugw::DefaultParameters::DefaultParameters
DefaultParameters()
Definition: ugw.hpp:54
Ugw::DefaultParameters::ModelingPreferences::density
double density
Definition: ugw.hpp:25
Ugw::DefaultParameters::ModelingPreferences::density_unit
DensityUnit density_unit
Definition: ugw.hpp:30
Ugw::DefaultParameters::ModelingPreferences::lb_ft3
@ lb_ft3
Definition: ugw.hpp:28
Ugw::DefaultParameters::ObjectPreferences::General
Definition: ugw.hpp:40
Dtk_tab< Dtk_Int32 >
Ugw::WriteMesh
Dtk_ErrorStatus WriteMesh(const Dtk_MeshPtr &inMesh)
Add a mesh inside the file.
Ugw::AddMetaData
Dtk_ErrorStatus AddMetaData(const Dtk_MetaDataPtr &inMeta)
Add a MetaData in the current component.
Ugw::InitFile
Dtk_ErrorStatus InitFile(const Dtk_string &inFilename, int inVersiontowrite=45, const DefaultParameters &inDef=DefaultParameters())
Initialize UG Writer.
Ugw::OpenInstance
Dtk_ErrorStatus OpenInstance(const Dtk_string &inInstanceName, const Dtk_string &inProtoFileName, Dtk_bool &outWasAlreadyInstancied, const Dtk_transfo &inTrans, const Dtk_RGB &inRgb)
deprecated
Ugw::DefaultParameters::ObjectPreferences::ObjectPreferences
ObjectPreferences()
Definition: ugw.hpp:46
Ugw::DefaultParameters::ModelingPreferences::angle_tolerance
double angle_tolerance
Definition: ugw.hpp:24
Ugw
Definition: ugw.hpp:12
Ugw::DefaultParameters::ModelingPreferences::kg_m3
@ kg_m3
Definition: ugw.hpp:28
Ugw::DefaultParameters::ObjectPreferences::General::width
Dtk_Double64 width
Definition: ugw.hpp:42
Ugw::DefaultParameters::ModelingPreferences::lb_in3
@ lb_in3
Definition: ugw.hpp:28
Ugw::DefaultParameters::ObjectPreferences::sheet_body
General sheet_body
Definition: ugw.hpp:45
catiav5w::inInstanceName
const Dtk_string & inInstanceName
Definition: catiav5w.hpp:621
Dtk_RGB
Definition: dtk_rgb.hpp:7
Ugw::EndFile
Dtk_ErrorStatus EndFile()
Close the UG file.
Ugw::DefaultParameters::Unit
Unit
Definition: ugw.hpp:16
Ugw::DefaultParameters::ModelingPreferences
Definition: ugw.hpp:22