DATAKIT SDK  V2026.4
catiav5w.hpp
Go to the documentation of this file.
1 #ifndef __DTK_CATIAV5W_H__
2 #define __DTK_CATIAV5W_H__
3 
4 #include "def/define.h"
5 #include "struct/str_def.h"
6 
12 #include "util/error_dtk.hpp"
13 
14 #include "util/util_stl_dtk.hpp"
15 #include "util/util_ptr_dtk.hpp"
16 #include "util/util_ent_dtk.hpp"
17 ////////////////////////////////////////////////////////////
18 // catiav5w.h //
19 ////////////////////////////////////////////////////////////
20 
21 
22 
23 //! \brief Exported APIs for CatiaV5 Write Library
24 namespace catiav5w
25 {
27  typedef Dtk_ID MaterialId;
28 
29  //! \class WriteOptions
30  //! \brief This class provides several options to tunes CatiaV5 Writter.\n
31  //! It must be provided to catiav5w::InitWrite method.
32  //! \code
33  //! //...
34  //! Dtk_string LogFile = L"MyLogFile.log";
35  //! catiav5w::WriteOptions V5Options;
36  //! V5Options.WriteReferencePlaneAsHidden();
37  //! Dtk_ErrorStatus err = catiav5w::InitWrite( LogFile, NULL, V5Options);
38  //! //...
39  //! \endcode
41  {
42  protected:
43  //! \brief Option to write reference planes as hidden or visible - visible by default -
44  //! \sa WriteReferencePlaneAsHidden()
45  //! \sa WriteReferencePlaneAsVisible()
46  //! \sa AreReferencePlanesWrittenAsHidden()
49  public:
50  //! \BaseConstructor
52  {
53  }
54 
55  //! \BaseDestructor
57  {
58  }
59 
60  //! \brief Sets the reference plane writting as hidden.
61  //! \sa WriteReferencePlaneAsVisible()
63  {
65  }
66 
67  //! \brief Sets the reference plane writting as visible.
68  //! \sa WriteReferencePlaneAsHidden()
70  {
72  }
73 
74  //! \brief Tells if the reference planes are written as hidden.
75  //! \return DTK_TRUE if the reference planes are written as hidden DTK_FALSE else.
77  {
79  }
80 
81  //! \brief Sets the release for the written files.
82  //! \brief The valid versions are 14 and from 19 to GetMaximumFileReleaseHandled().
83  //! You can have more information from the API documentation.
84  //! \param [in] inRelease : The file release.
85  //! \return dtkNoError if success.
86  //! \return dtkErrorVersionNotSupported if fails. In this case, the 14 release number will be be used.
88  //! \brief Retrieve the Written file release.
89  inline Dtk_UInt32 GetFileRelease() const
90  {
91  return _FileRelease;
92  }
93  //! \brief Return the maximum file release number handled by the writer.
95  };
96 
97  //! \brief This is the wrapper class handling V5 write material data.
98  class Material
99  {
100  public:
101  class Lighting
102  {
103  protected:
112 
114  public:
116  {
117  //default values
118  //No color
119  //No Coefficient
120  m_AmbientCoefficient = -1.0;
121  m_DiffuseCoefficient = -1.0;
122  m_SpecularCoefficient = -1.0;
125  }
126  inline void SetAmbientData( const Dtk_RGB& inAmbientColor, const Dtk_Double64 inAmbientCoefficient )
127  {
128  m_AmbientColor = inAmbientColor;
129  m_AmbientCoefficient = ( ( inAmbientCoefficient > 1. ) || ( inAmbientCoefficient < 0. ) ) ? 1. : inAmbientCoefficient;
130  }
131  inline void SetDiffuseData( const Dtk_RGB& inDiffuseColor, const Dtk_Double64 inDiffuseCoefficient )
132  {
133  m_DiffuseColor = inDiffuseColor;
134  m_DiffuseCoefficient = ( ( inDiffuseCoefficient > 1. ) || ( inDiffuseCoefficient < 0. ) ) ? 1. : inDiffuseCoefficient;
135  }
136  inline void SetSpecularData( const Dtk_RGB& inSpecularColor, const Dtk_Double64 inSpecularCoefficient )
137  {
138  m_SpecularColor = inSpecularColor;
139  m_SpecularCoefficient = ( ( inSpecularCoefficient > 1. ) || ( inSpecularCoefficient < 0. ) ) ? 0. : inSpecularCoefficient;
140  }
141  inline void SetTransparencyData( const Dtk_RGB& inTransparencyColor, const Dtk_Double64 inTransparencyCoefficient )
142  {
143  m_TransparencyColor = inTransparencyColor;
144  m_TransparencyCoefficient = ( ( inTransparencyCoefficient > 1. ) || ( inTransparencyCoefficient < 0. ) ) ? 0. : inTransparencyCoefficient;
145  }
146  inline void SetReflectivityCoefficient( const Dtk_Double64 inReflectivityCoefficient )
147  {
148  m_ReflectivityCoefficient = ( ( inReflectivityCoefficient > 1. ) || ( inReflectivityCoefficient < 0. ) ) ? 0. : inReflectivityCoefficient;
149  }
150  inline const Dtk_RGB& GetAmbientColor() const { return m_AmbientColor; }
151  inline const Dtk_RGB& GetDiffuseColor() const { return m_DiffuseColor; }
152  inline const Dtk_RGB& GetSpecularColor() const { return m_SpecularColor; }
153  inline const Dtk_RGB& GetTransparencyColor() const { return m_TransparencyColor; }
159  };
160 
161  class Analysis
162  {
163  protected:
165  public:
167  {
168  //default values
169  m_Density = -1.0; //default no density
170  }
171  inline void SetDensity( const Dtk_Double64 inDensity ) { m_Density = inDensity; }
172  inline Dtk_Double64 GetDensity() const { return m_Density; }
173  };
174 
175  public:
179  public:
180 
181  Material( const Dtk_string& inName = L"" )
182  {
183  m_Name = inName;
184  }
185  };
186 
187 
188 
189 
190  //! \class FileDescription
191  //! \brief This class provides several informations about a CatiaV5 File.\n
192  //! It can be used with catiav5w::InitPart and catiav5w::InitProduct functions to specify file properties.
193  //! \code
194  //! //...
195  //! catiav5w::FileDescription Desc;
196  //! Desc.SetDefinition(L"MyDef");
197  //! Desc.SetDescription(L"MyDesc");
198  //! Desc.SetRevision(L"MyRev");
199  //! Desc.SetNomenclature(L"MyNom");
200  //! Desc.SetSourceType(catiav5w::FileDescription::Bought);
201  //! Dtk_UUID PartUUID = catiav5w::InitPart( inOutputFile, inReferenceName, Desc);
202  //! //...
203  //! \endcode
205  {
206  public:
207 
209  {
210  Unknown = 0,
212  Bought
213  };
214  protected:
215 
217  //! \brief Revision of the CatiaV5 File
219  //! \brief Definition of the CatiaV5 File
221  //! \brief Nomenclature of the CatiaV5 File
223  //! \brief Description of the CatiaV5 File
225  //! \brief Source Type of the CatiaV5 File.
227 
229 
231 
232  public:
233 
234  //! \BaseConstructor
236  {
237  _SourceType = Unknown; _PartDensity = -1.0;
238  }
239 
240  //! \BaseDestructor
242  {
243  }
244 
245  //! \brief Sets the file root material
246  //! \sa GetPartMaterial()
247  inline void SetPartMaterial( const catiav5w::Material& inMaterial )
248  {
249  m_PartMaterial = inMaterial;
250  }
251 
252  //! \brief Sets the file revision
253  //! \sa GetRevision()
254  inline void SetRevision( const Dtk_string& inRevision )
255  {
256  _Revision = inRevision;
257  }
258 
259  //! \brief Sets the file definition
260  //! \sa GetDefinition()
261  inline void SetDefinition( const Dtk_string& inDefinition )
262  {
263  _Definition = inDefinition;
264  }
265 
266  //! \brief Sets the file nomenclature
267  //! \sa GetNomenclature()
268  inline void SetNomenclature( const Dtk_string& inNomenclature )
269  {
270  _Nomenclature = inNomenclature;
271  }
272 
273  //! \brief Sets the file description
274  //! \sa GetDescription()
275  inline void SetDescription( const Dtk_string& inDescription )
276  {
277  _Description = inDescription;
278  }
279 
280  //! \brief Sets the file source type
281  //! \sa GetSourceType()
282  inline void SetSourceType( const ProductSourceType& inSourceType )
283  {
284  _SourceType = inSourceType;
285  }
286 
287 
288  //! \brief Adds an additional double property.
289  inline void AddDoubleProperty( const Dtk_string& inPropertyName, const double& inValue )
290  {
291  Dtk_string TmpValue = inValue;
293  TmpProp->SetTitle( inPropertyName );
294  TmpProp->SetAsReal();
295  TmpProp->SetValue( TmpValue );
296 
297  _AdditionalProperties.push_back( TmpProp );
298  }
299 
300  //! \brief Adds an additional integer property.
301  inline void AddIntegerProperty( const Dtk_string& inPropertyName, const Dtk_Int32& inValue )
302  {
303  Dtk_string TmpValue;
304  TmpValue.convert_from_int( inValue );
306  TmpProp->SetTitle( inPropertyName );
307  TmpProp->SetAsInteger();
308  TmpProp->SetValue( TmpValue );
309 
310  _AdditionalProperties.push_back( TmpProp );
311  }
312 
313 
314  //! \brief Adds an additional integer property.
315  inline void AddBooleanProperty( const Dtk_string& inPropertyName, const Dtk_bool& inValue )
316  {
317  Dtk_string TmpValue;
318  TmpValue.convert_from_int( inValue );
320  TmpProp->SetTitle( inPropertyName );
321  TmpProp->SetAsBoolean();
322  TmpProp->SetValue( TmpValue );
323 
324  _AdditionalProperties.push_back( TmpProp );
325  }
326 
327  //! \brief Adds an additional integer property.
328  inline void AddStringProperty( const Dtk_string& inPropertyName, const Dtk_string& inValue )
329  {
331  TmpProp->SetTitle( inPropertyName );
332  TmpProp->SetType( L"STRING" );
333  TmpProp->SetValue( inValue );
334 
335  _AdditionalProperties.push_back( TmpProp );
336  }
337  //! \brief Retrieves the file root material - read only -
338  //! \return The file root material
339  //! \sa SetPartMaterial()
340  inline const catiav5w::Material& GetPartMaterial() const
341  {
342  return m_PartMaterial;
343  }
344 
345  //! \brief Retrieves the file revision - read only -
346  //! \return The file revision
347  //! \sa SetRevision()
348  inline const Dtk_string& GetRevision() const
349  {
350  return _Revision;
351  }
352 
353  //! \brief Retrieves the file definition - read only -
354  //! \return The file definition
355  //! \sa SetDefinition()
356  inline const Dtk_string& GetDefinition() const
357  {
358  return _Definition;
359  }
360 
361  //! \brief Retrieves the file nomenclature - read only -
362  //! \return The file nomenclature
363  //! \sa SetNomenclature()
364  inline const Dtk_string& GetNomenclature() const
365  {
366  return _Nomenclature;
367  }
368 
369  //! \brief Retrieves the file description - read only -
370  //! \return The file description
371  //! \sa SetDescription()
372  inline const Dtk_string& GetDescription() const
373  {
374  return _Description;
375  }
376 
377  //! \brief Retrieves the file source type - read only -
378  //! \return The file source type
379  //! \sa SetSourceType()
380  inline const ProductSourceType& GetSourceType() const
381  {
382  return _SourceType;
383  }
384 
385  //! \brief Retrieves the file source type - read only -
386  //! \return The file source type
387  //! \sa SetSourceType()
389  {
390  return _AdditionalProperties.size();
391  }
392 
393  //! \brief Retrieves the file source type - read only -
394  //! \return The file source type
395  //! \sa SetSourceType()
396  inline const Dtk_PropertiesPtr& GetIthAdditionalProperties( const Dtk_Size_t& inPos ) const
397  {
398  return _AdditionalProperties[ inPos ];
399  }
400 
401  };
402 
403 
404  //! \brief Type of Specification Tree Node used into a CATPart file.
405  //! \brief The type of geometrical entities depends of the Node Type.Type of Specification Tree Node used into a CATPart file.
406  //! \brief You can create Bodies into a NodeTypePartBody (Hybrid Body) node and into NodeTypeMechanicalTool nodes.
407  //! \brief You can create Surfacic entities into NodeTypeGeometricSet nodes and into NodeTypePartBody (Hybrid Body) nodes.
408  enum NodeType
409  {
412  NodeTypePartBody = 2,//hybrid bodies
414  };
415 
416  //! \brief Initialize the Catia V5 Writer
417  //! \return dtkNoError if it is OK.
418  //! \remark This is the first function called for the writer.
419  //! \param [in] inLogFile : Log file
420  //! \param [in] inLicFct : Licence fuction or Null
421  Dtk_ErrorStatus InitWrite( const Dtk_string& inLogFile, Licence_dtk inLicFct, const WriteOptions& inOptions = WriteOptions() );
422 
423 
424  //! \brief Tells if the Write Module has been initialized or not.
425  //! \return DTK_TRUE if the Writer Module has been initialized, DTK_FALSE else.
427 
428  //! \deprecated Use Dtk_ErrorStatus catiav5w::InitPart( const Dtk_string&, const Dtk_string&, Dtk_UUID&, const catiav5w::FileDescription& ) method instead.
429  SetAsDeprecated( "2024.2", "Use Dtk_ErrorStatus catiav5w::InitPart( const Dtk_string&, const Dtk_string&, Dtk_UUID&, const catiav5w::FileDescription& ) method instead." )
430  Dtk_UUID InitPart_Deprecated242(
431  const Dtk_string &inOutputFile,
434 
435  //! \brief Initialize the part
436  //! \return dtkNoError if it is OK.
437  //! \remark used at the beginning of conversion.
438  //! \param [in] inOutputFile : Name of the CATPart to be Written.
439  //! \param [in] inReferenceName : Reference Name - visible at the Specification Tree Root -
440  //! \param [out] outPartUUID : The Dtk_UUID of the created CATPart.
441  //! \param [in] inFileDescription : Description File
442  //! \remarks The output file name will be checked to see if it's V5 application compliant. See http://catiadoc.free.fr/online/basug_C2/basugbt0402.htm for more explanations. If the fullpath is invalid an error will be retrurn and no file will be created.
443  //! \remarks The given path into inOutputFile must exist and you must have write permission in this folder.
444  //! \remarks InitPart/EndPart calls can't be nested. You have to call EndPart before calling InitPart another time.
446  const Dtk_string &inOutputFile,
448  Dtk_UUID& outPartUUID,
450 
451  //! \brief Free data allocated by catiav5w::InitPart
452  //! \return dtkNoError if it is OK.
453  //! \remark used at the end of conversion.
454  //! \remarks InitPart/EndPart calls can't be nested. You have to call EndPart before calling InitPart another time.
456 
457  //! \brief Free the Catia V5 Writer
458  //! \return dtkNoError if it is OK.
459  //! \remark used at the last function used for the writer.
461 
462  //! \brief Write the entity provided in parameter.
463  //! \param [in] inEntity : The Entity to be written
464  //! \return dtkNoError if it is OK.
465  //! \remark This function is used to write entities.
467 
468  //! \brief Write the given ModelDisplay as NamedView - V5 camera -.
469  //! \param [in] inNamedView : The NamedViewntity to be written
470  //! \return dtkNoError if it is OK.
472 
473  //! \brief Create a node in the Specification Tree.
474  //! \param [in] inNodeType : The Node Type.
475  //! \param [in] inNodeName : The Node Name.
476  //! \return dtkNoError if it is OK.
477  //! \return dtkErrorUnspecified if Node type is unknown.
478  //! \remark The catiav5w::NodeTypeGeometricSet type must be used for surfaces and WireFrame.
479  //! \remark For Solid, the catiav5w::NodeTypePartBody must be used.
480  Dtk_ErrorStatus CreateNode( const NodeType& inNodeType, const Dtk_string& inNodeName = Dtk_string() );
481 
482  //! \brief Create a node in the Specification Tree.
483  //! \param [in] inNodeType : The Node Type.
484  //! \param [in] inInfos : The Node Infos including Name/layer.
485  //! \return dtkNoError if it is OK.
486  //! \return dtkErrorUnspecified if Node type is unknown.
487  //! \remark The catiav5w::NodeTypeGeometricSet type must be used for surfaces and WireFrame.
488  //! \remark For Solid, the catiav5w::NodeTypePartBody must be used.
489  //! \remark At this moment only Name and Layer informations are handled.
490  Dtk_ErrorStatus CreateNode( const NodeType& inNodeType, const Dtk_InfoPtr& inInfos );
491 
492  //! \brief close the current node previously created by catiav5w::CreateNode.
493  //! \return dtkNoError if it is OK.
495 
496  //! \brief Adds a double paramater
497  //! \param [in] inParameterName : The parameter name.
498  //! \param [in] inValue : The parameter value.
499  //! \return dtkNoError if it is OK.
500  //! \remark This function must be called between InitPart/InitProduct and EndPart/EndProduct calls.
501  Dtk_ErrorStatus AddDoubleParameter( const Dtk_string& inParameterName, const Dtk_Double64& inValue );
502 
503  //! \brief Adds a integer paramater
504  //! \param [in] inParameterName : The parameter name.
505  //! \param [in] inValue : The parameter value.
506  //! \return dtkNoError if it is OK.
507  //! \remark This function must be called between InitPart/InitProduct and EndPart/EndProduct calls.
508  Dtk_ErrorStatus AddIntegerParameter( const Dtk_string& inParameterName, const Dtk_Int32& inValue );
509 
510  //! \brief Adds a boolean paramater
511  //! \param [in] inParameterName : The parameter name.
512  //! \param [in] inValue : The parameter value.
513  //! \return dtkNoError if it is OK.
514  //! \remark This function must be called between InitPart/InitProduct and EndPart/EndProduct calls.
515  Dtk_ErrorStatus AddBooleanParameter( const Dtk_string& inParameterName, const Dtk_bool& inValue );
516 
517  //! \brief Adds a string paramater
518  //! \param [in] inParameterName : The parameter name.
519  //! \param [in] inValue : The parameter value.
520  //! \return dtkNoError if it is OK.
521  //! \remark This function must be called between InitPart/InitProduct and EndPart/EndProduct calls.
522  Dtk_ErrorStatus AddStringParameter( const Dtk_string& inParameterName, const Dtk_string& inValue );
523 
524 
525  //! \brief Create a Part Reference and DocID related to a given CATPart.
526  //! \param [in] inPartFileName : Name of the CATPart to be linked.
527  //! \param [in] inPartName : CATPart Reference.
528  //! \param [out] outDocId : Resulting CATPart DocId - used by catiav5w::AddInstance -.
529  //! \return dtkNoError if it is OK.
530  //! \remark The given CATPart may have been created in the same DATAKIT V5 Writer instance or not - external file -
532  const Dtk_string& inPartName,
533  Dtk_ID& outDocId );
534 
535  //! \brief Create a Product Reference and DocID related to a given CATProduct.
536  //! \param [in] inPartFileName : Name of the CATProduct to be linked.
537  //! \param [in] inPartName : CATProduct Reference.
538  //! \param [out] outDocId : Resulting CATProduct DocId - used by catiav5w::AddInstance -.
539  //! \return dtkNoError if it is OK.
540  //! \remark The given CATProduct may have been created in the same DATAKIT V5 Writer instance or not - external file -
542  const Dtk_string& inPartName,
543  Dtk_ID& outDocId );
544 
545  //! \brief Create a CGR Reference and DocID related to a given CGR File.
546  //! \param [in] inCGRFileName : Name of the CGR to be linked.
547  //! \param [in] inCGRName : CGR Reference.
548  //! \param [out] outDocId : Resulting CGR DocId - used by catiav5w::AddInstance -.
549  //! \return dtkNoError if it is OK.
551  const Dtk_string& inCGRName,
552  Dtk_ID& outDocId );
553 
554  //! \brief Create a V4 Model Reference and DocID related to a given V4 Model File.
555  //! \param [in] inV4ModelFileName : Name of the V4 Model to be linked.
556  //! \param [in] inV4ModelName : V4 Model Reference.
557  //! \param [out] outDocId : Resulting V4 Model DocId - used by catiav5w::AddInstance -.
558  //! \remark Only .model V4 files can be linked to a CATProduct.
559  //! \return dtkNoError if it is OK.
560  Dtk_ErrorStatus CreateV4ModelDocId( const Dtk_string& inV4ModelFileName,
561  const Dtk_string& inV4ModelName,
562  Dtk_ID& outDocId );
563 
564  //! \brief Initialize a sub Product during CATProduct process.
565  //! \param [in] inFileName : Name of the CATProduct to be written.
566  //! \param [in] inReferenceName : Reference Name - visible at the Specification Tree Root -
567  //! \param [in] inFileDescription : Description File
568  //! \return dtkNoError if it is OK.
569  //! \remarks The given path into inFileName must exist and you must have write permission in this folder.
570  //! \remarks InitProduct/EndProduct calls can't be nested. You have to call EndProduct before calling InitProduct another time.
572  const Dtk_string& inFileName,
575 
576  //! \brief Write effectively the Sub Product initialized by catiav5w::InitProduct.
577  //! \brief This function also retrieve the resulting Sub CATProduct DocID
578  //! \param [out] outDocId : The resulting CATProduct DocId - used by catiav5w::AddInstance -.
579  //! \return dtkNoError if it is OK.
580  //! \remarks InitProduct/EndProduct calls can't be nested. You have to call EndProduct before calling InitProduct another time.
582 
583  //! \brief Add an instance to a DocID into the Current (Sub/Root) CATProduct.
584  //! \param [in] inDocId : DocID of an already written file
585  //! provided by catiav5w::CreatePartDocId / catiav5w::CreateCGRDocId / catiav5w::CreateV4ModelDocId / catiav5w::EndProduct functions-.
586  //! \param [in] inInstanceName : Instance Name.
587  //! \param [in] inTransfo : Transformation Matrix applicated to the instance.
588  //! \param [out] outInstanceId : returned Instance ID or 0 in case of error.
589  //! \return dtkNoError if it is OK.
591  const Dtk_string& inInstanceName,
592  const Dtk_transfo& inTransfo,
593  Dtk_ID& outInstanceId );
594  //! \brief Initialize a virtual component during CATProduct process.
595  //! \param [in] inReferenceName : Component Reference Name - visible at the Specification Tree Root -
596  //! \param [in] inFileDescription : Description File
597  //! \return dtkNoError if it is OK.
601 
602  //! \brief End - and write - the virtual component initialized by catiav5w::InitVirtualComponent.
603  //! \brief This function also retrieve the resulting Sub CATProduct DocID
604  //! \param [out] outDocId : The resulting Component DocId - used by catiav5w::AddVirtualComponentInstance -.
605  //! \return dtkNoError if it is OK.
607 
608  //! \brief Add an instance to a DocID into the Current (Sub/Root) CATProduct.
609  //! \param [in] inDocId : DocID of an already created Component
610  //! provided by catiav5w::EndVirtualComponent function-.
611  //! \param [in] inInstanceName : Instance Name.
612  //! \param [in] inTransfo : Transformation Matrix applicated to the instance.
613  //! \return dtkNoError if it is OK.
614  //! \remarks You must use the inDocId in the same Product context as the catiav5w::EndVirtualComponent call. If not you will obtain an error.
616  const Dtk_string& inInstanceName,
617  const Dtk_transfo& inTransfo,
618  Dtk_ID& outInstanceId );
619 
620  //! \brief Override the Blanked Status of an instance in a Sub Product.
621  //! \param [in] inInstanceId : InstanceID of an already created instance
622  //! provided by catiav5w::AddInstance or catiav5w::AddVirtualComponentInstance functions.
623  //! \param [in] inBlankedStatus : Blankeds Status - 0 = Visible / 1 = Blanked -. Default value: 0.
624  //! \return dtkNoError if it is OK.
625  //! \remarks You must use this function between InitProduct/EndProduct to have a product context where you override the attribute.
626  Dtk_ErrorStatus OverrideBlankedStatusWithPathID( const PathID& inInstancePathId, const Dtk_bool inBlankedStatus );
627 
628  //! \brief Override the Color of an instance in a Sub Product.
629  //! \param [in] inInstanceId : InstanceID of an already created instance
630  //! provided by catiav5w::AddInstance or catiav5w::AddVirtualComponentInstance functions.
631  //! \param [in] inInstanceColor : Instance Color.
632  //! \return dtkNoError if it is OK.
633  //! \remarks You must use this function between InitProduct/EndProduct to have a product context where you override the attribute.
634  Dtk_ErrorStatus OverrideInstanceColorWithPathID( const PathID& inInstancePathId, const Dtk_RGB& inInstanceColor );
635 
636  //! \brief Override the Alpha of an instance in a Sub Product.
637  //! \param [in] inInstanceId : InstanceID of an already created instance
638  //! provided by catiav5w::AddInstance or catiav5w::AddVirtualComponentInstance functions.
639  //! \param [in] inInstanceAlpha : Instance Alpha.
640  //! \return dtkNoError if it is OK.
641  //! \remarks You must use this function between InitProduct/EndProduct to have a product context where you override the attribute.
642  Dtk_ErrorStatus OverrideInstanceAlphaWithPathID( const PathID& inInstancePathId, const Dtk_UChar8 inInstanceAlpha );
643 
644  //! \brief Set Layer and LayerFilter Data in a CATPart context.
645  //! \param [in] inLayerDataSet : Layer and LayerFilter Data.
646  //! \return dtkNoError if it is OK.
647  //! \return dtkNoError if it is OK.
648  //! \remarks Layer Name and LayerFilters can only be added in CATPart context.
650 
651  //! \deprecated Use Dtk_ErrorStatus catiav5w::AddMaterial( const Material&, MaterialId& ) method instead.
652  SetAsDeprecated( "2024.2", "Use Dtk_ErrorStatus catiav5w::AddMaterial( const Material&, MaterialId& ) method instead." )
653  MaterialId AddMaterial_Deprecated242( const Material& inMaterial );
654 
655  //! \brief Add a Material in a CATPart context.
656  //! \param [in] inMaterial : Material to be added.
657  //! \param [out] outMaterialId : ID of the Material. It must be set in the Node or Body by calling Dtk_Info::SetRenderInfosId method
658  //! \return dtkNoError if it is OK.
659  //! \remarks Material can only be added in CATPart context.
660  Dtk_ErrorStatus AddMaterial( const Material& inMaterial, MaterialId& outMaterialId );
661 
662 };
663 #endif
664 
665 
666 /// @cond NO_DOXYGEN_DOC
667 namespace Config
668 {
669  /// @endcond
670  namespace catiav5w
671  {
674  }
675  /// @cond NO_DOXYGEN_DOC
676 }
677 /// @endcond
678 
679 
680 
681 
Dtk_Properties::Create
static Dtk_PropertiesPtr Create()
Calls default constructor to allocate a new object.
catiav5w::FileDescription::AddIntegerProperty
void AddIntegerProperty(const Dtk_string &inPropertyName, const Dtk_Int32 &inValue)
Adds an additional integer property.
Definition: catiav5w.hpp:301
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:688
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
catiav5w::FileDescription::SetDefinition
void SetDefinition(const Dtk_string &inDefinition)
Sets the file definition.
Definition: catiav5w.hpp:261
catiav5w::WriteOptions::WriteReferencePlaneAsVisible
void WriteReferencePlaneAsVisible()
Sets the reference plane writting as visible.
Definition: catiav5w.hpp:69
catiav5w::AddBooleanParameter
Dtk_ErrorStatus AddBooleanParameter(const Dtk_string &inParameterName, const Dtk_bool &inValue)
Adds a boolean paramater.
catiav5w::InitVirtualComponent
Dtk_ErrorStatus InitVirtualComponent(const Dtk_string &inReferenceName, const catiav5w::FileDescription &inFileDescription=catiav5w::FileDescription())
Initialize a virtual component during CATProduct process.
catiav5w::Material::Lighting::m_TransparencyCoefficient
Dtk_Double64 m_TransparencyCoefficient
Definition: catiav5w.hpp:111
catiav5w::OverrideInstanceAlphaWithPathID
Dtk_ErrorStatus OverrideInstanceAlphaWithPathID(const PathID &inInstancePathId, const Dtk_UChar8 inInstanceAlpha)
Override the Alpha of an instance in a Sub Product.
catiav5w::AddMaterial
Dtk_ErrorStatus AddMaterial(const Material &inMaterial, MaterialId &outMaterialId)
Add a Material in a CATPart context.
catiav5w::Material::Lighting::SetDiffuseData
void SetDiffuseData(const Dtk_RGB &inDiffuseColor, const Dtk_Double64 inDiffuseCoefficient)
Definition: catiav5w.hpp:131
catiav5w::AddVirtualComponentInstance
Dtk_ErrorStatus AddVirtualComponentInstance(const Dtk_ID &inDocId, const Dtk_string &inInstanceName, const Dtk_transfo &inTransfo, Dtk_ID &outInstanceId)
Add an instance to a DocID into the Current (Sub/Root) CATProduct.
catiav5w::Material::Lighting::m_SpecularCoefficient
Dtk_Double64 m_SpecularCoefficient
Definition: catiav5w.hpp:109
catiav5w::Material::Lighting::m_TransparencyColor
Dtk_RGB m_TransparencyColor
Definition: catiav5w.hpp:110
catiav5w::FileDescription::GetDefinition
const Dtk_string & GetDefinition() const
Retrieves the file definition - read only -.
Definition: catiav5w.hpp:356
catiav5w::FileDescription::_Nomenclature
Dtk_string _Nomenclature
Nomenclature of the CatiaV5 File.
Definition: catiav5w.hpp:222
catiav5w::Material::Lighting::GetTransparencyColor
const Dtk_RGB & GetTransparencyColor() const
Definition: catiav5w.hpp:153
catiav5w::WriteOptions
This class provides several options to tunes CatiaV5 Writter. It must be provided to catiav5w::InitWr...
Definition: catiav5w.hpp:41
catiav5w::WriteOptions::GetFileRelease
Dtk_UInt32 GetFileRelease() const
Retrieve the Written file release.
Definition: catiav5w.hpp:89
catiav5w::AddIntegerParameter
Dtk_ErrorStatus AddIntegerParameter(const Dtk_string &inParameterName, const Dtk_Int32 &inValue)
Adds a integer paramater.
catiav5w::NodeTypeGeometricSet
@ NodeTypeGeometricSet
Definition: catiav5w.hpp:411
catiav5w::Material::Lighting
Definition: catiav5w.hpp:102
catiav5w::IsWriteInitialized
Dtk_bool IsWriteInitialized()
Tells if the Write Module has been initialized or not.
catiav5w::Material
This is the wrapper class handling V5 write material data.
Definition: catiav5w.hpp:99
DTK_TRUE
#define DTK_TRUE
Definition: define.h:726
catiav5w::FileDescription::SetNomenclature
void SetNomenclature(const Dtk_string &inNomenclature)
Sets the file nomenclature.
Definition: catiav5w.hpp:268
catiav5w::SetWriteReferencePlanesAsHidden
void SetWriteReferencePlanesAsHidden(const Dtk_bool &inVal)
catiav5w::FileDescription::GetDescription
const Dtk_string & GetDescription() const
Retrieves the file description - read only -.
Definition: catiav5w.hpp:372
catiav5w::WriteOptions::_WriteReferencePlanesAsHidden
Dtk_bool _WriteReferencePlanesAsHidden
Option to write reference planes as hidden or visible - visible by default -.
Definition: catiav5w.hpp:47
catiav5w::FileDescription::GetIthAdditionalProperties
const Dtk_PropertiesPtr & GetIthAdditionalProperties(const Dtk_Size_t &inPos) const
Retrieves the file source type - read only -.
Definition: catiav5w.hpp:396
catiav5w::FileDescription::_SourceType
ProductSourceType _SourceType
Source Type of the CatiaV5 File.
Definition: catiav5w.hpp:226
catiav5w::Material::Lighting::GetAmbientColor
const Dtk_RGB & GetAmbientColor() const
Definition: catiav5w.hpp:150
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:687
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:711
Dtk_string::convert_from_int
void convert_from_int(const int integer, int force_unsigned_int=0)
affectation operator from a int
catiav5w::WriteEntity
Dtk_ErrorStatus WriteEntity(const Dtk_EntityPtr &inEntity)
Write the entity provided in parameter.
Dtk_UUID
Definition: dtk_uuid.hpp:8
dtk_metadata.hpp
catiav5w::FileDescription::AddBooleanProperty
void AddBooleanProperty(const Dtk_string &inPropertyName, const Dtk_bool &inValue)
Adds an additional integer property.
Definition: catiav5w.hpp:315
catiav5w::FileDescription
This class provides several informations about a CatiaV5 File. It can be used with catiav5w::InitPart...
Definition: catiav5w.hpp:205
catiav5w::Material::Lighting::GetDiffuseColor
const Dtk_RGB & GetDiffuseColor() const
Definition: catiav5w.hpp:151
catiav5w::WriteOptions::GetMaximumFileReleaseHandled
static Dtk_UInt32 GetMaximumFileReleaseHandled()
Return the maximum file release number handled by the writer.
catiav5w::Material::Lighting::m_AmbientColor
Dtk_RGB m_AmbientColor
Definition: catiav5w.hpp:104
catiav5w::WriteOptions::WriteOptions
WriteOptions()
Default constructor.
Definition: catiav5w.hpp:51
DTK_FALSE
#define DTK_FALSE
Definition: define.h:727
catiav5w::FileDescription::GetNumAdditionalProperties
Dtk_Size_t GetNumAdditionalProperties() const
Retrieves the file source type - read only -.
Definition: catiav5w.hpp:388
Dtk_bool
char Dtk_bool
Definition: define.h:724
catiav5w::Material::Analysis::m_Density
Dtk_Double64 m_Density
Definition: catiav5w.hpp:164
catiav5w::OverrideInstanceColorWithPathID
Dtk_ErrorStatus OverrideInstanceColorWithPathID(const PathID &inInstancePathId, const Dtk_RGB &inInstanceColor)
Override the Color of an instance in a Sub Product.
catiav5w::AddDoubleParameter
Dtk_ErrorStatus AddDoubleParameter(const Dtk_string &inParameterName, const Dtk_Double64 &inValue)
Adds a double paramater.
catiav5w::CreateNode
Dtk_ErrorStatus CreateNode(const NodeType &inNodeType, const Dtk_string &inNodeName=Dtk_string())
Create a node in the Specification Tree.
Dtk_Double64
double Dtk_Double64
Definition: define.h:698
catiav5w::InitProduct
Dtk_ErrorStatus InitProduct(const Dtk_string &inFileName, const Dtk_string &inReferenceName, const catiav5w::FileDescription &inFileDescription=catiav5w::FileDescription())
Initialize a sub Product during CATProduct process.
catiav5w::Material::Lighting::GetReflectivityCoefficient
Dtk_Double64 GetReflectivityCoefficient() const
Definition: catiav5w.hpp:158
catiav5w::FileDescription::Unknown
@ Unknown
Definition: catiav5w.hpp:210
catiav5w::FileDescription::_PartDensity
Dtk_Double64 _PartDensity
Definition: catiav5w.hpp:230
catiav5w::FileDescription::SetRevision
void SetRevision(const Dtk_string &inRevision)
Sets the file revision.
Definition: catiav5w.hpp:254
catiav5w::Material::Lighting::SetSpecularData
void SetSpecularData(const Dtk_RGB &inSpecularColor, const Dtk_Double64 inSpecularCoefficient)
Definition: catiav5w.hpp:136
catiav5w::FileDescription::GetRevision
const Dtk_string & GetRevision() const
Retrieves the file revision - read only -.
Definition: catiav5w.hpp:348
dtk_uuid.hpp
catiav5w::PathID
Dtk_tab< Dtk_ID > PathID
Definition: catiav5w.hpp:26
catiav5w::CreateCGRDocId
Dtk_ErrorStatus CreateCGRDocId(const Dtk_string &inCGRFileName, const Dtk_string &inCGRName, Dtk_ID &outDocId)
Create a CGR Reference and DocID related to a given CGR File.
catiav5w::inReferenceName
const Dtk_string & inReferenceName
Definition: catiav5w.hpp:432
catiav5w::InitPart
Dtk_ErrorStatus InitPart(const Dtk_string &inOutputFile, const Dtk_string &inReferenceName, Dtk_UUID &outPartUUID, const catiav5w::FileDescription &inFileDescription=catiav5w::FileDescription())
Initialize the part
catiav5w::FileDescription::_Definition
Dtk_string _Definition
Definition of the CatiaV5 File.
Definition: catiav5w.hpp:220
catiav5w::NodeTypePartBody
@ NodeTypePartBody
Definition: catiav5w.hpp:412
catiav5w::Material::m_Lighting
Lighting m_Lighting
Definition: catiav5w.hpp:177
catiav5w::FileDescription::m_PartMaterial
Material m_PartMaterial
Definition: catiav5w.hpp:216
catiav5w::Material::Lighting::m_DiffuseColor
Dtk_RGB m_DiffuseColor
Definition: catiav5w.hpp:106
catiav5w::WriteOptions::~WriteOptions
~WriteOptions()
Destructor.
Definition: catiav5w.hpp:56
util_ent_dtk.hpp
catiav5w::FileDescription::ProductSourceType
ProductSourceType
Definition: catiav5w.hpp:209
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:686
catiav5w::SetAsDeprecated
SetAsDeprecated("2024.2", "Use Dtk_ErrorStatus catiav5w::InitPart( const Dtk_string&, const Dtk_string&, Dtk_UUID&, const catiav5w::FileDescription& ) method instead.") Dtk_UUID InitPart_Deprecated242(const Dtk_string &inOutputFile
catiav5w::FileDescription::SetPartMaterial
void SetPartMaterial(const catiav5w::Material &inMaterial)
Sets the file root material.
Definition: catiav5w.hpp:247
catiav5w::EndVirtualComponent
Dtk_ErrorStatus EndVirtualComponent(Dtk_ID &outDocId)
End - and write - the virtual component initialized by catiav5w::InitVirtualComponent.
catiav5w::Material::Analysis::Analysis
Analysis()
Definition: catiav5w.hpp:166
catiav5w::FileDescription::SetSourceType
void SetSourceType(const ProductSourceType &inSourceType)
Sets the file source type.
Definition: catiav5w.hpp:282
error_dtk.hpp
catiav5w::AddInstance
Dtk_ErrorStatus AddInstance(const Dtk_ID &inDocId, const Dtk_string &inInstanceName, const Dtk_transfo &inTransfo, Dtk_ID &outInstanceId)
Add an instance to a DocID into the Current (Sub/Root) CATProduct.
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
catiav5w::Material::Lighting::GetAmbientCoefficient
Dtk_Double64 GetAmbientCoefficient() const
Definition: catiav5w.hpp:154
catiav5w::CreateV4ModelDocId
Dtk_ErrorStatus CreateV4ModelDocId(const Dtk_string &inV4ModelFileName, const Dtk_string &inV4ModelName, Dtk_ID &outDocId)
Create a V4 Model Reference and DocID related to a given V4 Model File.
catiav5w::WriteOptions::AreReferencePlanesWrittenAsHidden
Dtk_bool AreReferencePlanesWrittenAsHidden() const
Tells if the reference planes are written as hidden.
Definition: catiav5w.hpp:76
catiav5w::FileDescription::Bought
@ Bought
Definition: catiav5w.hpp:212
catiav5w::FileDescription::GetPartMaterial
const catiav5w::Material & GetPartMaterial() const
Retrieves the file root material - read only -.
Definition: catiav5w.hpp:340
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
catiav5w::Material::Lighting::SetReflectivityCoefficient
void SetReflectivityCoefficient(const Dtk_Double64 inReflectivityCoefficient)
Definition: catiav5w.hpp:146
catiav5w::FileDescription::_Revision
Dtk_string _Revision
Revision of the CatiaV5 File.
Definition: catiav5w.hpp:218
catiav5w::EndWrite
Dtk_ErrorStatus EndWrite()
Free the Catia V5 Writer
Dtk_UChar8
unsigned char Dtk_UChar8
Definition: define.h:697
catiav5w::AddStringParameter
Dtk_ErrorStatus AddStringParameter(const Dtk_string &inParameterName, const Dtk_string &inValue)
Adds a string paramater.
catiav5w::Material::Lighting::m_DiffuseCoefficient
Dtk_Double64 m_DiffuseCoefficient
Definition: catiav5w.hpp:107
catiav5w::inFileDescription
const Dtk_string const catiav5w::FileDescription & inFileDescription
Definition: catiav5w.hpp:433
catiav5w::NodeType
NodeType
Type of Specification Tree Node used into a CATPart file.
Definition: catiav5w.hpp:409
catiav5w::WriteOptions::SetFileRelease
Dtk_ErrorStatus SetFileRelease(const Dtk_UInt32 inRelease)
Sets the release for the written files.
catiav5w::CreatePartDocId
Dtk_ErrorStatus CreatePartDocId(const Dtk_string &inPartFileName, const Dtk_string &inPartName, Dtk_ID &outDocId)
Create a Part Reference and DocID related to a given CATPart.
catiav5w::NodeTypeMechanicalTool
@ NodeTypeMechanicalTool
Definition: catiav5w.hpp:413
catiav5w::Material::Lighting::Lighting
Lighting()
Definition: catiav5w.hpp:115
catiav5w::MaterialId
Dtk_ID MaterialId
Definition: catiav5w.hpp:27
catiav5w::FileDescription::Made
@ Made
Definition: catiav5w.hpp:211
dtk_transfo.hpp
catiav5w::FileDescription::FileDescription
FileDescription()
Default constructor.
Definition: catiav5w.hpp:235
str_def.h
catiav5w::Material::Lighting::m_SpecularColor
Dtk_RGB m_SpecularColor
Definition: catiav5w.hpp:108
util_stl_dtk.hpp
catiav5w::Material::Lighting::m_ReflectivityCoefficient
Dtk_Double64 m_ReflectivityCoefficient
Definition: catiav5w.hpp:113
catiav5w::Material::Lighting::GetSpecularCoefficient
Dtk_Double64 GetSpecularCoefficient() const
Definition: catiav5w.hpp:156
catiav5w::FileDescription::~FileDescription
~FileDescription()
Destructor.
Definition: catiav5w.hpp:241
catiav5w::Material::Lighting::GetDiffuseCoefficient
Dtk_Double64 GetDiffuseCoefficient() const
Definition: catiav5w.hpp:155
catiav5w::NodeTypeUnknown
@ NodeTypeUnknown
Definition: catiav5w.hpp:410
catiav5w::Material::Lighting::GetTransparencyCoefficient
Dtk_Double64 GetTransparencyCoefficient() const
Definition: catiav5w.hpp:157
util_ptr_dtk.hpp
catiav5w::WriteOptions::WriteReferencePlaneAsHidden
void WriteReferencePlaneAsHidden()
Sets the reference plane writting as hidden.
Definition: catiav5w.hpp:62
define.h
catiav5w::Material::Lighting::GetSpecularColor
const Dtk_RGB & GetSpecularColor() const
Definition: catiav5w.hpp:152
catiav5w::Material::Lighting::SetTransparencyData
void SetTransparencyData(const Dtk_RGB &inTransparencyColor, const Dtk_Double64 inTransparencyCoefficient)
Definition: catiav5w.hpp:141
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
catiav5w::Material::Analysis
Definition: catiav5w.hpp:162
catiav5w::FileDescription::AddStringProperty
void AddStringProperty(const Dtk_string &inPropertyName, const Dtk_string &inValue)
Adds an additional integer property.
Definition: catiav5w.hpp:328
catiav5w::Material::Analysis::SetDensity
void SetDensity(const Dtk_Double64 inDensity)
Definition: catiav5w.hpp:171
catiav5w::CreateProductDocId
Dtk_ErrorStatus CreateProductDocId(const Dtk_string &inPartFileName, const Dtk_string &inPartName, Dtk_ID &outDocId)
Create a Product Reference and DocID related to a given CATProduct.
catiav5w::EndProduct
Dtk_ErrorStatus EndProduct(Dtk_ID &outDocId)
Write effectively the Sub Product initialized by catiav5w::InitProduct.
catiav5w::FileDescription::GetNomenclature
const Dtk_string & GetNomenclature() const
Retrieves the file nomenclature - read only -.
Definition: catiav5w.hpp:364
catiav5w::GetWriteHybridBodies
Dtk_bool GetWriteHybridBodies()
catiav5w::CloseCurrentNode
Dtk_ErrorStatus CloseCurrentNode()
close the current node previously created by catiav5w::CreateNode.
catiav5w::SetLayerData
Dtk_ErrorStatus SetLayerData(const Dtk_LayerInfosSetPtr &inLayerDataSet)
Set Layer and LayerFilter Data in a CATPart context.
catiav5w::Material::Analysis::GetDensity
Dtk_Double64 GetDensity() const
Definition: catiav5w.hpp:172
dtk_string.hpp
catiav5w::WriteNamedView
Dtk_ErrorStatus WriteNamedView(const Dtk_ModelDisplayPtr &inNamedView)
Write the given ModelDisplay as NamedView - V5 camera -.
catiav5w::EndPart
Dtk_ErrorStatus EndPart()
Free data allocated by catiav5w::InitPart
catiav5w::InitWrite
Dtk_ErrorStatus InitWrite(const Dtk_string &inLogFile, Licence_dtk inLicFct, const WriteOptions &inOptions=WriteOptions())
Initialize the Catia V5 Writer
catiav5w::FileDescription::_AdditionalProperties
Dtk_tab< Dtk_PropertiesPtr > _AdditionalProperties
Definition: catiav5w.hpp:228
catiav5w
Exported APIs for CatiaV5 Write Library.
Definition: catiav5w.hpp:25
catiav5w::Material::m_Analysis
Analysis m_Analysis
Definition: catiav5w.hpp:178
dtk_rgb.hpp
catiav5w::WriteOptions::_FileRelease
Dtk_UChar8 _FileRelease
Definition: catiav5w.hpp:48
Dtk_RGB
Definition: dtk_rgb.hpp:8
catiav5w::Material::Lighting::SetAmbientData
void SetAmbientData(const Dtk_RGB &inAmbientColor, const Dtk_Double64 inAmbientCoefficient)
Definition: catiav5w.hpp:126
Licence_dtk
char *(* Licence_dtk)(char *)
Definition: str_def.h:71
catiav5w::FileDescription::SetDescription
void SetDescription(const Dtk_string &inDescription)
Sets the file description.
Definition: catiav5w.hpp:275
catiav5w::OverrideBlankedStatusWithPathID
Dtk_ErrorStatus OverrideBlankedStatusWithPathID(const PathID &inInstancePathId, const Dtk_bool inBlankedStatus)
Override the Blanked Status of an instance in a Sub Product.
catiav5w::Material::m_Name
Dtk_string m_Name
Definition: catiav5w.hpp:176
catiav5w::FileDescription::GetSourceType
const ProductSourceType & GetSourceType() const
Retrieves the file source type - read only -.
Definition: catiav5w.hpp:380
catiav5w::FileDescription::AddDoubleProperty
void AddDoubleProperty(const Dtk_string &inPropertyName, const double &inValue)
Adds an additional double property.
Definition: catiav5w.hpp:289
catiav5w::FileDescription::_Description
Dtk_string _Description
Description of the CatiaV5 File.
Definition: catiav5w.hpp:224
catiav5w::Material::Lighting::m_AmbientCoefficient
Dtk_Double64 m_AmbientCoefficient
Definition: catiav5w.hpp:105
catiav5w::Material::Material
Material(const Dtk_string &inName=L"")
Definition: catiav5w.hpp:181