Hide menu
Loading...
Searching...
No Matches

Base class for reader classes. More...

#include <cadex/Base_Reader.hxx>

Inheritance diagram for cadex::Base_Reader:
cadex::A3DS_Reader cadex::BRep_Reader cadex::CAT_Reader cadex::Collada_Reader cadex::Creo_Reader cadex::DS3DXML_Reader cadex::DWG_Reader cadex::DXF_Reader cadex::FBX_Reader cadex::GLTF_Reader cadex::IFC_Reader cadex::IGES_Reader cadex::INV_Reader cadex::JT_Reader cadex::NX_Reader cadex::OBJ_Reader cadex::PLY_Reader cadex::Para_Reader cadex::Revit_Reader cadex::Rhino_Reader cadex::SLDE_Reader cadex::SLD_Reader cadex::STEP_Reader cadex::STL_Reader cadex::VRML_Reader cadex::X3D_Reader cadex::X3MF_Reader

Public Member Functions

 ~Base_Reader ()
 Destructor.
 
bool ReadFile (const Base_UTF16String &theFileName)
 Reads the file into memory.
 
bool ReadFile (std::istream &theStream)
 Reads the file into memory.
 
bool ReadFile (const std::shared_ptr< Base_IStreamProviderFactory > &theFactory, const Base_UTF16String &theFileName)
 Reads the file into memory.
 
bool Transfer (ModelData_Model &theModel)
 Converts read file into a resulting model.
 
bool Transfer (ModelData_BIMModel &theModel)
 Converts read file into a resulting BIM model.
 
bool Transfer (TopoDS_Shape &theShape)
 Converts read file into a resulting shape.
 
Base_ProgressStatusProgressStatus () const
 Returns a progress status.
 
Base_ReaderStatistics Statistics () const
 Returns an object containing information about import process.
 
internal::Base_Reader_Private * Impl () const
 
template<typename T >
T * Impl () const
 Reserved for internal use.
 

Protected Member Functions

 Base_Reader (internal::Base_Reader_Private *theImpl)
 Constructor.
 

Detailed Description

Base class for reader classes.

The reader class provides API for reading (i.e. importing) files in two steps:

  • parsing a file into memory (ReadFile());
  • converting representation in memory into resulting model (Transfer()).

Base_Reader subclasses (e.g. IGES_Reader) must be used following the same pattern:

#include <cadex/IGES_Reader.hxx>
using namespace cadex;
IGES_Reader aReader;
if (aReader.ReadFile ("myfile.igs") && aReader.Transfer (aModel)) {
//OK
} else {
//error during reading the IGES file
}
bool Transfer(ModelData_Model &theModel)
Converts read file into a resulting model.
Definition: Base_Reader.cxx:296
bool ReadFile(const Base_UTF16String &theFileName)
Reads the file into memory.
Definition: Base_Reader.cxx:207
Reads IGES files.
Definition: IGES_Reader.hxx:29
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
See also
Base_Writer.

Member Function Documentation

◆ Impl()

internal::Base_Reader_Private * cadex::Base_Reader::Impl ( ) const
inline

Returns the pointer to the implementation object.

Warning
This function is not part of CAD Exchanger API and should not be used.

◆ ReadFile() [1/3]

bool cadex::Base_Reader::ReadFile ( const Base_UTF16String theFileName)

Reads the file into memory.

Returns True if the conversion has been successful and False otherwise.

Exceptions
BaseError_MissingModel
BaseError_UnsupportedVersion
BaseError_UnexpectedFormat
BaseError_UnsupportedFileVariant
Note
Please refer to the Base_Reader subclasses' documentation to learn what specific exceptions are thrown by each reader.
Examples
conversion/import/Program.cs, and conversion/import/main.cxx.

◆ ReadFile() [2/3]

bool cadex::Base_Reader::ReadFile ( const std::shared_ptr< Base_IStreamProviderFactory > &  theFactory,
const Base_UTF16String theFileName 
)

Reads the file into memory.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload should be used when parsing files referring to external files (e.g. JT files with external references) residing on specific data storage such as cloud.

theFactory must be an instance of specific subclass of StreamProviderFactory which creates instances of specific subclass(es) of StreamProvider.

Exceptions
BaseError_MissingModel
BaseError_UnsupportedVersion
BaseError_UnexpectedFormat
BaseError_UnsupportedFileVariant
Note
Please refer to the Base_Reader subclasses' documentation to learn what specific exceptions are thrown by each reader.
See also
Base_StreamProvider.

◆ ReadFile() [3/3]

bool cadex::Base_Reader::ReadFile ( std::istream &  theStream)

Reads the file into memory.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The file is specified in the form of the stream. theStream must be opened and use binary format (the ios::binary flag).

Not all subclasses support this syntax (e.g. STEP_Reader or JT_Reader do not). In this case the method returns False and asserts in debug mode.

Returns True if the conversion has been successful and False otherwise.

Exceptions
BaseError_MissingModel
BaseError_UnsupportedVersion
BaseError_UnexpectedFormat
BaseError_UnsupportedFileVariant
Note
Please refer to the Base_Reader subclasses' documentation to learn what specific exceptions are thrown by each reader.

◆ Transfer() [1/3]

bool cadex::Base_Reader::Transfer ( ModelData_BIMModel theBIMModel)

Converts read file into a resulting BIM model.

Returns true if the conversion has been successful and false otherwise.

The contents of theBIMModel will be appended.

◆ Transfer() [2/3]

bool cadex::Base_Reader::Transfer ( ModelData_Model theModel)

Converts read file into a resulting model.

Returns true if the conversion has been successful and false otherwise.

The contents of theModel will be appended.

Sets the base name of the most recently read file (in ReadFile()) to theModel's name unless the model already has a name.

Examples
conversion/import/Program.cs, and conversion/import/main.cxx.

◆ Transfer() [3/3]

bool cadex::Base_Reader::Transfer ( TopoDS_Shape &  theShape)

Converts read file into a resulting shape.

Returns true if the conversion has been successful and false otherwise.