1 // Copyright (C) 2014 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <ACISPLUGIN_exports.h>
21 #include <ACISPLUGIN_version.h>
23 #include <Basics_Utils.hxx>
25 #include <IFSelect_ReturnStatus.hxx>
26 #include <SatControl_Writer.hxx>
27 #include <TCollection_AsciiString.hxx>
28 #include <TopoDS_Shape.hxx>
30 #ifdef ACIS_HASLICENSE
31 #include <ACISPLUGIN_license.h>
33 #include <OCCLicense_Activate.hxx>
34 #include <Standard_LicenseError.hxx>
35 #endif // ACIS_HASLICENSE
40 \brief Get version of the plugin.
41 \return the version of the plugin
46 return ACISPLUGIN_VERSION;
50 \brief Get version of the plugin.
51 \return the string representation of the plugin's version
56 return (char*)ACISPLUGIN_VERSION_STR;
60 \brief Export shape to the ACIS format.
61 \param theShape shape being exported
62 \param theFileName file path
63 \param theFormatName file format signature
64 \return error status (0 in case of success)
67 int Export(const TopoDS_Shape& theShape,
68 const TCollection_AsciiString& theFileName,
69 const TCollection_AsciiString& theFormatName)
71 #ifdef ACIS_HASLICENSE
73 OCCLicense_Activate("SAT-W-"OCC_VERSION_STRING, ACIS_WRITE_LICENSE);
75 catch (Standard_LicenseError) {
78 #endif // ACIS_HASLICENSE
80 // Set "C" numeric locale to save numbers correctly
81 Kernel_Utils::Localizer loc;
83 SatControl_Writer aWriter;
86 IFSelect_ReturnStatus status ;
87 status = aWriter.TransferShape(theShape);
88 if ( status == IFSelect_RetDone )
89 status = aWriter.WriteFile( theFileName.ToCString() ) ;
90 if ( status == IFSelect_RetDone )
93 catch(Standard_Failure) {
98 } // end of extern "C"