--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+ADD_SUBDIRECTORY(salome)
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+ADD_SUBDIRECTORY(examples)
+ADD_SUBDIRECTORY(gui)
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
+INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/DXFPLUGIN)
--- /dev/null
+# Import/Export DXF
+
+import salome
+salome.salome_init()
+import GEOM,os
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+# Example of import/export file in DXF format
+
+print "Test Export/Import DXF ..."
+
+tmpDir = os.getenv("TEMP")
+if tmpDir == None:
+ tmpDir = "/tmp"
+
+# File for Export/Import testing
+fileExportImport = tmpDir + "/testExportImportDXF.dxf"
+
+# create shape
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+
+# export shape
+geompy.ExportDXF(box,fileExportImport)
+
+# import shape
+Shape1 = geompy.ImportDXF(fileExportImport)
+geompy.addToStudy(Shape1, "ImportDXF_1")
+
+# It is possible also to use next format of importing and publishing in study
+
+Shape2 = geompy.ImportDXF(fileExportImport,"ImportDXF_2")
+
+print "OK"
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+ADD_SUBDIRECTORY(DXFPLUGIN)
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+SALOME_CONFIGURE_FILE(doxyfile.in doxyfile)
+SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
+SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
+SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html)
+
+SET(kernel_file "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py")
+IF(WIN32)
+ STRING(REPLACE "/" "\\" kernel_file ${kernel_file})
+ENDIF(WIN32)
+
+ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp
+ COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/DXFPluginBuilder.py ${CMAKE_SOURCE_DIR}/src/DXFPluginBuilder.py
+ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
+ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
+ COMMAND ${CMAKE_COMMAND} -E remove_directory tmp
+ VERBATIM
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DXFPLUGIN DESTINATION ${SALOME_INSTALL_DOC}/gui)
+INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/DXFPLUGIN)
+INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/DXFPLUGIN/dxfpluginpy_doc)
+
+SET(make_clean_files DXFPLUGIN dxfpluginpy_doc.tag)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = "SALOME DXFPLUGIN User's Guide"
+OUTPUT_DIRECTORY = DXFPLUGIN
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+TAB_SIZE = 5
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+
+#---------------------------------------------------------------------------
+#Input related options
+#---------------------------------------------------------------------------
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@/input
+FILE_PATTERNS = *.doc
+EXCLUDE =
+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
+EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/doc/salome/examples
+
+#---------------------------------------------------------------------------
+#HTML related options
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = .
+HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header.html
+HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
+TOC_EXPAND = YES
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 300
+
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool...
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = NO
+CLASS_GRAPH = NO
+COLLABORATION_GRAPH = NO
+GROUP_GRAPHS = NO
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = NO
+INCLUDED_BY_GRAPH = NO
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = NO
+DIRECTORY_GRAPH = NO
+DOT_IMAGE_FORMAT = jpg
+DOT_FONTNAME = Arial
+DOT_PATH =.
+DOTFILE_DIRS =.
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1200
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+
+
+GENERATE_LEGEND = NO
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+#SORT related options
+#---------------------------------------------------------------------------
+SORT_GROUP_NAMES = NO
+
+#---------------------------------------------------------------------------
+#LaTeX related option
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+EXTRA_PACKAGES = amsmath
+
+#---------------------------------------------------------------------------
+#RTF related options
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+
+#---------------------------------------------------------------------------
+#External reference options
+#---------------------------------------------------------------------------
+
+TAGFILES = dxfpluginpy_doc.tag=../DXFPLUGIN/dxfpluginpy_doc
+SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+#Custom commands
+#---------------------------------------------------------------------------
+ALIASES += tui_script{1}="\include \1 <a href=\"../../examples/DXFPLUGIN/\1\">Download this script</a>"
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = "SALOME DXFPLUGIN User's Guide"
+OUTPUT_DIRECTORY = DXFPLUGIN
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = NO
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 5
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = YES
+BUILTIN_STL_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = YES
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = NO
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+MAX_INITIALIZER_LINES = 25
+SHOW_USED_FILES = NO
+SHOW_DIRECTORIES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+EXCLUDE_SYMLINKS = NO
+EXAMPLE_RECURSIVE = NO
+
+#---------------------------------------------------------------------------
+#Input related options
+#---------------------------------------------------------------------------
+INPUT = tmp @CMAKE_SOURCE_DIR@/idl/DXFPlugin_Gen.idl
+FILE_PATTERNS =
+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
+RECURSIVE = NO
+EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/src/
+
+#---------------------------------------------------------------------------
+#HTML related options
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = dxfpluginpy_doc
+HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header_py.html
+HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html
+HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css
+TOC_EXPAND = YES
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 300
+
+#---------------------------------------------------------------------------
+#LaTeX related option
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+
+#---------------------------------------------------------------------------
+#RTF related options
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = NO
+GROUP_GRAPHS = NO
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_FONTNAME = Arial
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = NO
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+#External reference options
+#---------------------------------------------------------------------------
+GENERATE_TAGFILE = dxfpluginpy_doc.tag
+SEARCHENGINE = YES
--- /dev/null
+/*!
+
+\page dxfplugin_importexport_page Import/Export DXF
+
+For using DXFPLUGIN functionalities in SALOME:
+
+- Run SALOME and activate Geometry module.
+
+- Import the DXF file from menu <b>File/Import/DXF</b>.
+
+ \image html import_dxf.png
+
+ Browse and select the file and click "Open" button. New object (shape)
+ will appears in the SALOME object browser.
+
+ \note It is possible to re-open from the initial file a previously imported shape if
+ the file has been changed on disk. For this, select <b>Reload From Disk</b>
+ in the context menu of the imported shape. The reloaded shape will have the same
+ representation parameters as before this operation.
+
+ \image html reopen_dxf.png
+
+- Export to the DXF file selecting a shape in the SALOME object browser and
+ calling menu <b>File/Export/DXF</b>.
+
+ \image html export_dxf.png
+
+ Enter the file name and click "Save" button.
+
+*/
--- /dev/null
+/*!
+
+\page dxfplugin_python_interface_page Python Interface
+
+Python package DXFPluginBuilder defines several classes, destined for
+import and export CAD models in DXF format (*.dxf files).
+
+DXFPLUGIN dynamically adds several methods to the geomBuilder.
+
+Below you can see an example of usage of the DXFPluginBuilder package for
+import and export CAD models:
+
+\anchor example_DXFPlugin
+<h2>Example of import/export CAD model stored in DXF format (*.dxf files) with DXFPLUGIN:</h2>
+\tui_script{DXFPlugindemo.py}
+
+*/
+
+
--- /dev/null
+/*!
+
+\mainpage Introduction to DXFPLUGIN
+
+\b DXF interface to be used as plugin for SALOME Geometry
+module.
+It is destined for:
+- Importing CAD models stored in DXF format (*.dxf files) into
+SALOME study;
+- Exporting CAD models from SALOME to the *.dxf files.
+
+To manage parameters of the DXFPLUGIN use \subpage dxfplugin_importexport_page.
+
+Also all DXFPLUGIN functionalities are accessible via
+\subpage dxfplugin_python_interface_page "DXFPLUGIN Python interface".
+
+*/
--- /dev/null
+<!-- HTML footer for doxygen 1.8.3.1-->
+<!--BEGIN GENERATE_TREEVIEW-->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+ <ul>
+ $navpath
+ <li class="footer">
+ Copyright © 2014 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+ </li>
+ </ul>
+</div>
+<!--END GENERATE_TREEVIEW-->
+</body>
+</html>
--- /dev/null
+<!-- HTML header for doxygen 1.8.3.1-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$search
+$mathjax
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<div id="titlearea"><div align="right"><div class="version">Version: @SALOMEDXFPLUGIN_VERSION@</div></div></div>
+<!-- end header part -->
--- /dev/null
+<!-- HTML header for doxygen 1.8.3.1-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen $doxygenversion"/>
+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath^jquery.js"></script>
+<script type="text/javascript" src="$relpath^dynsections.js"></script>
+$treeview
+$search
+$mathjax
+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
+$extrastylesheet
+</head>
+<body>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+
+<div id="titlearea"><div align="right"><div class="version">Version: @SALOMEDXFPLUGIN_VERSION@</div></div></div>
+<div align="bottom-left"><a href=../index.html>Home</a></div>
+<!-- end header part -->
--- /dev/null
+/* The extra CSS for doxygen 1.8.3.1 */
+
+#titlearea {
+ background-image:url('head.png');
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+ padding: 0px;
+ margin: 0px;
+ width: 99.9%;
+ border-bottom: 1px solid #5373B4;
+}
+
+div.version {
+ border:1px solid #0000FF;
+ color: #CCCCCC;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+ margin: 5px;
+}
+
+.navpath li.footer {
+ line-height:15px;
+ text-align: right;
+}
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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(UseOmniORB)
+
+INCLUDE_DIRECTORIES(
+ ${KERNEL_INCLUDE_DIRS}
+ ${GEOM_INCLUDE_DIRS}
+ ${OMNIORB_INCLUDE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+IF(WIN32)
+ ADD_DEFINITIONS(-DNOGDI)
+ENDIF(WIN32)
+
+SET(SalomeIDLDXFPlugin_IDLSOURCES
+ DXFPlugin_Gen.idl
+)
+
+SET(IDL_INCLUDE_DIRS
+ ${KERNEL_ROOT_DIR}/idl/salome
+ ${GEOM_ROOT_DIR}/idl/salome
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+SET(IDL_LINK_FLAGS
+ ${KERNEL_SalomeIDLKernel}
+ ${GEOM_SalomeIDLGEOM}
+)
+
+OMNIORB_ADD_MODULE(SalomeIDLDXFPlugin "${SalomeIDLDXFPlugin_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_FLAGS}")
+ADD_DEPENDENCIES(SalomeIDLDXFPlugin ${GEOM_SalomeIDLGEOM})
+INSTALL(TARGETS SalomeIDLDXFPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef __DXFPlugin_GEN__
+#define __DXFPlugin_GEN__
+
+#include "GEOM_Gen.idl"
+
+module DXFPlugin {
+
+ /*!
+ * \brief Interface for DXFPlugin modeling functions.
+ */
+ interface GEOM_IDXFPluginOperations : GEOM::GEOM_IOperations
+ {
+ /*!
+ * \brief Export the given shape into a file with given name in DXF format.
+ *
+ * \param theObject Shape to be stored in the file.
+ * \param theFileName Name of the file to store the given shape in.
+ */
+ void ExportDXF( in GEOM::GEOM_Object theObject,
+ in string theFileName );
+
+ /*!
+ * \brief Import a shape from the DXF file.
+ *
+ * \param theFileName The file, containing the shape.
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+ GEOM::ListOfGO ImportDXF( in string theFileName );
+ };
+};
+
+#endif
--- /dev/null
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
+<!--
+ Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+
+-->
+
+<!-- GUI customization for GEOM component -->
+
+<geom-plugins>
+
+ <geom-plugin name="DXFPlugin"
+ server-lib="DXFPluginEngine"
+ gui-lib="DXFPluginGUI">
+ <actions>
+ <action label="Import_DXF"
+ menu="FILE/IMPORT:10/IMPORTDXF"
+ status-bar="IMPORTDXF">
+ </action>
+ <action label="Export_DXF"
+ menu="FILE/EXPORT:10/EXPORTDXF"
+ status-bar="EXPORTDXF">
+ </action>
+ </actions>
+ </geom-plugin>
+
+</geom-plugins>
--- /dev/null
+<!--
+ Copyright (C) 2014 CEA/DEN, EDF R&D, 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.
+
+ 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
+
+-->
+<document>
+ <section name="resources">
+ <parameter name="DXFPlugin" value="${DXFPLUGIN_ROOT_DIR}/share/salome/resources/dxfplugin"/>
+ </section>
+ <section name="GEOM">
+ <!-- Default GEOM module plugins -->
+ <parameter name="plugins" value="DXFPlugin"/>
+ </section>
+ <section name="geom_help" >
+ <parameter name="Plug-ins/DXF plugin User's Guide" value="${DXFPLUGIN_ROOT_DIR}/share/doc/salome/gui/DXFPLUGIN/index.html"/>
+ </section>
+</document>
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+from DXFPlugin import GEOM_IDXFPluginOperations
+
+# Engine Library Name
+__libraryName__ = "DXFPluginEngine"
+
+def GetDXFPluginOperations(self):
+ anOp = self.GetPluginOperations(self.myStudyId, __libraryName__)
+ return anOp._narrow(GEOM_IDXFPluginOperations)
+
+## Export the given shape into a file with given name in DXF format.
+# @param theObject Shape to be stored in the file.
+# @param theFileName Name of the file to store the given shape in.
+def ExportDXF(self, theObject, theFileName):
+ """
+ Export the given shape into a file with given name in DXF format.
+
+ Parameters:
+ theObject Shape to be stored in the file.
+ theFileName Name of the file to store the given shape in.
+ """
+ anOp = GetDXFPluginOperations(self)
+ anOp.ExportDXF(theObject, theFileName)
+ if anOp.IsDone() == 0:
+ raise RuntimeError, "Export : " + anOp.GetErrorCode()
+ pass
+ pass
+
+
+## Import a shape from the DXF file
+# @param theFileName The file, containing the shape.
+# @param theName Object name; when specified, this parameter is used
+# for result publication in the study. Otherwise, if automatic
+# publication is switched on, default value is used for result name.
+#
+# @return New GEOM.GEOM_Object, containing the imported shape.
+# If material names are imported it returns the list of
+# objects. The first one is the imported object followed by
+# material groups.
+# @note Auto publishing is allowed for the shape itself. Imported
+# material groups are not automatically published.
+def ImportDXF(self, theFileName, theName=None):
+ """
+ Import a shape from the DXF file
+
+ Parameters:
+ theFileName The file, containing the shape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the imported shape.
+ If material names are imported it returns the list of
+ objects. The first one is the imported object followed by
+ material groups.
+ Note:
+ Auto publishing is allowed for the shape itself. Imported
+ material groups are not automatically published.
+ """
+ from salome.geom.geomBuilder import RaiseIfFailed
+ anOp = GetDXFPluginOperations(self)
+ aListObj = anOp.ImportDXF(theFileName)
+ RaiseIfFailed("ImportDXF", anOp)
+ aNbObj = len(aListObj)
+ if aNbObj > 0:
+ self._autoPublish(aListObj[0], theName, "imported")
+ if aNbObj == 1:
+ return aListObj[0]
+ return aListObj
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+#include "DXFPlugin_OperationsCreator.hh"
+
+extern "C"
+{
+DXFPLUGINENGINE_EXPORT
+ GEOM_GenericOperationsCreator* GetOperationsCreator()
+ {
+ DXFPlugin_OperationsCreator* aCreator = new DXFPlugin_OperationsCreator();
+ return aCreator;
+ }
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPluginGUI.h"
+#include "DXFPlugin_ExportDlg.h"
+#include "DXFPlugin_ImportDlg.h"
+
+// GUI includes
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SalomeApp_Application.h>
+#include <SALOME_ListIteratorOfListIO.hxx>
+#include <LightApp_SelectionMgr.h>
+
+// GEOM includes
+#include <GeometryGUI.h>
+
+//=======================================================================
+// function : DXFPluginGUI()
+// purpose : Constructor
+//=======================================================================
+DXFPluginGUI::DXFPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
+{
+}
+
+//=======================================================================
+// function : ~DXFPluginGUI
+// purpose : Destructor
+//=======================================================================
+DXFPluginGUI::~DXFPluginGUI()
+{
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool DXFPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
+{
+ switch ( theCommandID ) {
+ case 1:
+ return OnGUIEvent("Export_DXF", parent);
+ case 2:
+ return OnGUIEvent("Import_DXF", parent);
+ default:
+ return OnGUIEvent("", parent);
+ }
+ return false;
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool DXFPluginGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
+{
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if (!app) return false;
+
+ getGeometryGUI()->EmitSignalDeactivateDialog();
+
+ SUIT_FileDlg* dialog = NULL;
+ if( theCommandID == "Export_DXF" ) {
+ // Get selected objects
+ LightApp_SelectionMgr* sm = app->selectionMgr();
+ if( !sm ) return false;
+ SALOME_ListIO selectedObjects;
+ sm->selectedObjects( selectedObjects );
+ if( selectedObjects.Extent() == 0 ) {
+ SUIT_MessageBox::warning( app->desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") );
+ }
+ else {
+ SALOME_ListIteratorOfListIO It( selectedObjects );
+ for( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) IObject = It.Value();
+ dialog = new DXFPlugin_ExportDlg( IObject, parent );
+ if( dialog->exec() == QDialog::Accepted )
+ delete dialog;
+ }
+ }
+ }
+ else if (theCommandID == "Import_DXF") {
+ dialog = new DXFPlugin_ImportDlg( parent );
+ if (dialog != NULL)
+ dialog->show();
+ if( dialog->exec() == QDialog::Accepted )
+ delete dialog;
+ }
+ else {
+ app->putInfo( tr("GEOM_PRP_COMMAND").arg( theCommandID ) );
+ }
+
+ return true;
+}
+
+//=====================================================================================
+// EXPORTED METHODS
+//=====================================================================================
+extern "C"
+{
+#ifdef WIN32
+ __declspec( dllexport )
+#endif
+ GEOMGUI* GetLibGUI( GeometryGUI* parent )
+ {
+ return new DXFPluginGUI( parent );
+ }
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef DXFPluginGUI_H
+#define DXFPluginGUI_H
+
+#include <GEOMPluginGUI.h>
+
+class DXFPluginGUI: public GEOMPluginGUI
+{
+public:
+ DXFPluginGUI( GeometryGUI* parent );
+ ~DXFPluginGUI();
+
+ bool OnGUIEvent( int commandId, SUIT_Desktop* );
+ bool OnGUIEvent( const QString&, SUIT_Desktop* );
+};
+
+#endif // DXFPluginGUI_H
-// Copyright (C) 2014 OPEN CASCADE
+// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#if !defined (__DXFPLUGIN_EXPORTS_H)
-#define __DXFPLUGIN_EXPORTS_H
+#ifndef _DXFPLUGIN_ENGINE_HXX_
+#define _DXFPLUGIN_ENGINE_HXX_
#ifdef WIN32
-# if defined DXFExport_EXPORTS || defined DXFXPORTS_EXPORTS || defined DXFImport_EXPORTS || defined DXFIMPORT_EXPORTS
-# define DXFPLUGIN_EXPORT __declspec(dllexport)
-# else
-# define DXFPLUGIN_EXPORT __declspec(dllimport)
-# endif
-#else // WIN32
-# define DXFPLUGIN_EXPORT
-#endif // WIN32
+ #if defined DXFPLUGINENGINE_EXPORTS || defined DXFPLUGINENGINE_EXPORTS
+ #define DXFPLUGINENGINE_EXPORT __declspec( dllexport )
+ #else
+ #define DXFPLUGINENGINE_EXPORT __declspec( dllimport )
+ #endif
+#else
+ #define DXFPLUGINENGINE_EXPORT
+#endif
-#endif // __DXFPLUGIN_EXPORTS_H
+#endif
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_ExportDlg.h"
+#include "DXFPlugin_Operations_i.hh"
+
+// GUI includes
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_OverrideCursor.h>
+
+#include <SalomeApp_Application.h>
+
+// GEOM includes
+#include <GEOMBase.h>
+#include <GEOM_Operation.h>
+#include <GEOM_Constants.h>
+
+//=================================================================================
+// Constructor
+//=================================================================================
+DXFPlugin_ExportDlg::DXFPlugin_ExportDlg( Handle(SALOME_InteractiveObject)& object, QWidget* parent )
+: SUIT_FileDlg( parent, false, true, true ),
+ GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) )
+{
+ setWindowTitle( tr( "DXFPLUGIN_EXPORT_TITLE" ) );
+ setNameFilter( tr( "DXFPLUGIN_DXF_FILES" ) );
+
+ myObject = object;
+ const char* objectName = myObject->getName();
+ selectFile( QString( objectName ) );
+}
+
+//=================================================================================
+// Destructor
+//=================================================================================
+DXFPlugin_ExportDlg::~DXFPlugin_ExportDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr DXFPlugin_ExportDlg::createOperation()
+{
+ return getGeomEngine()->GetPluginOperations( getStudyId(), "DXFPluginEngine" );
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool DXFPlugin_ExportDlg::isValid( QString& msg )
+{
+ bool ok = true;
+ //@@ add custom validation actions here @@//
+ return ok;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool DXFPlugin_ExportDlg::execute( ObjectList& objects )
+{
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if (!app) return false;
+
+ DXFPlugin::GEOM_IDXFPluginOperations_var aDXFOp = DXFPlugin::GEOM_IDXFPluginOperations::_narrow( getOperation() );
+ if ( aDXFOp->_is_nil() ) return false;
+
+ GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( myObject );
+ if ( anObj->_is_nil() ) return false;
+
+ QString aFile = selectedFile();
+
+ // User has pressed "Cancel" --> stop the operation
+ if ( aFile.isEmpty() )
+ return false;
+
+ GEOM_Operation* anOp = new GEOM_Operation( app, aDXFOp.in() );
+ try {
+ SUIT_OverrideCursor wc;
+ app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( aFile, /*withExten=*/true )) );
+ anOp->start();
+ aDXFOp->ExportDXF( anObj, aFile.toUtf8().constData() );
+ if( aDXFOp->IsDone() )
+ anOp->commit();
+ else {
+ anOp->abort();
+ wc.suspend();
+ SUIT_MessageBox::critical( app->desktop(),
+ QObject::tr("GEOM_ERROR"),
+ QObject::tr("GEOM_PRP_ABORT") + "\n" + QObject::tr( aDXFOp->GetErrorCode() ) );
+ return false;
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ anOp->abort();
+ return false;
+ }
+
+ objects.push_back( anObj._retn() );
+ return true;
+}
+
+void DXFPlugin_ExportDlg::accept()
+{
+ SUIT_FileDlg::accept();
+ onAccept(false);
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef DXFPlugin_ExportDlg_H
+#define DXFPlugin_ExportDlg_H
+
+// GUI includes
+#include <SUIT_FileDlg.h>
+
+// GEOM includes
+#include <GEOM_GenericObjPtr.h>
+#include <GEOMBase_Helper.h>
+
+
+class DXFPlugin_ExportDlg: public SUIT_FileDlg, public GEOMBase_Helper
+{
+ Q_OBJECT
+
+public:
+ DXFPlugin_ExportDlg( Handle(SALOME_InteractiveObject)&, QWidget* = 0 );
+ ~DXFPlugin_ExportDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+
+protected slots:
+ void accept();
+
+private:
+ Handle(SALOME_InteractiveObject) myObject;
+};
+
+#endif // DXFPlugin_ExportDlg_H
-// Copyright (C) 2014 OPEN CASCADE
+// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <DXFPLUGIN_exports.h>
-#include <DXFPLUGIN_version.h>
+// internal includes
+#include "DXFPlugin_ExportDriver.hxx"
+#include "DXFPlugin_IExport.hxx"
+#include "DXFPlugin_Engine.hxx"
+// KERNEL includes
#include <Basics_Utils.hxx>
+#include <utilities.h>
-#include <DxfControl_Writer.hxx>
+// GEOM includes
+#include <GEOM_Function.hxx>
+
+// OOCT includes
#include <IFSelect_ReturnStatus.hxx>
+#include <DxfControl_Writer.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Shape.hxx>
#ifdef DXF_HASLICENSE
-#include <DXFPLUGIN_license.h>
+#include "DXFPlugin_license.h"
-#include <Standard_LicenseError.hxx>
#include <OCCLicense_Activate.hxx>
+#include <Standard_LicenseError.hxx>
#endif // DXF_HASLICENSE
-extern "C"
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& DXFPlugin_ExportDriver::GetID()
{
- /*!
- \brief Get version of the plugin.
- \return the version of the plugin
- */
- DXFPLUGIN_EXPORT
- int GetVersion()
- {
- return DXFPLUGIN_VERSION;
- }
+ static Standard_GUID aGUID("5bad3191-8af9-4b90-9e95-31f5fdb65304");
+ return aGUID;
+}
- /*!
- \brief Get version of the plugin.
- \return the string representation of the plugin's version
- */
- DXFPLUGIN_EXPORT
- char* GetVersionStr()
- {
- return (char*)DXFPLUGIN_VERSION_STR;
- }
+//=======================================================================
+//function : DXFPlugin_ExportDriver
+//purpose :
+//=======================================================================
+DXFPlugin_ExportDriver::DXFPlugin_ExportDriver()
+{
+}
- /*!
- \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)
- {
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer DXFPlugin_ExportDriver::Execute( TFunction_Logbook& log ) const
+{
#ifdef DXF_HASLICENSE
- try {
- OCCLicense_Activate("DXF-W-"OCC_VERSION_STRING, DXF_WRITE_LICENSE);
- }
- catch (Standard_LicenseError) {
- return 1;
- }
+ 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 )
+
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction( Label() );
+
+ DXFPlugin_IExport aData (aFunction);
+
+ // retrieve the being exported shape
+ TopoDS_Shape aShape;
+ Handle(GEOM_Function) aRefFunction = aData.GetOriginal();
+ if( aRefFunction.IsNull() ) return 0;
+ aShape = aRefFunction->GetValue();
+ if( aShape.IsNull() ) return 0;
+ // set the result of function to be used by next operations
+ aFunction->SetValue( aShape );
+
+ TCollection_AsciiString aFileName = aData.GetFileName();
+
+ MESSAGE("Export DXF into file " << aFileName.ToCString());
+
+ // Set "C" numeric locale to save numbers correctly
+ Kernel_Utils::Localizer loc;
+
+ DxfControl_Writer aWriter;
+
+ IFSelect_ReturnStatus status ;
+ status = aWriter.TransferShape( aShape );
+ if ( status == IFSelect_RetDone )
+ status = aWriter.WriteFile( aFileName.ToCString() ) ;
+ if ( status == IFSelect_RetDone )
return 1;
- }
- catch(Standard_Failure) {
- return 1;
- }
+ else
return 0;
- }
-} // end of extern "C"
+}
+
+//=======================================================================
+//function : MustExecute
+//purpose :
+//=======================================================================
+Standard_Boolean DXFPlugin_ExportDriver::MustExecute( const TFunction_Logbook& ) const
+{
+ return Standard_True;
+}
+
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
+bool DXFPlugin_ExportDriver::
+GetCreationInformation( std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams )
+{
+ return false;
+}
+
+IMPLEMENT_STANDARD_HANDLE( DXFPlugin_ExportDriver,GEOM_BaseDriver );
+IMPLEMENT_STANDARD_RTTIEXT( DXFPlugin_ExportDriver,GEOM_BaseDriver );
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _DXFPlugin_ExportDriver_HXX
+#define _DXFPlugin_ExportDriver_HXX
+
+// GEOM includes
+#include <GEOM_BaseDriver.hxx>
+
+// OCCT includes
+#ifndef _TFunction_Logbook_HeaderFile
+#include <TFunction_Logbook.hxx>
+#endif
+
+DEFINE_STANDARD_HANDLE( DXFPlugin_ExportDriver, GEOM_BaseDriver );
+
+class DXFPlugin_ExportDriver : public GEOM_BaseDriver
+{
+public:
+ Standard_EXPORT DXFPlugin_ExportDriver();
+ Standard_EXPORT ~DXFPlugin_ExportDriver() {};
+
+ Standard_EXPORT static const Standard_GUID& GetID();
+ Standard_EXPORT virtual Standard_Integer Execute( TFunction_Logbook& log ) const;
+ Standard_EXPORT Standard_Boolean MustExecute( const TFunction_Logbook& ) const;
+ Standard_EXPORT virtual void Validate( TFunction_Logbook& ) const {}
+
+ Standard_EXPORT virtual
+ bool GetCreationInformation( std::string& theOperationName,
+ std::vector<GEOM_Param>& params );
+
+DEFINE_STANDARD_RTTI( DXFPlugin_ExportDriver )
+};
+
+#endif // _DXFPlugin_ExportDriver_HXX
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_IECallBack.hxx"
+
+//=============================================================================
+/*!
+ * constructor
+ */
+//=============================================================================
+DXFPlugin_IECallBack::DXFPlugin_IECallBack( DXFPlugin_IOperations* theOperations )
+: GEOMImpl_IECallBack()
+{
+ myPluginOperations = theOperations;
+}
+
+//=============================================================================
+/*!
+ * destructor
+ */
+//=============================================================================
+DXFPlugin_IECallBack::~DXFPlugin_IECallBack()
+{
+}
+
+//=============================================================================
+/*!
+ * Export
+ */
+//=============================================================================
+bool DXFPlugin_IECallBack::Export( const Handle(GEOM_Object) theOriginal,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& theFormatName )
+{
+ myPluginOperations->ExportDXF( theOriginal, theFileName );
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Import
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+DXFPlugin_IECallBack::Import( const TCollection_AsciiString& theFormatName,
+ const TCollection_AsciiString& theFileName )
+{
+ return myPluginOperations->ImportDXF( theFileName );
+}
+
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _DXFPlugin_IECallBack_HXX_
+#define _DXFPlugin_IECallBack_HXX_
+
+// internal includes
+#include "DXFPlugin_IOperations.hxx"
+
+// GEOM includes
+#include <GEOM_Object.hxx>
+#include <GEOMImpl_IECallBack.hxx>
+
+// OCC includes
+#include <TCollection_AsciiString.hxx>
+
+class DXFPlugin_IECallBack : public GEOMImpl_IECallBack
+{
+public:
+ Standard_EXPORT DXFPlugin_IECallBack( DXFPlugin_IOperations* theOperations );
+ Standard_EXPORT ~DXFPlugin_IECallBack();
+
+ Standard_EXPORT virtual bool Export( const Handle(GEOM_Object) theOriginal,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& theFormatName );
+
+ Standard_EXPORT virtual
+ Handle(TColStd_HSequenceOfTransient) Import( const TCollection_AsciiString& theFormatName,
+ const TCollection_AsciiString& theFileName );
+
+private:
+ DXFPlugin_IOperations* myPluginOperations;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _DXFPlugin_IExport_HXX_
+#define _DXFPlugin_IExport_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define EXPORTDXF_ARG_ORIGINAL 1
+#define EXPORTDXF_ARG_FILENAME 2
+
+class DXFPlugin_IExport
+{
+public:
+ DXFPlugin_IExport( Handle(GEOM_Function) theFunction )
+ : _func(theFunction) {}
+
+ void SetOriginal( Handle( GEOM_Function ) theOriginal)
+ { _func->SetReference( EXPORTDXF_ARG_ORIGINAL, theOriginal ); }
+ Handle( GEOM_Function ) GetOriginal()
+ { return _func->GetReference( EXPORTDXF_ARG_ORIGINAL ); }
+
+ void SetFileName( const TCollection_AsciiString& theFileName )
+ { _func->SetString( EXPORTDXF_ARG_FILENAME, theFileName ); }
+ TCollection_AsciiString GetFileName()
+ { return _func->GetString( EXPORTDXF_ARG_FILENAME ); }
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _DXFPlugin_IExport_HXX_
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _DXFPlugin_IImport_HXX_
+#define _DXFPlugin_IImport_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define IMPORTDXF_ARG_FILENAME 1
+
+class DXFPlugin_IImport
+{
+public:
+ DXFPlugin_IImport( Handle(GEOM_Function) theFunction)
+ : _func(theFunction) {}
+
+ void SetFileName( const TCollection_AsciiString& theFileName )
+ { _func->SetString( IMPORTDXF_ARG_FILENAME, theFileName ); }
+ TCollection_AsciiString GetFileName()
+ { return _func->GetString( IMPORTDXF_ARG_FILENAME ); }
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _DXFPlugin_IImport_HXX_
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_IOperations.hxx"
+#include "DXFPlugin_ExportDriver.hxx"
+#include "DXFPlugin_ImportDriver.hxx"
+#include "DXFPlugin_IExport.hxx"
+#include "DXFPlugin_IImport.hxx"
+
+// KERNEL includes
+#include <utilities.h>
+
+// GEOM includes
+#include <GEOM_PythonDump.hxx>
+#include <GEOMImpl_Types.hxx>
+
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+DXFPlugin_IOperations::DXFPlugin_IOperations( GEOM_Engine* theEngine, int theDocID )
+: GEOMImpl_IBaseIEOperations( theEngine, theDocID )
+{
+ MESSAGE( "DXFPlugin_IOperations::DXFPlugin_IOperations" );
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+DXFPlugin_IOperations::~DXFPlugin_IOperations()
+{
+ MESSAGE( "DXFPlugin_IOperations::~DXFPlugin_IOperations" );
+}
+
+//=============================================================================
+/*!
+ * ExportDXF
+ * Export a shape to DXF format
+ * \param theOriginal The shape to export
+ * \param theFileName The name of the file to exported
+ * \param theIsASCII The format of the exported file (ASCII or Binary)
+ * \param theDeflection The deflection of the shape to exported
+ */
+//=============================================================================
+void DXFPlugin_IOperations::ExportDXF( const Handle(GEOM_Object) theOriginal,
+ const TCollection_AsciiString& theFileName )
+{
+ SetErrorCode(KO);
+ if( theOriginal.IsNull() ) return;
+
+ Handle(GEOM_Function) aRefFunction = theOriginal->GetLastFunction();
+ if( aRefFunction.IsNull() ) return; //There is no function which creates an object to be exported
+
+ //Add a new result object
+ Handle(GEOM_Object) result = GetEngine()->AddObject( GetDocID(), GEOM_IMPORT);
+
+ //Add an Export function
+ Handle(GEOM_Function) aFunction = result->AddFunction( DXFPlugin_ExportDriver::GetID(), EXPORT_SHAPE );
+ if( aFunction.IsNull() ) return;
+
+ //Check if the function is set correctly
+ if( aFunction->GetDriverGUID() != DXFPlugin_ExportDriver::GetID() ) return;
+
+ //Set parameters
+ DXFPlugin_IExport aCI( aFunction );
+ aCI.SetOriginal( aRefFunction );
+ aCI.SetFileName( theFileName );
+
+ //Perform the Export
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if( !GetSolver()->ComputeFunction( aFunction ) ) {
+ SetErrorCode( "Not enough space on disk, or you haven't permissions to write this directory" );
+ return;
+ }
+ }
+ catch( Standard_Failure ) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode( aFail->GetMessageString() );
+ return;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << "geompy.ExportDXF(" << theOriginal << ", \""
+ << theFileName.ToCString() << "\" )";
+
+ SetErrorCode(OK);
+}
+
+//=============================================================================
+/*!
+ * ImportDXF
+ * Import a shape from DXF format
+ * \param theFileName The name of the file to import
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+DXFPlugin_IOperations::ImportDXF( const TCollection_AsciiString& theFileName )
+{
+ SetErrorCode(KO);
+ if( theFileName.IsEmpty() ) return NULL;
+
+ //Add a new result object
+ Handle(GEOM_Object) anImported = GetEngine()->AddObject( GetDocID(), GEOM_IMPORT );
+
+ //Add an Import function
+ Handle(GEOM_Function) aFunction =
+ anImported->AddFunction( DXFPlugin_ImportDriver::GetID(), IMPORT_SHAPE);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != DXFPlugin_ImportDriver::GetID()) return NULL;
+
+ //Set parameters
+ DXFPlugin_IImport aCI( aFunction );
+ aCI.SetFileName( theFileName );
+
+ //Perform the Import
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if( !GetSolver()->ComputeFunction( aFunction ) ) {
+ SetErrorCode( "Import driver failed" );
+ return NULL;
+ }
+ aSeq->Append(anImported);
+
+ // Greate material groups.
+ //MakeMaterialGroups( anImported, aSeq );
+ }
+ catch( Standard_Failure ) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode( aFail->GetMessageString() );
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << aSeq << " = geompy.ImportDXF(\"" << theFileName.ToCString() << "\" )";
+ SetErrorCode(OK);
+
+ return aSeq;
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+// File : DXFPlugin_IOperations.hxx
+
+#ifndef _DXFPlugin_IOperations_HXX_
+#define _DXFPlugin_IOperations_HXX_
+
+// GEOM includes
+#include <GEOMImpl_IBaseIEOperations.hxx>
+
+class DXFPlugin_IOperations: public GEOMImpl_IBaseIEOperations
+{
+public:
+ Standard_EXPORT DXFPlugin_IOperations( GEOM_Engine*, int );
+ Standard_EXPORT ~DXFPlugin_IOperations();
+
+ Standard_EXPORT void ExportDXF( const Handle(GEOM_Object),
+ const TCollection_AsciiString& );
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ImportDXF( const TCollection_AsciiString& );
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_ImportDlg.h"
+#include "DXFPlugin_Operations_i.hh"
+
+// GUI includes
+#include <SUIT_Session.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+#include <SalomeApp_Application.h>
+
+// GEOM includes
+#include <GEOMBase.h>
+#include <GEOM_Operation.h>
+
+//=================================================================================
+// Constructor
+//=================================================================================
+DXFPlugin_ImportDlg::DXFPlugin_ImportDlg( QWidget* parent )
+: SUIT_FileDlg( parent, true, true, true ),
+ GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) )
+{
+ setWindowTitle( tr( "DXFPLUGIN_IMPORT_TITLE" ) );
+ setAcceptMode( AcceptOpen );
+ setNameFilter( tr( "DXFPLUGIN_DXF_FILES" ) );
+ setFileMode( QFileDialog::ExistingFiles );
+}
+
+//=================================================================================
+// Destructor
+//=================================================================================
+DXFPlugin_ImportDlg::~DXFPlugin_ImportDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr DXFPlugin_ImportDlg::createOperation()
+{
+ return getGeomEngine()->GetPluginOperations(getStudyId(), "DXFPluginEngine");
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool DXFPlugin_ImportDlg::isValid (QString& msg)
+{
+ bool ok = true;
+ //@@ add custom validation actions here @@//
+ return ok;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool DXFPlugin_ImportDlg::execute( ObjectList& objects )
+{
+ bool res = false;
+ GEOM::GEOM_Object_var anObj;
+ DXFPlugin::GEOM_IDXFPluginOperations_var anOper = DXFPlugin::GEOM_IDXFPluginOperations::_narrow( getOperation() );
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+
+ QStringList fileNames = selectedFiles();
+ if ( fileNames.count() == 0 )
+ return false; // nothing selected, return
+
+ for( int i = 0; i < fileNames.size(); i++ ) {
+ QString aFileName = fileNames.at( i );
+ if ( aFileName.isEmpty() )
+ continue;
+ GEOM_Operation* anOp = new GEOM_Operation( app, anOper.in() );
+ try {
+ app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( aFileName.toUtf8().constData(), /*withExten=*/true ) ) );
+ anOp->start();
+ GEOM::ListOfGO_var anObj = anOper->ImportDXF( aFileName.toUtf8().constData() );
+ if( anObj->length() > 0 && anOper->IsDone() ) {
+ GEOM::GEOM_Object_ptr anObjPtr = anObj[0]._retn();
+ objects.push_back( anObjPtr );
+ QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileNames.at( i ),
+ /*withExten=*/true ) );
+ anObjPtr->SetName( aPublishObjName.toStdString().c_str() );
+ anOp->commit();
+ }
+ else {
+ anOp->abort();
+ SUIT_MessageBox::critical( app->desktop(),
+ QObject::tr("GEOM_ERROR"),
+ QObject::tr("GEOM_PRP_ABORT") + "\n" + QObject::tr( anOper->GetErrorCode() ) );
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {
+ anOp->abort();
+ }
+ }
+ return true;
+}
+
+//=================================================================================
+// function : accept
+// purpose :
+//=================================================================================
+void DXFPlugin_ImportDlg::accept()
+{
+ SUIT_FileDlg::accept();
+ onAccept();
+}
+
+//=================================================================================
+// function : getObjectName
+// purpose :
+//=================================================================================
+QString DXFPlugin_ImportDlg::getObjectName( GEOM::GEOM_Object_ptr object ) const
+{
+ if( object->_is_nil() )
+ return QString::null;
+ return object->GetName();
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef DXFPlugin_IMPORTDLG_H
+#define DXFPlugin_IMPORTDLG_H
+
+// GUI includes
+#include <SUIT_FileDlg.h>
+
+// GEOM includes
+#include <GEOMBase_Helper.h>
+#include <GEOM_GenericObjPtr.h>
+
+class DXFPlugin_ImportDlg: public SUIT_FileDlg, public GEOMBase_Helper
+{
+ Q_OBJECT
+
+public:
+ DXFPlugin_ImportDlg( QWidget* = 0 );
+ ~DXFPlugin_ImportDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+ virtual QString getObjectName( GEOM::GEOM_Object_ptr object ) const;
+
+protected slots:
+ void accept();
+};
+
+#endif // DXFPlugin_IMPORTDLG_H
-// Copyright (C) 2014 OPEN CASCADE
+// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <DXFPLUGIN_exports.h>
-#include <DXFPLUGIN_version.h>
+// internal includes
+#include "DXFPlugin_ImportDriver.hxx"
+#include "DXFPlugin_IImport.hxx"
+#include "DXFPlugin_Engine.hxx"
+// KERNEL includes
#include <Basics_Utils.hxx>
+#include <utilities.h>
+// GEOM includes
+#include <GEOM_Function.hxx>
+#include <GEOMImpl_Types.hxx>
+
+// OOCT includes
#include <DxfControl_Reader.hxx>
#include <DxfSection_Block.hxx>
#include <DxfSection_HSequenceOfObject.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
+#include <StdFail_NotDone.hxx>
+
#ifdef DXF_HASLICENSE
-#include <DXFPLUGIN_license.h>
+#include "DXFPlugin_license.h"
-#include <Standard_LicenseError.hxx>
#include <OCCLicense_Activate.hxx>
+#include <Standard_LicenseError.hxx>
#endif // DXF_HASLICENSE
-extern "C"
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& DXFPlugin_ImportDriver::GetID()
{
- /*!
- \brief Get version of the plugin.
- \return the version of the plugin
- */
- DXFPLUGIN_EXPORT
- int GetVersion()
- {
- return DXFPLUGIN_VERSION;
- }
+ static Standard_GUID aGUID("dc74f282-3542-419f-a755-c5ab6aba17c5");
+ return aGUID;
+}
- /*!
- \brief Get version of the plugin.
- \return the string representation of the plugin's version
- */
- DXFPLUGIN_EXPORT
- char* GetVersionStr()
- {
- return (char*)DXFPLUGIN_VERSION_STR;
- }
+//=======================================================================
+//function : DXFPlugin_ImportDriver
+//purpose :
+//=======================================================================
+DXFPlugin_ImportDriver::DXFPlugin_ImportDriver()
+{
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer DXFPlugin_ImportDriver::Execute( TFunction_Logbook& log ) const
+{
+ if( Label().IsNull() ) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction( Label() );
+
+ DXFPlugin_IImport aData( aFunction );
+
+ TCollection_AsciiString aFileName = aData.GetFileName().ToCString();
+
+ MESSAGE("Import DXF from file " << aFileName);
+
+ TopoDS_Shape aResShape;
- /*!
- \brief Import shape from the DXF format.
- \param theFileName file path
- \param theFormatName file format signature
- \param theError error description, if there's any, is returned via this parameter
- \param theShapeLabel a label in the CAF tree where shape attributes are set to
- \return imported shape
- */
- DXFPLUGIN_EXPORT
- TopoDS_Shape Import(const TCollection_AsciiString& theFileName,
- const TCollection_AsciiString& /*theFormatName*/,
- TCollection_AsciiString& theError,
- const TDF_Label& theShapeLabel)
- {
- TopoDS_Shape aResShape;
-
#ifdef DXF_HASLICENSE
- try {
- OCCLicense_Activate( "DXF-R-"OCC_VERSION_STRING, DXF_READ_LICENSE);
- }
- catch (Standard_LicenseError) {
- return aResShape;
- }
+ try {
+ OCCLicense_Activate( "DXF-R-"OCC_VERSION_STRING, DXF_READ_LICENSE);
+ }
+ catch (Standard_LicenseError) {
+ return aResShape;
+ }
#endif
-
- // Set "C" numeric locale to save numbers correctly
- Kernel_Utils::Localizer loc;
-
- DxfControl_Reader aReader;
-
- try {
- IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
- if (status == IFSelect_RetDone) {
+
+ // Set "C" numeric locale to save numbers correctly
+ Kernel_Utils::Localizer loc;
+
+ DxfControl_Reader aReader;
+
+ IFSelect_ReturnStatus status = aReader.ReadFile( aFileName.ToCString() );
+ if (status == IFSelect_RetDone) {
aReader.TransferRoots();
aResShape = aReader.OneShape();
-
+
// ATTENTION: this is a workaround for mantis issue 0020442 remark 0010776
// It should be removed after patching OCCT for bug OCC22436
// (fix for OCCT is expected in service pack next to OCCT6.3sp12)
Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader();
if (!TR.IsNull()) {
Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
-
+
Handle(DxfSection_Section) aBlocks = aModel->FindSection("BLOCKS");
- if (aBlocks.IsNull()) return aResShape;
-
- Handle(DxfSection_HSequenceOfObject) anObjects = aBlocks->GetObjects();
- if (anObjects.IsNull()) return aResShape;
-
- for (Standard_Integer i = 1; i <= anObjects->Length(); i++) {
- Handle(DxfSection_Block) aBlock = Handle(DxfSection_Block)::DownCast(anObjects->Value(i));
- if (aBlock.IsNull()) continue;
- Handle(TCollection_HAsciiString) aName = aBlock->GetBlockName1();
- if (aName.IsNull()) continue;
-
- Handle(Transfer_Binder) binder = TP->Find ( aBlock );
- if (binder.IsNull()) continue;
- TopoDS_Shape aResShape = TransferBRep::ShapeResult (binder);
- if (aResShape.IsNull()) continue;
-
- // create label and set shape
- TDF_Label L;
- TDF_TagSource aTag;
- L = aTag.NewChild(theShapeLabel);
- TNaming_Builder tnBuild(L);
- tnBuild.Generated(aResShape);
-
- // set a name
- TCollection_ExtendedString str(aName->ToCString());
- TDataStd_Name::Set(L,str);
+ if( !aBlocks.IsNull() ) {
+ Handle(DxfSection_HSequenceOfObject) anObjects = aBlocks->GetObjects();
+ for (Standard_Integer i = 1; i <= anObjects->Length(); i++) {
+ Handle(DxfSection_Block) aBlock = Handle(DxfSection_Block)::DownCast(anObjects->Value(i));
+ if (aBlock.IsNull()) continue;
+ Handle(TCollection_HAsciiString) aName = aBlock->GetBlockName1();
+ if (aName.IsNull()) continue;
+
+ Handle(Transfer_Binder) binder = TP->Find ( aBlock );
+ if (binder.IsNull()) continue;
+ TopoDS_Shape aResShape = TransferBRep::ShapeResult (binder);
+ if (aResShape.IsNull()) continue;
+
+ // create label and set shape
+ TDF_Label L;
+ TDF_TagSource aTag;
+ L = aTag.NewChild(aFunction->GetNamingEntry());
+ TNaming_Builder tnBuild(L);
+ tnBuild.Generated(aResShape);
+
+ // set a name
+ TCollection_ExtendedString str( aName->ToCString() );
+ TDataStd_Name::Set(L,str);
+ }
}
}
- }
- else {
- theError = "Wrong format of the imported file. Can't import file.";
- aResShape.Nullify();
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- theError = aFail->GetMessageString();
- aResShape.Nullify();
- }
- return aResShape;
}
-} // end of extern "C"
+ else {
+ TCollection_AsciiString anError = "Wrong format of the imported file. Can't import file.";
+ StdFail_NotDone::Raise( anError.ToCString() );
+ aResShape.Nullify();
+ }
+
+ if( aResShape.IsNull() ) return 0;
+
+ aFunction->SetValue( aResShape );
+
+ log.SetTouched( Label() );
+
+ return 1;
+}
+
+//=======================================================================
+//function : MustExecute
+//purpose :
+//=======================================================================
+Standard_Boolean DXFPlugin_ImportDriver::MustExecute( const TFunction_Logbook& ) const
+{
+ return Standard_True;
+}
+
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
+
+bool DXFPlugin_ImportDriver::
+GetCreationInformation( std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams )
+{
+ if( Label().IsNull() ) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction( Label() );
+
+ DXFPlugin_IImport aCI( function );
+ Standard_Integer aType = function->GetType();
+
+ theOperationName = "ImportDXF";
+
+ switch ( aType ) {
+ case IMPORT_SHAPE:
+ AddParam( theParams, "File name", aCI.GetFileName() );
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+IMPLEMENT_STANDARD_HANDLE( DXFPlugin_ImportDriver, GEOM_BaseDriver );
+IMPLEMENT_STANDARD_RTTIEXT( DXFPlugin_ImportDriver, GEOM_BaseDriver );
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _DXFPlugin_ImportDriver_HXX
+#define _DXFPlugin_ImportDriver_HXX
+
+// GEOM includes
+#include <GEOM_BaseDriver.hxx>
+
+// OCCT includes
+#ifndef _TFunction_Logbook_HeaderFile
+#include <TFunction_Logbook.hxx>
+#endif
+
+DEFINE_STANDARD_HANDLE( DXFPlugin_ImportDriver, GEOM_BaseDriver );
+
+class DXFPlugin_ImportDriver : public GEOM_BaseDriver
+{
+public:
+ Standard_EXPORT DXFPlugin_ImportDriver();
+ Standard_EXPORT ~DXFPlugin_ImportDriver() {};
+
+ Standard_EXPORT static const Standard_GUID& GetID();
+ Standard_EXPORT virtual Standard_Integer Execute( TFunction_Logbook& log ) const;
+ Standard_EXPORT Standard_Boolean MustExecute( const TFunction_Logbook& ) const;
+ Standard_EXPORT virtual void Validate( TFunction_Logbook& ) const {}
+
+ Standard_EXPORT virtual
+ bool GetCreationInformation( std::string& theOperationName,
+ std::vector<GEOM_Param>& params );
+
+DEFINE_STANDARD_RTTI( DXFPlugin_ImportDriver )
+};
+
+#endif // _DXFPlugin_ImportDriver_HXX
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_OperationsCreator.hh"
+#include "DXFPlugin_Operations_i.hh"
+#include "DXFPlugin_ExportDriver.hxx"
+#include "DXFPlugin_ImportDriver.hxx"
+#include "DXFPlugin_IECallBack.hxx"
+
+// KERNEL includes
+#include <Utils_ExceptHandlers.hxx>
+#include <utilities.h>
+
+// GEOM includes
+#include <GEOMImpl_IECallBack.hxx>
+
+// OCCT includes
+#include <TFunction_DriverTable.hxx>
+
+//============================================================================
+// function : Create
+// purpose :
+//============================================================================
+GEOM_IOperations_i* DXFPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_Gen* theGenImpl )
+{
+ Unexpect aCatch( SALOME_SalomeException );
+ MESSAGE( "DXFPlugin_OperationsCreator::Create" );
+
+ if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() ) {
+ DXFPlugin_IOperations* anOper = new DXFPlugin_IOperations( theGenImpl, theStudyId );
+ _mapOfOperations[theStudyId] = anOper;
+
+ // Import/Export DXF
+ TFunction_DriverTable::Get()->AddDriver( DXFPlugin_ExportDriver::GetID(),
+ new DXFPlugin_ExportDriver() );
+ TFunction_DriverTable::Get()->AddDriver( DXFPlugin_ImportDriver::GetID(),
+ new DXFPlugin_ImportDriver() );
+
+ DXFPlugin_IECallBack* DXFCallBack = new DXFPlugin_IECallBack( anOper );
+ GEOMImpl_IECallBack::Register( "DXF", DXFCallBack );
+ }
+
+ DXFPlugin_Operations_i* aServant =
+ new DXFPlugin_Operations_i( thePOA, theEngine, _mapOfOperations[theStudyId] );
+
+ return aServant;
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _GEOM_DXFPlugin_OperationsCreator_HXX_
+#define _GEOM_DXFPlugin_OperationsCreator_HXX_
+
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+#include "DXFPlugin_IOperations.hxx"
+
+// GEOM includes
+#include "GEOM_Gen_i.hh"
+
+// C++ includes
+#include <map>
+
+//=====================================================================
+// Operations creator
+//=====================================================================
+class DXFPLUGINENGINE_EXPORT DXFPlugin_OperationsCreator : public GEOM_GenericOperationsCreator
+{
+public:
+ virtual GEOM_IOperations_i* Create( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_Gen* theGenImpl );
+ private:
+ std::map <int, DXFPlugin_IOperations*> _mapOfOperations;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+// internal includes
+#include "DXFPlugin_Operations_i.hh"
+#include <DXFPLUGIN_version.h>
+
+// KERNEL includes
+#include <utilities.h>
+
+//=============================================================================
+/*!
+ * constructor:
+ */
+//=============================================================================
+DXFPlugin_Operations_i::DXFPlugin_Operations_i( PortableServer::POA_ptr thePOA,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::DXFPlugin_IOperations* theImpl )
+:GEOM_IOperations_i( thePOA, theEngine, theImpl )
+{
+ MESSAGE( "DXFPlugin_Operations_i::DXFPlugin_Operations_i" );
+}
+
+//=============================================================================
+/*!
+ * destructor
+ */
+//=============================================================================
+DXFPlugin_Operations_i::~DXFPlugin_Operations_i()
+{
+ MESSAGE( "DXFPlugin_Operations_i::~DXFPlugin_Operations_i" );
+}
+
+//=============================================================================
+/*!
+ * ExportDXF
+ * Export a shape to DXF format
+ * \param theOriginal The shape to export
+ * \param theFileName The name of the exported file
+ */
+//=============================================================================
+void DXFPlugin_Operations_i::ExportDXF( GEOM::GEOM_Object_ptr theOriginal,
+ const char* theFileName )
+{
+ // duplicate the original shape
+ GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate( theOriginal );
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference shape
+ Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal );
+ if (anOriginal.IsNull()) return;
+
+ //Export the shape to the file
+ char* aFileName = strdup( theFileName );
+
+ GetOperations()->ExportDXF( anOriginal, aFileName );
+ free( aFileName );
+}
+
+//=============================================================================
+/*!
+ * ImportDXF
+ * Import a shape from DXF format
+ * \param theFileName The name of the file to import
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* DXFPlugin_Operations_i::ImportDXF( const char* theFileName )
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Import the shape from the file
+ char* aFileName = strdup( theFileName );
+ TCollection_AsciiString fileName( aFileName );
+
+ //Import the shape from the file
+ Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->ImportDXF( fileName );
+
+ free( aFileName );
+ if( !GetOperations()->IsDone() || aHSeq.IsNull() )
+ return aSeq._retn();
+
+ // Copy created objects.
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length( aLength );
+ for( Standard_Integer i = 1; i <= aLength; i++ )
+ aSeq[i-1] = GetObject( Handle(GEOM_Object)::DownCast( aHSeq->Value(i) ) );
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * \brief Get version of the plugin.
+ * \return the version of the plugin
+*/
+//=============================================================================
+
+int DXFPlugin_Operations_i::GetVersion()
+{
+ return DXFPLUGIN_VERSION;
+}
+//=============================================================================
+/*!
+ * \brief Get version of the plugin.
+ * \return the string representation of the plugin's version
+*/
+//=============================================================================
+
+char* DXFPlugin_Operations_i::GetVersionStr()
+{
+ return (char*)DXFPLUGIN_VERSION_STR;
+}
--- /dev/null
+// Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+//
+
+#ifndef _DXFPlugin_Operations_i_HeaderFile
+#define _DXFPlugin_Operations_i_HeaderFile
+
+// idl includes
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER( GEOM_Gen )
+#include CORBA_SERVER_HEADER( DXFPlugin_Gen )
+
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+#include "DXFPlugin_IOperations.hxx"
+
+// GEOM includes
+#include <GEOM_IOperations_i.hh>
+
+class DXFPLUGINENGINE_EXPORT DXFPlugin_Operations_i :
+ public virtual POA_DXFPlugin::GEOM_IDXFPluginOperations,
+ public virtual GEOM_IOperations_i
+{
+public:
+ DXFPlugin_Operations_i( PortableServer::POA_ptr thePOA,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::DXFPlugin_IOperations* theImpl );
+ ~DXFPlugin_Operations_i();
+
+ void ExportDXF( GEOM::GEOM_Object_ptr, const char* );
+ GEOM::ListOfGO* ImportDXF( const char* );
+
+ // Version information
+ virtual int GetVersion();
+ virtual char* GetVersionStr();
+
+ ::DXFPlugin_IOperations* GetOperations()
+ { return (::DXFPlugin_IOperations*)GetImpl(); }
+};
+
+#endif
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2014 CEA/DEN, EDF R&D, 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
+#
+
+# DXFPLUGIN : binding of C++ implementation with Python
+# File : __init__.py
+#
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MEN_EXPORTDXF</source>
+ <translation>DXF</translation>
+ </message>
+ <message>
+ <source>TOP_EXPORTDXF</source>
+ <translation>Export DXF</translation>
+ </message>
+ <message>
+ <source>STB_EXPORTDXF</source>
+ <translation>Export DXF</translation>
+ </message>
+ <message>
+ <source>MEN_IMPORTDXF</source>
+ <translation>DXF</translation>
+ </message>
+ <message>
+ <source>TOP_IMPORTDXF</source>
+ <translation>Import DXF</translation>
+ </message>
+ <message>
+ <source>STB_IMPORTDXF</source>
+ <translation>Import DXF</translation>
+ </message>
+ <message>
+ <source>DXFPLUGIN_DXF_FILES</source>
+ <translation>DXF files( *.dxf )</translation>
+ </message>
+</context>
+<context>
+ <name>DXFPlugin_ExportDlg</name>
+ <message>
+ <source>DXFPLUGIN_EXPORT_TITLE</source>
+ <translation>Export DXF</translation>
+ </message>
+</context>
+<context>
+ <name>DXFPlugin_ImportDlg</name>
+ <message>
+ <source>DXFPLUGIN_IMPORT_TITLE</source>
+ <translation>Import DXF</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MEN_EXPORTDXF</source>
+ <translation>DXF</translation>
+ </message>
+ <message>
+ <source>TOP_EXPORTDXF</source>
+ <translation>Exporter DXF</translation>
+ </message>
+ <message>
+ <source>STB_EXPORTDXF</source>
+ <translation>Exporter DXF</translation>
+ </message>
+ <message>
+ <source>MEN_IMPORTDXF</source>
+ <translation>DXF</translation>
+ </message>
+ <message>
+ <source>TOP_IMPORTDXF</source>
+ <translation>Importer DXF</translation>
+ </message>
+ <message>
+ <source>STB_IMPORTDXF</source>
+ <translation>Importer DXF</translation>
+ </message>
+ <message>
+ <source>DXFPLUGIN_DXF_FILES</source>
+ <translation>DXF Fichiers( *.dxf )</translation>
+ </message>
+</context>
+<context>
+ <name>DXFPlugin_ExportDlg</name>
+ <message>
+ <source>DXFPLUGIN_EXPORT_TITLE</source>
+ <translation>Exporter DXF</translation>
+ </message>
+</context>
+<context>
+ <name>DXFPlugin_ImportDlg</name>
+ <message>
+ <source>DXFPLUGIN_IMPORT_TITLE</source>
+ <translation>Importer DXF</translation>
+ </message>
+</context>
+</TS>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="ja" sourcelanguage="en">
+<context>
+ <name>@default</name>
+ <message>
+ <source>MEN_EXPORTDXF</source>
+ <translation type="unfinished">DXF</translation>
+ </message>
+ <message>
+ <source>TOP_EXPORTDXF</source>
+ <translation type="unfinished">Export DXF</translation>
+ </message>
+ <message>
+ <source>STB_EXPORTDXF</source>
+ <translation type="unfinished">Export DXF</translation>
+ </message>
+ <message>
+ <source>MEN_IMPORTDXF</source>
+ <translation type="unfinished">DXF</translation>
+ </message>
+ <message>
+ <source>TOP_IMPORTDXF</source>
+ <translation type="unfinished">Import DXF</translation>
+ </message>
+ <message>
+ <source>STB_IMPORTDXF</source>
+ <translation type="unfinished">Import DXF</translation>
+ </message>
+ <message>
+ <source>DXFPLUGIN_DXF_FILES</source>
+ <translation type="unfinished">DXF files( *.dxf )</translation>
+ </message>
+</context>
+<context>
+ <name>DXFPlugin_ExportDlg</name>
+ <message>
+ <source>DXFPLUGIN_EXPORT_TITLE</source>
+ <translation type="unfinished">Export DXF</translation>
+ </message>
+</context>
+<context>
+ <name>DXFPlugin_ImportDlg</name>
+ <message>
+ <source>DXFPLUGIN_IMPORT_TITLE</source>
+ <translation type="unfinished">Import DXF</translation>
+ </message>
+</context>
+</TS>
\ No newline at end of file