Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
STEPControl_Reader Class Reference

Reads STEP files, checks them and translates their contents into Open CASCADE models. The STEP data can be that of a whole model or that of a specific list of entities in the model. As in XSControl_Reader, you specify the list using a selection. For the translation of iges files it is possible to use next sequence: To change translation parameters class Interface_Static should be used before beginning of translation (see STEP Parameters and General Parameters) Creation of reader - STEPControl_Reader reader; To load s file in a model use method reader.ReadFile("filename.stp") To print load results reader.PrintCheckLoad(failsonly,mode) where mode is equal to the value of enumeration IFSelect_PrintCount For definition number of candidates : int nbroots = reader. NbRootsForTransfer(); To transfer entities from a model the following methods can be used: for the whole model - reader.TransferRoots(); to transfer a list of entities: reader.TransferList(list); to transfer one entity occ::handle<Standard_Transient> ent = reader.RootForTransfer(num); reader.TransferEntity(ent), or reader.TransferOneRoot(num), or reader.TransferOne(num), or reader.TransferRoot(num) To obtain the result the following method can be used: reader.NbShapes() and reader.Shape(num); or reader.OneShape(); To print the results of transfer use method: reader.PrintCheckTransfer(failwarn,mode); where printfail is equal to the value of enumeration IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer(); Gets correspondence between a STEP entity and a result shape obtained from it. occ::handle<XSControl_WorkSession> WS = reader.WS(); if ( WS->TransferReader()->HasResult(ent) ) TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);. More...

#include <STEPControl_Reader.hxx>

Inheritance diagram for STEPControl_Reader:
Inheritance graph
[legend]

Public Member Functions

 STEPControl_Reader ()
 Creates a reader object with an empty STEP model.
 
 STEPControl_Reader (const occ::handle< XSControl_WorkSession > &WS, const bool scratch=true)
 Creates a Reader for STEP from an already existing Session Clears the session if it was not yet set for STEP.
 
occ::handle< StepData_StepModelStepModel () const
 Returns the model as a StepModel. It can then be consulted (header, product)
 
IFSelect_ReturnStatus ReadFile (const char *const filename) override
 Loads a file and returns the read status Zero for a Model which compies with the Controller.
 
IFSelect_ReturnStatus ReadStream (const char *const theName, std::istream &theIStream) override
 Loads a file from stream and returns the read status.
 
IFSelect_ReturnStatus ReadFile (const char *const filename, const DESTEP_Parameters &theParams)
 Loads a file and returns the read status Zero for a Model which compies with the Controller.
 
IFSelect_ReturnStatus ReadStream (const char *const theName, const DESTEP_Parameters &theParams, std::istream &theIStream)
 Loads a file from stream and returns the read status.
 
