Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:57

0001 // Created on: 1996-01-30
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 _IGESControl_Writer_HeaderFile
0018 #define _IGESControl_Writer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <IGESData_BasicEditor.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_CString.hxx>
0027 #include <Standard_OStream.hxx>
0028 #include <Message_ProgressRange.hxx>
0029 
0030 class Transfer_FinderProcess;
0031 class IGESData_IGESModel;
0032 class TopoDS_Shape;
0033 class Standard_Transient;
0034 class IGESData_IGESEntity;
0035 
0036 
0037 //! This class creates and writes
0038 //! IGES files from CAS.CADE models. An IGES file can be written to
0039 //! an existing IGES file or to a new one.
0040 //! The translation can be performed in one or several
0041 //! operations. Each translation operation
0042 //! outputs a distinct root entity in the IGES file.
0043 //! To write an IGES file it is possible to use the following sequence:
0044 //! To modify the IGES file header or to change translation
0045 //! parameters it is necessary to use class Interface_Static (see
0046 //! IGESParameters and GeneralParameters).
0047 class IGESControl_Writer 
0048 {
0049 public:
0050 
0051   DEFINE_STANDARD_ALLOC
0052   
0053   //! Creates a writer object with the
0054   //! default unit (millimeters) and write mode (Face).
0055   //! IGESControl_Writer (const Standard_CString unit,
0056   //! const Standard_Integer modecr = 0);
0057   Standard_EXPORT IGESControl_Writer();
0058   
0059   //! Creates a writer with given
0060   //! values for units and for write mode.
0061   //! unit may be any unit that is accepted by the IGES standard.
0062   //! By default, it is the millimeter.
0063   //! modecr defines the write mode and may be:
0064   //! - 0: Faces (default)
0065   //! - 1: BRep.
0066   Standard_EXPORT IGESControl_Writer(const Standard_CString unit, const Standard_Integer modecr = 0);
0067   
0068   //! Creates a writer object with the
0069   //! prepared IGES model model in write mode.
0070   //! modecr defines the write mode and may be:
0071   //! - 0: Faces (default)
0072   //! - 1: BRep.
0073   Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr = 0);
0074   
0075   //! Returns the IGES model to be written in output.
0076   const Handle(IGESData_IGESModel) & Model() const
0077   { return myModel; }
0078 
0079   const Handle(Transfer_FinderProcess) & TransferProcess() const
0080   { return myTP; }
0081 
0082   //! Returns/Sets the TransferProcess : it contains final results
0083   //! and if some, check messages
0084   void SetTransferProcess (const Handle(Transfer_FinderProcess)& TP)
0085   { myTP = TP; }
0086   
0087   //! Translates a Shape to IGES Entities and adds them to the model
0088   //! Returns True if done, False if Shape not suitable for IGES or null
0089   Standard_EXPORT Standard_Boolean AddShape (const TopoDS_Shape& sh,
0090                                              const Message_ProgressRange& theProgress = Message_ProgressRange());
0091   
0092   //! Translates a Geometry (Surface or Curve) to IGES Entities and
0093   //! adds them to the model
0094   //! Returns True if done, False if geom is neither a Surface or
0095   //! a Curve suitable for IGES or is null
0096   Standard_EXPORT Standard_Boolean AddGeom (const Handle(Standard_Transient)& geom);
0097   
0098   //! Adds an IGES entity (and the ones it references) to the model
0099   Standard_EXPORT Standard_Boolean AddEntity (const Handle(IGESData_IGESEntity)& ent);
0100   
0101   //! Computes the entities found in
0102   //! the model, which is ready to be written.
0103   //! This contrasts with the default computation of headers only.
0104   Standard_EXPORT void ComputeModel();
0105   
0106   //! Computes then writes the model to an OStream
0107   //! Returns True when done, false in case of error
0108   Standard_EXPORT Standard_Boolean Write (Standard_OStream& S, const Standard_Boolean fnes = Standard_False);
0109   
0110   //! Prepares and writes an IGES model
0111   //! either to an OStream, S or to a file name,CString.
0112   //! Returns True if the operation was performed correctly and
0113   //! False if an error occurred (for instance,
0114   //! if the processor could not create the file).
0115   Standard_EXPORT Standard_Boolean Write (const Standard_CString file, const Standard_Boolean fnes = Standard_False);
0116 
0117  private:
0118 
0119   Handle(Transfer_FinderProcess) myTP;
0120   Handle(IGESData_IGESModel) myModel;
0121   IGESData_BasicEditor myEditor;
0122   Standard_Integer myWriteMode;
0123   Standard_Boolean myIsComputed;
0124 };
0125 
0126 #endif // _IGESControl_Writer_HeaderFile