+++ /dev/null
-// Copyright (C) 2014 OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include <DXFPLUGIN_exports.h>
-#include <DXFPLUGIN_version.h>
-
-#include <Basics_Utils.hxx>
-
-#include <DxfControl_Writer.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TopoDS_Shape.hxx>
-
-#ifdef DXF_HASLICENSE
-#include <DXFPLUGIN_license.h>
-
-#include <Standard_LicenseError.hxx>
-#include <OCCLicense_Activate.hxx>
-#endif // DXF_HASLICENSE
-
-extern "C"
-{
- /*!
- \brief Get version of the plugin.
- \return the version of the plugin
- */
- DXFPLUGIN_EXPORT
- int GetVersion()
- {
- return DXFPLUGIN_VERSION;
- }
-
- /*!
- \brief Get version of the plugin.
- \return the string representation of the plugin's version
- */
- DXFPLUGIN_EXPORT
- char* GetVersionStr()
- {
- return (char*)DXFPLUGIN_VERSION_STR;
- }
-
- /*!
- \brief Export shape to the DXF format.
- \param theShape shape being exported
- \param theFileName file path
- \param theFormatName file format signature
- \return error status (0 in case of success)
- */
- DXFPLUGIN_EXPORT
- int Export(const TopoDS_Shape& theShape,
- const TCollection_AsciiString& theFileName,
- const TCollection_AsciiString& theFormatName)
- {
-#ifdef DXF_HASLICENSE
- try {
- OCCLicense_Activate("DXF-W-"OCC_VERSION_STRING, DXF_WRITE_LICENSE);
- }
- catch (Standard_LicenseError) {
- return 1;
- }
-#endif // DXF_HASLICENSE
-
- // Set "C" numeric locale to save numbers correctly
- Kernel_Utils::Localizer loc;
-
- DxfControl_Writer aWriter;
-
- try {
- IFSelect_ReturnStatus status ;
- status = aWriter.TransferShape(theShape);
- if ( status == IFSelect_RetDone )
- status = aWriter.WriteFile( theFileName.ToCString() ) ;
- if ( status == IFSelect_RetDone )
- return 1;
- }
- catch(Standard_Failure) {
- return 1;
- }
- return 0;
- }
-} // end of extern "C"