Hide menu
cadex::ModelData_ModelWriter Class Reference

Writes any format that CAD Exchanger can export. More...

Public Member Functions

 ModelData_ModelWriter ()
 Constructor.
 
 ~ModelData_ModelWriter ()
 Destructor.
 
bool Write (const ModelData_Model &theModel, const Base_UTF16String &theFilePath)
 Writes the specified model to the file at the specified path. More...
 
void SetWriterParameters (const Base_WriterParameters &theParameters)
 Sets writer parameters. More...
 
void SetProgressStatus (const Base_ProgressStatus &theProgressStatus)
 Sets the progress status for the writing process.
 
const Base_ProgressStatusProgressStatus () const
 Returns the progress status for the writing process.
 

Detailed Description

Writes any format that CAD Exchanger can export.

Use this class to streamline the code where multiple formats have to be written in a uniform fashion. This writer handles the task of determining the suitable writer itself, the client code only needs to provide the ModelData_Model and a resulting file path.

Each CAD Exchanger writer has its own binary. This class will load the binaries of writers at runtime for its operation. No linking is done at compile-time. If you're planning to omit some CAD Exchanger libraries from your software distribution, make sure to include the libraries for all the formats you intend to write.

Examples
advgeom/brepsimplify/main.cxx, advgeom/meshsimplify/main.cxx, conversion/cdxfbconverter/main.cxx, conversion/import/main.cxx, conversion/transfer/main.cxx, conversion/transferparams/main.cxx, meshing/lods/main.cxx, meshing/mefisto/main.cxx, meshing/netgen/main.cxx, meshing/remeshing/main.cxx, meshing/visualizationmesher/main.cxx, modeling/assembly/main.cxx, modeling/brep/main.cxx, modeling/brepfeatures/main.cxx, modeling/brepprimitives/main.cxx, modeling/elementremoval/main.cxx, modeling/metadata/main.cxx, and modeling/poly/main.cxx.

Member Function Documentation

◆ SetWriterParameters()

void cadex::ModelData_ModelWriter::SetWriterParameters ( const Base_WriterParameters theParameters)

Sets writer parameters.

Any child of Base_WriterParameters can be passed to this function and it will affect the writing of the corresponding format only. Call multiple times with parameter objects for different writers to customize the behavior of these writers.

Examples
conversion/cdxfbconverter/main.cxx, and conversion/transferparams/main.cxx.

◆ Write()

bool cadex::ModelData_ModelWriter::Write ( const ModelData_Model theModel,
const Base_UTF16String theFileName 
)

Writes the specified model to the file at the specified path.

Automatically selects a suitable writer based on the file extension specified in the path. The selection is performed from the writers that can be loaded at runtime. Returns true if the writing process succeeded, false otherwise.

Note
Aside from the exceptions listed below, this function call may be interrupted by exceptions specific to the formats being used; see other classes derived from Base_Exception.
Exceptions
BaseError_MissingModuleif no writer for the specified file could be found (either because the format is not supported by CAD Exchanger, or because a related module couldn't be loaded).
LicenseManager_LicenseErrorif the corresponding writer was found but there was no active license for it.
Examples
conversion/cdxfbconverter/main.cxx, conversion/transfer/main.cxx, conversion/transferparams/main.cxx, meshing/remeshing/main.cxx, meshing/visualizationmesher/main.cxx, modeling/assembly/main.cxx, modeling/brep/main.cxx, modeling/brepfeatures/main.cxx, modeling/brepprimitives/main.cxx, modeling/elementremoval/main.cxx, modeling/metadata/main.cxx, and modeling/poly/main.cxx.