bool TransferRoot (const int num=1, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Transfers a root given its rank in the list of candidate roots Default is the first one Returns True if a shape has resulted, false else Same as inherited TransferOneRoot, kept for compatibility.
 
int NbRootsForTransfer () override
 Determines the list of root entities from Model which are candidate for a transfer to a Shape (type of entities is PRODUCT)
 
void FileUnits (NCollection_Sequence< TCollection_AsciiString > &theUnitLengthNames, NCollection_Sequence< TCollection_AsciiString > &theUnitAngleNames, NCollection_Sequence< TCollection_AsciiString > &theUnitSolidAngleNames)
 Returns sequence of all unit names for shape representations found in file.
 
void SetSystemLengthUnit (const double theLengthUnit)
 Sets system length unit used by transfer process. Performs only if a model is not NULL.
 
double SystemLengthUnit () const
 Returns system length unit used by transfer process. Performs only if a model is not NULL.
 
- Public Member Functions inherited from XSControl_Reader
 XSControl_Reader ()
 Creates a Reader from scratch (creates an empty WorkSession) A WorkSession or a Controller must be provided before running.
 
 XSControl_Reader (const char *const norm)
 Creates a Reader from scratch, with a norm name which identifies a Controller.
 
 XSControl_Reader (const occ::handle< XSControl_WorkSession > &WS, const bool scratch=true)
 Creates a Reader from an already existing Session, with a Controller already set Virtual destructor.
 
virtual ~XSControl_Reader ()=default
 Empty virtual destructor.
 
bool SetNorm (const char *const norm)
 Sets a specific norm to <me> Returns True if done, False if <norm> is not available.
 
void SetWS (const occ::handle< XSControl_WorkSession > &WS, const bool scratch=true)
 Sets a specific session to <me>
 
occ::handle< XSControl_WorkSessionWS () const
 Returns the session used in <me>
 
occ::handle< Interface_InterfaceModelModel () const
 Returns the model. It can then be consulted (header, product)
 
occ::handle< NCollection_HSequence< occ::handle< Standard_Transient > > > GiveList (const char *const first="", const char *const second="")
 Returns a list of entities from the IGES or STEP file according to the following rules:
 
occ::handle< NCollection_HSequence< occ::handle< Standard_Transient > > > GiveList (const char *const first, const occ::handle< Standard_Transient > &ent)
 Computes a List of entities from the model as follows <first> being a Selection, <ent> being an entity or a list of entities (as a HSequenceOfTransient) : the standard result of this selection applied to this list if <first> is erroneous, a null handle is returned.
 
occ::handle< Standard_TransientRootForTransfer (const int num=1)
 Returns an IGES or STEP root entity for translation. The entity is identified by its rank in a list.
 
bool TransferOneRoot (const int num=1, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Translates a root identified by the rank num in the model. false is returned if no shape is produced.
 
bool TransferOne (const int num, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Translates an IGES or STEP entity identified by the rank num in the model. false is returned if no shape is produced.
 
bool TransferEntity (const occ::handle< Standard_Transient > &start, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Translates an IGES or STEP entity in the model. true is returned if a shape is produced; otherwise, false is returned.
 
int TransferList (const occ::handle< NCollection_HSequence< occ::handle< Standard_Transient > > > &list, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Translates a list of entities. Returns the number of IGES or STEP entities that were successfully translated. The list can be produced with GiveList. Warning - This function does not clear the existing output shapes.
 
int TransferRoots (const Message_ProgressRange &theProgress=Message_ProgressRange())
 Translates all translatable roots and returns the number of successful translations. Warning - This function clears existing output shapes first.
 
void ClearShapes ()
 Clears the list of shapes that may have accumulated in calls to TransferOne or TransferRoot.C.
 
int NbShapes () const
 Returns the number of shapes produced by translation.
 
TopoDS_Shape Shape (const int num=1) const
 Returns the shape resulting from a translation and identified by the rank num. num equals 1 by default. In other words, the first shape resulting from the translation is returned.
 
TopoDS_Shape OneShape () const
 Returns all of the results in a single shape which is:
 
void PrintCheckLoad (const bool failsonly, const IFSelect_PrintCount mode) const
 Prints the check list attached to loaded data, on the Standard Trace File (starts at std::cout) All messages or fails only, according to <failsonly> mode = 0 : per entity, prints messages mode = 1 : per message, just gives count of entities per check mode = 2 : also gives entity numbers.
 
void PrintCheckLoad (Standard_OStream &theStream, const bool failsonly, const IFSelect_PrintCount mode) const
 Prints the check list attached to loaded data.
 
void PrintCheckTransfer (const bool failsonly, const IFSelect_PrintCount mode) const
 Displays check results for the last translation of IGES or STEP entities to Open CASCADE entities. Only fail messages are displayed if failsonly is true. All messages are displayed if failsonly is false. mode determines the contents and the order of the messages according to the terms of the IFSelect_PrintCount enumeration.
 
void PrintCheckTransfer (Standard_OStream &theStream, const bool failsonly, const IFSelect_PrintCount mode) const
 Displays check results for the last translation of IGES or STEP entities to Open CASCADE entities.
 
void PrintStatsTransfer (const int what, const int mode=0) const
 Displays the statistics for the last translation. what defines the kind of statistics that are displayed as follows:
 
void PrintStatsTransfer (Standard_OStream &theStream, const int what, const int mode=0) const
 Displays the statistics for the last translation.
 
void GetStatsTransfer (const occ::handle< NCollection_HSequence< occ::handle< Standard_Transient > > > &list, int &nbMapped, int &nbWithResult, int &nbWithFail) const
 Gives statistics about Transfer.
 
void SetShapeFixParameters (const XSAlgo_ShapeProcessor::ParameterMap &theParameters)
 Sets parameters for shape processing.
 
void SetShapeFixParameters (XSAlgo_ShapeProcessor::ParameterMap &&theParameters)
 Sets parameters for shape processing. Parameters are moved from the input map.
 
void SetShapeFixParameters (const DE_ShapeFixParameters &theParameters, const XSAlgo_ShapeProcessor::ParameterMap &theAdditionalParameters={})
 Sets parameters for shape processing. Parameters from theParameters are copied to the internal map. Parameters from theAdditionalParameters are copied to the internal map if they are not present in theParameters.
 
const XSAlgo_ShapeProcessor::ParameterMapGetShapeFixParameters () const
 Returns parameters for shape processing that was set by SetParameters() method.
 
void SetShapeProcessFlags (const ShapeProcess::OperationsFlags &theFlags)
 Sets flags defining operations to be performed on shapes.
 
const XSAlgo_ShapeProcessor::ProcessingFlagsGetShapeProcessFlags () const
 Returns flags defining operations to be performed on shapes.
 

Protected Member Functions

DE_ShapeFixParameters GetDefaultShapeFixParameters () const override
 Returns default parameters for shape fixing. This method is used by the base class to get default parameters for shape fixing.
 
ShapeProcess::OperationsFlags GetDefaultShapeProcessFlags () const override
 Returns default flags for shape processing.
 
- Protected Member Functions inherited from XSControl_Reader
NCollection_Sequence< TopoDS_Shape > & Shapes ()
 Returns a sequence of produced shapes.
 

Additional Inherited Members

- Protected Attributes inherited from XSControl_Reader
bool therootsta
 
NCollection_Sequence< occ::handle< Standard_Transient > > theroots
 

Detailed Description

Reads STEP files, checks them and translates their contents into Open CASCADE models. The STEP data can be that of a whole model or that of a specific list of entities in the model. As in XSControl_Reader, you specify the list using a selection. For the translation of iges files it is possible to use next sequence: To change translation parameters class Interface_Static should be used before beginning of translation (see STEP Parameters and General Parameters) Creation of reader - STEPControl_Reader reader; To load s file in a model use method reader.ReadFile("filename.stp") To print load results reader.PrintCheckLoad(failsonly,mode) where mode is equal to the value of enumeration IFSelect_PrintCount For definition number of candidates : int nbroots = reader. NbRootsForTransfer(); To transfer entities from a model the following methods can be used: for the whole model - reader.TransferRoots(); to transfer a list of entities: reader.TransferList(list); to transfer one entity occ::handle<Standard_Transient> ent = reader.RootForTransfer(num); reader.TransferEntity(ent), or reader.TransferOneRoot(num), or reader.TransferOne(num), or reader.TransferRoot(num) To obtain the result the following method can be used: reader.NbShapes() and reader.Shape(num); or reader.OneShape(); To print the results of transfer use method: reader.PrintCheckTransfer(failwarn,mode); where printfail is equal to the value of enumeration IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer(); Gets correspondence between a STEP entity and a result shape obtained from it. occ::handle<XSControl_WorkSession> WS = reader.WS(); if ( WS->TransferReader()->HasResult(ent) ) TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);.

Constructor & Destructor Documentation

◆ STEPControl_Reader() [1/2]

STEPControl_Reader::STEPControl_Reader ( )

Creates a reader object with an empty STEP model.

◆ STEPControl_Reader() [2/2]

STEPControl_Reader::STEPControl_Reader ( const occ::handle< XSControl_WorkSession > & WS,
const bool scratch = true )

Creates a Reader for STEP from an already existing Session Clears the session if it was not yet set for STEP.

Member Function Documentation

◆ FileUnits()

void STEPControl_Reader::FileUnits ( NCollection_Sequence< TCollection_AsciiString > & theUnitLengthNames,
NCollection_Sequence< TCollection_AsciiString > & theUnitAngleNames,
NCollection_Sequence< TCollection_AsciiString > & theUnitSolidAngleNames )

Returns sequence of all unit names for shape representations found in file.

◆ GetDefaultShapeFixParameters()

DE_ShapeFixParameters STEPControl_Reader::GetDefaultShapeFixParameters ( ) const
overrideprotectedvirtual

Returns default parameters for shape fixing. This method is used by the base class to get default parameters for shape fixing.

Returns
default parameters for shape fixing.

Reimplemented from XSControl_Reader.

◆ GetDefaultShapeProcessFlags()

ShapeProcess::OperationsFlags STEPControl_Reader::GetDefaultShapeProcessFlags ( ) const
overrideprotectedvirtual

Returns default flags for shape processing.

Returns
Default flags for shape processing.

Reimplemented from XSControl_Reader.

◆ NbRootsForTransfer()

int STEPControl_Reader::NbRootsForTransfer ( )
overridevirtual

Determines the list of root entities from Model which are candidate for a transfer to a Shape (type of entities is PRODUCT)

Reimplemented from XSControl_Reader.

◆ ReadFile() [1/2]

IFSelect_ReturnStatus STEPControl_Reader::ReadFile ( const char *const filename)
overridevirtual

Loads a file and returns the read status Zero for a Model which compies with the Controller.

Reimplemented from XSControl_Reader.

◆ ReadFile() [2/2]

IFSelect_ReturnStatus STEPControl_Reader::ReadFile ( const char *const filename,
const DESTEP_Parameters & theParams )

Loads a file and returns the read status Zero for a Model which compies with the Controller.

◆ ReadStream() [1/2]

IFSelect_ReturnStatus STEPControl_Reader::ReadStream ( const char *const theName,
const DESTEP_Parameters & theParams,
std::istream & theIStream )

Loads a file from stream and returns the read status.

◆ ReadStream() [2/2]

IFSelect_ReturnStatus STEPControl_Reader::ReadStream ( const char *const theName,
std::istream & theIStream )
overridevirtual

Loads a file from stream and returns the read status.

Reimplemented from XSControl_Reader.

◆ SetSystemLengthUnit()

void STEPControl_Reader::SetSystemLengthUnit ( const double theLengthUnit)

Sets system length unit used by transfer process. Performs only if a model is not NULL.

◆ StepModel()

occ::handle< StepData_StepModel > STEPControl_Reader::StepModel ( ) const

Returns the model as a StepModel. It can then be consulted (header, product)

◆ SystemLengthUnit()

double STEPControl_Reader::SystemLengthUnit ( ) const

Returns system length unit used by transfer process. Performs only if a model is not NULL.

◆ TransferRoot()

bool STEPControl_Reader::TransferRoot ( const int num = 1,
const Message_ProgressRange & theProgress = Message_ProgressRange() )

Transfers a root given its rank in the list of candidate roots Default is the first one Returns True if a shape has resulted, false else Same as inherited TransferOneRoot, kept for compatibility.


The documentation for this class was generated from the following file: