Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:05

0001 // Created on: 1996-07-08
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _STEPControl_Reader_HeaderFile
0018 #define _STEPControl_Reader_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <XSControl_Reader.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <StepData_ConfParameters.hxx>
0027 #include <TColStd_SequenceOfAsciiString.hxx>
0028 #include <TColStd_Array1OfAsciiString.hxx>
0029 #include <TColStd_Array1OfReal.hxx>
0030 class XSControl_WorkSession;
0031 class StepData_StepModel;
0032 class StepRepr_RepresentationContext;
0033 
0034 
0035 //! Reads STEP files, checks them and translates their contents
0036 //! into Open CASCADE models. The STEP data can be that of
0037 //! a whole model or that of a specific list of entities in the model.
0038 //! As in XSControl_Reader, you specify the list using a selection.
0039 //! For the translation of iges files it is possible to use next sequence:
0040 //! To change translation parameters
0041 //! class Interface_Static should be used before beginning of
0042 //! translation  (see STEP Parameters and General Parameters)
0043 //! Creation of reader - STEPControl_Reader reader;
0044 //! To load s file in a model use method reader.ReadFile("filename.stp")
0045 //! To print load results reader.PrintCheckLoad(failsonly,mode)
0046 //! where mode is equal to the value of enumeration IFSelect_PrintCount
0047 //! For definition number of candidates :
0048 //! Standard_Integer nbroots = reader. NbRootsForTransfer();
0049 //! To transfer entities from a model the following methods can be used:
0050 //! for the whole model - reader.TransferRoots();
0051 //! to transfer a list of entities: reader.TransferList(list);
0052 //! to transfer one entity Handle(Standard_Transient)
0053 //! ent = reader.RootForTransfer(num);
0054 //! reader.TransferEntity(ent), or
0055 //! reader.TransferOneRoot(num), or
0056 //! reader.TransferOne(num), or
0057 //! reader.TransferRoot(num)
0058 //! To obtain the result the following method can be used:
0059 //! reader.NbShapes() and reader.Shape(num); or reader.OneShape();
0060 //! To print the results of transfer use method:
0061 //! reader.PrintCheckTransfer(failwarn,mode);
0062 //! where printfail is equal to the value of enumeration
0063 //! IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer();
0064 //! Gets correspondence between a STEP entity and a result
0065 //! shape obtained from it.
0066 //! Handle(XSControl_WorkSession)
0067 //! WS = reader.WS();
0068 //! if ( WS->TransferReader()->HasResult(ent) )
0069 //! TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);
0070 class STEPControl_Reader  : public XSControl_Reader
0071 {
0072 public:
0073 
0074   DEFINE_STANDARD_ALLOC
0075 
0076   
0077   //! Creates a reader object with an empty STEP model.
0078   Standard_EXPORT STEPControl_Reader();
0079   
0080   //! Creates a Reader for STEP from an already existing Session
0081   //! Clears the session if it was not yet set for STEP
0082   Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
0083   
0084   //! Returns the model as a StepModel.
0085   //! It can then be consulted (header, product)
0086   Standard_EXPORT Handle(StepData_StepModel) StepModel() const;
0087 
0088   //! Loads a file and returns the read status
0089   //! Zero for a Model which compies with the Controller
0090   Standard_EXPORT virtual IFSelect_ReturnStatus ReadFile(const Standard_CString filename) Standard_OVERRIDE;
0091 
0092   //! Loads a file from stream and returns the read status
0093   Standard_EXPORT virtual IFSelect_ReturnStatus ReadStream(const Standard_CString theName,
0094                                                            std::istream& theIStream) Standard_OVERRIDE;
0095 
0096   //! Loads a file and returns the read status
0097   //! Zero for a Model which compies with the Controller
0098   Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString filename,
0099                                                  const StepData_ConfParameters& theParams);
0100 
0101   //! Loads a file from stream and returns the read status
0102   Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString theName,
0103                                                    const StepData_ConfParameters& theParams,
0104                                                    std::istream& theIStream);
0105   
0106   //! Transfers a root given its rank in the list of candidate roots
0107   //! Default is the first one
0108   //! Returns True if a shape has resulted, false else
0109   //! Same as inherited TransferOneRoot, kept for compatibility
0110   Standard_EXPORT Standard_Boolean TransferRoot (const Standard_Integer num = 1,
0111                                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
0112   
0113   //! Determines the list of root entities from Model which are candidate for
0114   //! a transfer to a Shape (type of entities is PRODUCT)
0115   Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() Standard_OVERRIDE;
0116   
0117   //! Returns sequence of all unit names for shape representations
0118   //! found in file
0119   Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
0120 
0121   //! Sets system length unit used by transfer process.
0122   //! Performs only if a model is not NULL
0123   Standard_EXPORT void SetSystemLengthUnit(const Standard_Real theLengthUnit);
0124 
0125   //! Returns system length unit used by transfer process.
0126   //! Performs only if a model is not NULL
0127   Standard_EXPORT Standard_Real SystemLengthUnit() const;
0128 
0129 
0130 protected:
0131 
0132 
0133 
0134 
0135 
0136 private:
0137 
0138   
0139   //! Returns  units for length , angle and solidangle for shape representations
0140   Standard_EXPORT Standard_Boolean findUnits (const Handle(StepRepr_RepresentationContext)& theReprContext, TColStd_Array1OfAsciiString& theNameUnits, TColStd_Array1OfReal& theFactorUnits);
0141 
0142 
0143 
0144 
0145 };
0146 
0147 
0148 
0149 
0150 
0151 
0152 
0153 #endif // _STEPControl_Reader_HeaderFile