From: mpa Date: Wed, 3 Sep 2014 09:49:27 +0000 (+0400) Subject: Implementation of ACISPLUGIN as a GEOM plugin (added files) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=77903c15949d06de2258c1a1e3f6f97a5632c251;p=plugins%2Facisplugin.git Implementation of ACISPLUGIN as a GEOM plugin (added files) --- diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100755 index 0000000..7eb84fe --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,20 @@ +# 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) diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt new file mode 100755 index 0000000..957d7ef --- /dev/null +++ b/doc/salome/CMakeLists.txt @@ -0,0 +1,21 @@ +# 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 diff --git a/doc/salome/examples/ACISPlugindemo.py b/doc/salome/examples/ACISPlugindemo.py new file mode 100644 index 0000000..09ee7a0 --- /dev/null +++ b/doc/salome/examples/ACISPlugindemo.py @@ -0,0 +1,23 @@ +# Import/Export ACIS + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +# Example of import from ACIS + +# get a path to SAMPLES_SRC +import os +thePath = os.getenv("DATA_DIR") +# create filenames +theFileName = thePath + "/Shapes/Sat/Bug841_Robot01_ACIS_15_Volumique.sat" + +# import shape +Shape1 = geompy.ImportACIS(theFileName) +geompy.addToStudy(Shape1, "Robot01_1") + +# It is possible also to use next format of importing and publishing in study + +Shape2 = geompy.ImportACIS(theFileName,"Robot01_2") diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt new file mode 100644 index 0000000..0943ad6 --- /dev/null +++ b/doc/salome/examples/CMakeLists.txt @@ -0,0 +1,21 @@ +# 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/ACISPLUGIN) diff --git a/doc/salome/gui/ACISPLUGIN/CMakeLists.txt b/doc/salome/gui/ACISPLUGIN/CMakeLists.txt new file mode 100755 index 0000000..743e277 --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/CMakeLists.txt @@ -0,0 +1,45 @@ +# 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/ACISPluginBuilder.py ${CMAKE_SOURCE_DIR}/src/ACISPluginBuilder.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}/ACISPLUGIN DESTINATION ${SALOME_INSTALL_DOC}/gui) +INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/ACISPLUGIN) +INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/ACISPLUGIN/acispluginpy_doc) + +SET(make_clean_files ACISPLUGIN acispluginpy_doc.tag) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}") diff --git a/doc/salome/gui/ACISPLUGIN/doxyfile.in b/doc/salome/gui/ACISPLUGIN/doxyfile.in new file mode 100755 index 0000000..b46013d --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/doxyfile.in @@ -0,0 +1,114 @@ +# 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 ACISPLUGIN User's Guide" +OUTPUT_DIRECTORY = ACISPLUGIN +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 = acispluginpy_doc.tag=../ACISPLUGIN/acispluginpy_doc +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/ACISPLUGIN/doxyfile_py.in b/doc/salome/gui/ACISPLUGIN/doxyfile_py.in new file mode 100755 index 0000000..f542a25 --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/doxyfile_py.in @@ -0,0 +1,160 @@ +# 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 ACISPLUGIN User's Guide" +OUTPUT_DIRECTORY = ACISPLUGIN +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/ACISPlugin_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 = acispluginpy_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 = acispluginpy_doc.tag +SEARCHENGINE = YES diff --git a/doc/salome/gui/ACISPLUGIN/images/export_acis.png b/doc/salome/gui/ACISPLUGIN/images/export_acis.png new file mode 100644 index 0000000..4cdb1f6 Binary files /dev/null and b/doc/salome/gui/ACISPLUGIN/images/export_acis.png differ diff --git a/doc/salome/gui/ACISPLUGIN/images/group_acis.png b/doc/salome/gui/ACISPLUGIN/images/group_acis.png new file mode 100644 index 0000000..7f296c1 Binary files /dev/null and b/doc/salome/gui/ACISPLUGIN/images/group_acis.png differ diff --git a/doc/salome/gui/ACISPLUGIN/images/head.png b/doc/salome/gui/ACISPLUGIN/images/head.png new file mode 100755 index 0000000..307d9ef Binary files /dev/null and b/doc/salome/gui/ACISPLUGIN/images/head.png differ diff --git a/doc/salome/gui/ACISPLUGIN/images/import_acis.png b/doc/salome/gui/ACISPLUGIN/images/import_acis.png new file mode 100644 index 0000000..b5ab32b Binary files /dev/null and b/doc/salome/gui/ACISPLUGIN/images/import_acis.png differ diff --git a/doc/salome/gui/ACISPLUGIN/images/reopen_acis.png b/doc/salome/gui/ACISPLUGIN/images/reopen_acis.png new file mode 100644 index 0000000..9d6745d Binary files /dev/null and b/doc/salome/gui/ACISPLUGIN/images/reopen_acis.png differ diff --git a/doc/salome/gui/ACISPLUGIN/input/acisplugin_importexport_page.doc b/doc/salome/gui/ACISPLUGIN/input/acisplugin_importexport_page.doc new file mode 100644 index 0000000..74b17fe --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/input/acisplugin_importexport_page.doc @@ -0,0 +1,37 @@ +/*! + +\page acisplugin_importexport_page Import/Export ACIS + +For using ACISPLUGIN functionalities in SALOME: + +- Run SALOME and activate Geometry module. + +- Import the ACIS file from menu File/Import/ACIS. + + \image html import_acis.png + + Browse and select the file and click "Open" button. New object (shape) + will appears in the SALOME object browser. + + \note If a plugin supports import of named shapes, it will be asked whether + to group or not these shapes corresponding to the type (see the picture below). + + \image html group_acis.png + + \par + + \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 Reload From Disk + in the context menu of the imported shape. The reloaded shape will have the same + representation parameters as before this operation. + + \image html reopen_acis.png + +- Export to the ACIS file selecting a shape in the SALOME object browser and + calling menu File/Export/ACIS. + + \image html export_acis.png + + Enter the file name and click "Save" button. + +*/ diff --git a/doc/salome/gui/ACISPLUGIN/input/acisplugin_python_interface_page.doc b/doc/salome/gui/ACISPLUGIN/input/acisplugin_python_interface_page.doc new file mode 100644 index 0000000..9a349dc --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/input/acisplugin_python_interface_page.doc @@ -0,0 +1,19 @@ +/*! + +\page acisplugin_python_interface_page Python Interface + +Python package ACISPluginBuilder defines several classes, destined for +import and export CAD models in ACIS format (*.sat files). + +ACISPLUGIN dynamically adds several methods to the geomBuilder. + +Below you can see an example of usage of the ACISPluginBuilder package for +import and export CAD models: + +\anchor example_ACISPlugin +

Example of import CAD model stored in ACIS format (*.sat files) with ACISPLUGIN:

+\tui_script{ACISPlugindemo.py} + +*/ + + diff --git a/doc/salome/gui/ACISPLUGIN/input/index.doc b/doc/salome/gui/ACISPLUGIN/input/index.doc new file mode 100644 index 0000000..58eb48c --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/input/index.doc @@ -0,0 +1,17 @@ +/*! + +\mainpage Introduction to ACISPLUGIN + + ACIS SAT interface to be used as plugin for SALOME Geometry +module. +It is destined for: +- Importing CAD models stored in ACIS format (*.sat files) into +SALOME study; +- Exporting CAD models from SALOME to the *.sat files. + +To manage parameters of the ACISPLUGIN use \subpage acisplugin_importexport_page. + +Also all ACISPLUGIN functionalities are accessible via +\subpage acisplugin_python_interface_page "ACISPLUGIN Python interface". + +*/ diff --git a/doc/salome/gui/ACISPLUGIN/static/footer.html b/doc/salome/gui/ACISPLUGIN/static/footer.html new file mode 100755 index 0000000..e21ab0c --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/static/footer.html @@ -0,0 +1,13 @@ + + + + + + diff --git a/doc/salome/gui/ACISPLUGIN/static/header.html.in b/doc/salome/gui/ACISPLUGIN/static/header.html.in new file mode 100755 index 0000000..126dc75 --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/static/header.html.in @@ -0,0 +1,23 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + +$extrastylesheet + + +
+ +
Version: @SALOMEACISPLUGIN_VERSION@
+ diff --git a/doc/salome/gui/ACISPLUGIN/static/header_py.html.in b/doc/salome/gui/ACISPLUGIN/static/header_py.html.in new file mode 100644 index 0000000..70d378b --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/static/header_py.html.in @@ -0,0 +1,24 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + +$extrastylesheet + + +
+ +
Version: @SALOMEACISPLUGIN_VERSION@
+
Home
+ diff --git a/doc/salome/gui/ACISPLUGIN/static/salome_extra.css b/doc/salome/gui/ACISPLUGIN/static/salome_extra.css new file mode 100644 index 0000000..3e8b838 --- /dev/null +++ b/doc/salome/gui/ACISPLUGIN/static/salome_extra.css @@ -0,0 +1,29 @@ +/* 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 diff --git a/doc/salome/gui/CMakeLists.txt b/doc/salome/gui/CMakeLists.txt new file mode 100755 index 0000000..1a2a012 --- /dev/null +++ b/doc/salome/gui/CMakeLists.txt @@ -0,0 +1,20 @@ +# 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(ACISPLUGIN) diff --git a/idl/ACISPlugin_Gen.idl b/idl/ACISPlugin_Gen.idl new file mode 100644 index 0000000..0fd7d0d --- /dev/null +++ b/idl/ACISPlugin_Gen.idl @@ -0,0 +1,51 @@ +// 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 __ACISPlugin_GEN__ +#define __ACISPlugin_GEN__ + +#include "GEOM_Gen.idl" + +module ACISPlugin { + + /*! + * \brief Interface for ACISPlugin modeling functions. + */ + interface GEOM_IACISPluginOperations : GEOM::GEOM_IOperations + { + /*! + * \brief Export the given shape into a file with given name in ACIS format. + * + * \param theObject Shape to be stored in the file. + * \param theFileName Name of the file to store the given shape in. + */ + void ExportACIS( in GEOM::GEOM_Object theObject, + in string theFileName ); + + /*! + * \brief Import a shape from the ACIS file. + * + * \param theFileName The file, containing the shape. + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ + GEOM::ListOfGO ImportACIS( in string theFileName ); + }; +}; + +#endif diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt new file mode 100755 index 0000000..e462ebb --- /dev/null +++ b/idl/CMakeLists.txt @@ -0,0 +1,49 @@ +# 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(SalomeIDLACISPlugin_IDLSOURCES + ACISPlugin_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(SalomeIDLACISPlugin "${SalomeIDLACISPlugin_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_FLAGS}") +ADD_DEPENDENCIES(SalomeIDLACISPlugin ${GEOM_SalomeIDLGEOM}) +INSTALL(TARGETS SalomeIDLACISPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/resources/ACISPlugin.xml b/resources/ACISPlugin.xml new file mode 100644 index 0000000..e23fe28 --- /dev/null +++ b/resources/ACISPlugin.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml new file mode 100644 index 0000000..0c841e3 --- /dev/null +++ b/resources/SalomeApp.xml @@ -0,0 +1,32 @@ + + +
+ +
+
+ + +
+
+ +
+
diff --git a/src/ACISPluginBuilder.py b/src/ACISPluginBuilder.py new file mode 100644 index 0000000..cf4e037 --- /dev/null +++ b/src/ACISPluginBuilder.py @@ -0,0 +1,89 @@ +# -*- 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 ACISPlugin import GEOM_IACISPluginOperations + +# Engine Library Name +__libraryName__ = "ACISPluginEngine" + +def GetACISPluginOperations(self): + anOp = self.GetPluginOperations(self.myStudyId, __libraryName__) + return anOp._narrow(GEOM_IACISPluginOperations) + +## Export the given shape into a file with given name in ACIS format. +# @param theObject Shape to be stored in the file. +# @param theFileName Name of the file to store the given shape in. +def ExportACIS(self, theObject, theFileName): + """ + Export the given shape into a file with given name in ACIS format. + + Parameters: + theObject Shape to be stored in the file. + theFileName Name of the file to store the given shape in. + """ + anOp = GetACISPluginOperations(self) + anOp.ExportACIS(theObject, theFileName) + if anOp.IsDone() == 0: + raise RuntimeError, "Export : " + anOp.GetErrorCode() + pass + pass + + +## Import a shape from the ACIS 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 ImportACIS(self, theFileName, theName=None): + """ + Import a shape from the ACIS 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 = GetACISPluginOperations(self) + aListObj = anOp.ImportACIS(theFileName) + RaiseIfFailed("ImportACIS", anOp) + aNbObj = len(aListObj) + if aNbObj > 0: + self._autoPublish(aListObj[0], theName, "imported") + if aNbObj == 1: + return aListObj[0] + return aListObj diff --git a/src/ACISPluginEngine.cxx b/src/ACISPluginEngine.cxx new file mode 100644 index 0000000..63da1ac --- /dev/null +++ b/src/ACISPluginEngine.cxx @@ -0,0 +1,32 @@ +// 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 "ACISPlugin_Engine.hxx" +#include "ACISPlugin_OperationsCreator.hh" + +extern "C" +{ +ACISPLUGINENGINE_EXPORT + GEOM_GenericOperationsCreator* GetOperationsCreator() + { + ACISPlugin_OperationsCreator* aCreator = new ACISPlugin_OperationsCreator(); + return aCreator; + } +} diff --git a/src/ACISPluginGUI.cxx b/src/ACISPluginGUI.cxx new file mode 100644 index 0000000..08fb2b6 --- /dev/null +++ b/src/ACISPluginGUI.cxx @@ -0,0 +1,127 @@ +// 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 "ACISPluginGUI.h" +#include "ACISPlugin_ExportDlg.h" +#include "ACISPlugin_ImportDlg.h" + +// GUI includes +#include +#include +#include +#include +#include + +// GEOM includes +#include + +//======================================================================= +// function : ACISPluginGUI() +// purpose : Constructor +//======================================================================= +ACISPluginGUI::ACISPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent ) +{ +} + +//======================================================================= +// function : ~ACISPluginGUI +// purpose : Destructor +//======================================================================= +ACISPluginGUI::~ACISPluginGUI() +{ +} + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool ACISPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) +{ + switch ( theCommandID ) { + case 1: + return OnGUIEvent("Export_ACIS", parent); + case 2: + return OnGUIEvent("Import_ACIS", parent); + default: + return OnGUIEvent("", parent); + } + return false; +} + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool ACISPluginGUI::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_ACIS" ) { + // 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 ACISPlugin_ExportDlg( IObject, parent ); + if( dialog->exec() == QDialog::Accepted ) + delete dialog; + } + } + } + else if (theCommandID == "Import_ACIS") { + dialog = new ACISPlugin_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 ACISPluginGUI( parent ); + } +} diff --git a/src/ACISPluginGUI.h b/src/ACISPluginGUI.h new file mode 100644 index 0000000..f61093c --- /dev/null +++ b/src/ACISPluginGUI.h @@ -0,0 +1,35 @@ +// 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 ACISPluginGUI_H +#define ACISPluginGUI_H + +#include + +class ACISPluginGUI: public GEOMPluginGUI +{ +public: + ACISPluginGUI( GeometryGUI* parent ); + ~ACISPluginGUI(); + + bool OnGUIEvent( int commandId, SUIT_Desktop* ); + bool OnGUIEvent( const QString&, SUIT_Desktop* ); +}; + +#endif // ACISPluginGUI_H diff --git a/src/ACISPlugin_ExportDlg.cxx b/src/ACISPlugin_ExportDlg.cxx new file mode 100644 index 0000000..ae96e9d --- /dev/null +++ b/src/ACISPlugin_ExportDlg.cxx @@ -0,0 +1,132 @@ +// 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 "ACISPlugin_ExportDlg.h" +#include "ACISPlugin_Operations_i.hh" + +// GUI includes +#include +#include +#include +#include +#include + +#include + +// GEOM includes +#include +#include +#include + +//================================================================================= +// Constructor +//================================================================================= +ACISPlugin_ExportDlg::ACISPlugin_ExportDlg( Handle(SALOME_InteractiveObject)& object, QWidget* parent ) +: SUIT_FileDlg( parent, false, true, true ), + GEOMBase_Helper( dynamic_cast( parent ) ) +{ + setWindowTitle( tr( "ACISPLUGIN_EXPORT_TITLE" ) ); + setNameFilter( tr( "ACISPLUGIN_ACIS_FILES" ) ); + + myObject = object; + const char* objectName = myObject->getName(); + selectFile( QString( objectName ) ); +} + +//================================================================================= +// Destructor +//================================================================================= +ACISPlugin_ExportDlg::~ACISPlugin_ExportDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr ACISPlugin_ExportDlg::createOperation() +{ + return getGeomEngine()->GetPluginOperations( getStudyId(), "ACISPluginEngine" ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool ACISPlugin_ExportDlg::isValid( QString& msg ) +{ + bool ok = true; + //@@ add custom validation actions here @@// + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool ACISPlugin_ExportDlg::execute( ObjectList& objects ) +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if (!app) return false; + + ACISPlugin::GEOM_IACISPluginOperations_var aACISOp = ACISPlugin::GEOM_IACISPluginOperations::_narrow( getOperation() ); + if ( aACISOp->_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, aACISOp.in() ); + try { + SUIT_OverrideCursor wc; + app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( aFile, /*withExten=*/true )) ); + anOp->start(); + aACISOp->ExportACIS( anObj, aFile.toUtf8().constData() ); + if( aACISOp->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( aACISOp->GetErrorCode() ) ); + return false; + } + } + catch( const SALOME::SALOME_Exception& S_ex ) { + anOp->abort(); + return false; + } + + objects.push_back( anObj._retn() ); + return true; +} + +void ACISPlugin_ExportDlg::accept() +{ + SUIT_FileDlg::accept(); + onAccept(false); +} diff --git a/src/ACISPlugin_ExportDlg.h b/src/ACISPlugin_ExportDlg.h new file mode 100644 index 0000000..5c346a9 --- /dev/null +++ b/src/ACISPlugin_ExportDlg.h @@ -0,0 +1,52 @@ +// 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 ACISPlugin_ExportDlg_H +#define ACISPlugin_ExportDlg_H + +// GUI includes +#include + +// GEOM includes +#include +#include + + +class ACISPlugin_ExportDlg: public SUIT_FileDlg, public GEOMBase_Helper +{ + Q_OBJECT + +public: + ACISPlugin_ExportDlg( Handle(SALOME_InteractiveObject)&, QWidget* = 0 ); + ~ACISPlugin_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 // ACISPlugin_ExportDlg_H diff --git a/src/ACISPlugin_ExportDriver.hxx b/src/ACISPlugin_ExportDriver.hxx new file mode 100644 index 0000000..f4a79fa --- /dev/null +++ b/src/ACISPlugin_ExportDriver.hxx @@ -0,0 +1,51 @@ +// 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 _ACISPlugin_ExportDriver_HXX +#define _ACISPlugin_ExportDriver_HXX + +// GEOM includes +#include + +// OCCT includes +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif + +DEFINE_STANDARD_HANDLE( ACISPlugin_ExportDriver, GEOM_BaseDriver ); + +class ACISPlugin_ExportDriver : public GEOM_BaseDriver +{ +public: + Standard_EXPORT ACISPlugin_ExportDriver(); + Standard_EXPORT ~ACISPlugin_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& params ); + +DEFINE_STANDARD_RTTI( ACISPlugin_ExportDriver ) +}; + +#endif // _ACISPlugin_ExportDriver_HXX diff --git a/src/ACISPlugin_IECallBack.cxx b/src/ACISPlugin_IECallBack.cxx new file mode 100755 index 0000000..5d21b00 --- /dev/null +++ b/src/ACISPlugin_IECallBack.cxx @@ -0,0 +1,67 @@ +// 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 "ACISPlugin_IECallBack.hxx" + +//============================================================================= +/*! + * constructor + */ +//============================================================================= +ACISPlugin_IECallBack::ACISPlugin_IECallBack( ACISPlugin_IOperations* theOperations ) +: GEOMImpl_IECallBack() +{ + myPluginOperations = theOperations; +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +ACISPlugin_IECallBack::~ACISPlugin_IECallBack() +{ +} + +//============================================================================= +/*! + * Export + */ +//============================================================================= +bool ACISPlugin_IECallBack::Export( const Handle(GEOM_Object) theOriginal, + const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName ) +{ + myPluginOperations->ExportACIS( theOriginal, theFileName ); + return true; +} + +//============================================================================= +/*! + * Import + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) +ACISPlugin_IECallBack::Import( const TCollection_AsciiString& theFormatName, + const TCollection_AsciiString& theFileName ) +{ + return myPluginOperations->ImportACIS( theFileName ); +} + diff --git a/src/ACISPlugin_IECallBack.hxx b/src/ACISPlugin_IECallBack.hxx new file mode 100644 index 0000000..cc6b08f --- /dev/null +++ b/src/ACISPlugin_IECallBack.hxx @@ -0,0 +1,51 @@ +// 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 _ACISPlugin_IECallBack_HXX_ +#define _ACISPlugin_IECallBack_HXX_ + +// internal includes +#include "ACISPlugin_IOperations.hxx" + +// GEOM includes +#include +#include + +// OCC includes +#include + +class ACISPlugin_IECallBack : public GEOMImpl_IECallBack +{ +public: + Standard_EXPORT ACISPlugin_IECallBack( ACISPlugin_IOperations* theOperations ); + Standard_EXPORT ~ACISPlugin_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: + ACISPlugin_IOperations* myPluginOperations; +}; + +#endif diff --git a/src/ACISPlugin_IExport.hxx b/src/ACISPlugin_IExport.hxx new file mode 100644 index 0000000..6bdc0af --- /dev/null +++ b/src/ACISPlugin_IExport.hxx @@ -0,0 +1,48 @@ +// 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 _ACISPlugin_IExport_HXX_ +#define _ACISPlugin_IExport_HXX_ + +#include "GEOM_Function.hxx" + +#define EXPORTACIS_ARG_ORIGINAL 1 +#define EXPORTACIS_ARG_FILENAME 2 + +class ACISPlugin_IExport +{ +public: + ACISPlugin_IExport( Handle(GEOM_Function) theFunction ) + : _func(theFunction) {} + + void SetOriginal( Handle( GEOM_Function ) theOriginal) + { _func->SetReference( EXPORTACIS_ARG_ORIGINAL, theOriginal ); } + Handle( GEOM_Function ) GetOriginal() + { return _func->GetReference( EXPORTACIS_ARG_ORIGINAL ); } + + void SetFileName( const TCollection_AsciiString& theFileName ) + { _func->SetString( EXPORTACIS_ARG_FILENAME, theFileName ); } + TCollection_AsciiString GetFileName() + { return _func->GetString( EXPORTACIS_ARG_FILENAME ); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _ACISPlugin_IExport_HXX_ diff --git a/src/ACISPlugin_IImport.hxx b/src/ACISPlugin_IImport.hxx new file mode 100644 index 0000000..79c4d77 --- /dev/null +++ b/src/ACISPlugin_IImport.hxx @@ -0,0 +1,42 @@ +// 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 _ACISPlugin_IImport_HXX_ +#define _ACISPlugin_IImport_HXX_ + +#include "GEOM_Function.hxx" + +#define IMPORTACIS_ARG_FILENAME 1 + +class ACISPlugin_IImport +{ +public: + ACISPlugin_IImport( Handle(GEOM_Function) theFunction) + : _func(theFunction) {} + + void SetFileName( const TCollection_AsciiString& theFileName ) + { _func->SetString( IMPORTACIS_ARG_FILENAME, theFileName ); } + TCollection_AsciiString GetFileName() + { return _func->GetString( IMPORTACIS_ARG_FILENAME ); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _ACISPlugin_IImport_HXX_ diff --git a/src/ACISPlugin_IOperations.cxx b/src/ACISPlugin_IOperations.cxx new file mode 100644 index 0000000..051b085 --- /dev/null +++ b/src/ACISPlugin_IOperations.cxx @@ -0,0 +1,171 @@ +// 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 "ACISPlugin_IOperations.hxx" +#include "ACISPlugin_ExportDriver.hxx" +#include "ACISPlugin_ImportDriver.hxx" +#include "ACISPlugin_IExport.hxx" +#include "ACISPlugin_IImport.hxx" + +// KERNEL includes +#include + +// GEOM includes +#include +#include + +#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +ACISPlugin_IOperations::ACISPlugin_IOperations( GEOM_Engine* theEngine, int theDocID ) +: GEOMImpl_IBaseIEOperations( theEngine, theDocID ) +{ + MESSAGE( "ACISPlugin_IOperations::ACISPlugin_IOperations" ); +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +ACISPlugin_IOperations::~ACISPlugin_IOperations() +{ + MESSAGE( "ACISPlugin_IOperations::~ACISPlugin_IOperations" ); +} + +//============================================================================= +/*! + * ExportACIS + * Export a shape to ACIS 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 ACISPlugin_IOperations::ExportACIS( 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( ACISPlugin_ExportDriver::GetID(), EXPORT_SHAPE ); + if( aFunction.IsNull() ) return; + + //Check if the function is set correctly + if( aFunction->GetDriverGUID() != ACISPlugin_ExportDriver::GetID() ) return; + + //Set parameters + ACISPlugin_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.ExportACIS(" << theOriginal << ", \"" + << theFileName.ToCString() << "\" )"; + + SetErrorCode(OK); +} + +//============================================================================= +/*! + * ImportACIS + * Import a shape from ACIS 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) +ACISPlugin_IOperations::ImportACIS( 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( ACISPlugin_ImportDriver::GetID(), IMPORT_SHAPE); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != ACISPlugin_ImportDriver::GetID()) return NULL; + + //Set parameters + ACISPlugin_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.ImportACIS(\"" << theFileName.ToCString() << "\" )"; + SetErrorCode(OK); + + return aSeq; +} diff --git a/src/ACISPlugin_IOperations.hxx b/src/ACISPlugin_IOperations.hxx new file mode 100644 index 0000000..9a6c367 --- /dev/null +++ b/src/ACISPlugin_IOperations.hxx @@ -0,0 +1,39 @@ +// 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 : ACISPlugin_IOperations.hxx + +#ifndef _ACISPlugin_IOperations_HXX_ +#define _ACISPlugin_IOperations_HXX_ + +// GEOM includes +#include + +class ACISPlugin_IOperations: public GEOMImpl_IBaseIEOperations +{ +public: + Standard_EXPORT ACISPlugin_IOperations( GEOM_Engine*, int ); + Standard_EXPORT ~ACISPlugin_IOperations(); + + Standard_EXPORT void ExportACIS( const Handle(GEOM_Object), + const TCollection_AsciiString& ); + + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ImportACIS( const TCollection_AsciiString& ); +}; + +#endif diff --git a/src/ACISPlugin_ImportDlg.cxx b/src/ACISPlugin_ImportDlg.cxx new file mode 100644 index 0000000..79e5000 --- /dev/null +++ b/src/ACISPlugin_ImportDlg.cxx @@ -0,0 +1,173 @@ +// 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 "ACISPlugin_ImportDlg.h" +#include "ACISPlugin_Operations_i.hh" + +// GUI includes +#include +#include +#include +#include +#include +#include + +// GEOM includes +#include +#include +#include + +//================================================================================= +// Constructor +//================================================================================= +ACISPlugin_ImportDlg::ACISPlugin_ImportDlg( QWidget* parent ) +: SUIT_FileDlg( parent, true, true, true ), + GEOMBase_Helper( dynamic_cast( parent ) ) +{ + setWindowTitle( tr( "ACISPLUGIN_IMPORT_TITLE" ) ); + setAcceptMode( AcceptOpen ); + setNameFilter( tr( "ACISPLUGIN_ACIS_FILES" ) ); + setFileMode( QFileDialog::ExistingFiles ); +} + +//================================================================================= +// Destructor +//================================================================================= +ACISPlugin_ImportDlg::~ACISPlugin_ImportDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr ACISPlugin_ImportDlg::createOperation() +{ + return getGeomEngine()->GetPluginOperations(getStudyId(), "ACISPluginEngine"); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool ACISPlugin_ImportDlg::isValid (QString& msg) +{ + bool ok = true; + //@@ add custom validation actions here @@// + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool ACISPlugin_ImportDlg::execute( ObjectList& objects ) +{ + bool res = false; + GEOM::GEOM_Object_var anObj; + ACISPlugin::GEOM_IACISPluginOperations_var anOper = ACISPlugin::GEOM_IACISPluginOperations::_narrow( getOperation() ); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + _PTR(Study) aStudy = dynamic_cast ( app->activeStudy() )->studyDS(); + SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy ); + + QStringList fileNames = selectedFiles(); + if ( fileNames.count() == 0 ) + return false; // nothing selected, return + + SUIT_MessageBox::StandardButton acisAnswer = SUIT_MessageBox::NoButton; + + 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(); + + if ( acisAnswer != SUIT_MessageBox::YesToAll && acisAnswer != SUIT_MessageBox::NoToAll ) { + SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No; + if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll; + acisAnswer = SUIT_MessageBox::question( app->desktop(), + "Question",//tr("WRN_WARNING"), + tr("GEOM_PUBLISH_NAMED_SHAPES"), + btns | SUIT_MessageBox::Cancel, + SUIT_MessageBox::No ); + if ( acisAnswer == SUIT_MessageBox::Cancel ) { + anOper->SetErrorCode(OK); + return true; // cancel (break) import operation + } + } + + GEOM::ListOfGO_var anObj = anOper->ImportACIS( 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( aFileName, /*withExten=*/true ) ); + anObjPtr->SetName( aPublishObjName.toStdString().c_str() ); + + SALOMEDS::SObject_var aSO = + GeometryGUI::GetGeomGen()->PublishInStudy( aDSStudy, + SALOMEDS::SObject::_nil(), + anObjPtr, + aPublishObjName.toLatin1().constData() ); + if ( acisAnswer == SUIT_MessageBox::Yes || acisAnswer == SUIT_MessageBox::YesToAll ) + GeometryGUI::GetGeomGen()->PublishNamedShapesInStudy( aDSStudy, anObjPtr ); + + 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 ACISPlugin_ImportDlg::accept() +{ + SUIT_FileDlg::accept(); + onAccept( false ); +} + +//================================================================================= +// function : getObjectName +// purpose : +//================================================================================= +QString ACISPlugin_ImportDlg::getObjectName( GEOM::GEOM_Object_ptr object ) const +{ + if( object->_is_nil() ) + return QString::null; + return object->GetName(); +} diff --git a/src/ACISPlugin_ImportDlg.h b/src/ACISPlugin_ImportDlg.h new file mode 100644 index 0000000..c1583ac --- /dev/null +++ b/src/ACISPlugin_ImportDlg.h @@ -0,0 +1,49 @@ +// 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 ACISPlugin_IMPORTDLG_H +#define ACISPlugin_IMPORTDLG_H + +// GUI includes +#include + +// GEOM includes +#include +#include + +class ACISPlugin_ImportDlg: public SUIT_FileDlg, public GEOMBase_Helper +{ + Q_OBJECT + +public: + ACISPlugin_ImportDlg( QWidget* = 0 ); + ~ACISPlugin_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 // ACISPlugin_IMPORTDLG_H diff --git a/src/ACISPlugin_ImportDriver.hxx b/src/ACISPlugin_ImportDriver.hxx new file mode 100644 index 0000000..120db15 --- /dev/null +++ b/src/ACISPlugin_ImportDriver.hxx @@ -0,0 +1,51 @@ +// 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 _ACISPlugin_ImportDriver_HXX +#define _ACISPlugin_ImportDriver_HXX + +// GEOM includes +#include + +// OCCT includes +#ifndef _TFunction_Logbook_HeaderFile +#include +#endif + +DEFINE_STANDARD_HANDLE( ACISPlugin_ImportDriver, GEOM_BaseDriver ); + +class ACISPlugin_ImportDriver : public GEOM_BaseDriver +{ +public: + Standard_EXPORT ACISPlugin_ImportDriver(); + Standard_EXPORT ~ACISPlugin_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& params ); + +DEFINE_STANDARD_RTTI( ACISPlugin_ImportDriver ) +}; + +#endif // _ACISPlugin_ImportDriver_HXX diff --git a/src/ACISPlugin_OperationsCreator.cc b/src/ACISPlugin_OperationsCreator.cc new file mode 100644 index 0000000..95d01fe --- /dev/null +++ b/src/ACISPlugin_OperationsCreator.cc @@ -0,0 +1,67 @@ +// 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 "ACISPlugin_OperationsCreator.hh" +#include "ACISPlugin_Operations_i.hh" +#include "ACISPlugin_ExportDriver.hxx" +#include "ACISPlugin_ImportDriver.hxx" +#include "ACISPlugin_IECallBack.hxx" + +// KERNEL includes +#include +#include + +// GEOM includes +#include + +// OCCT includes +#include + +//============================================================================ +// function : Create +// purpose : +//============================================================================ +GEOM_IOperations_i* ACISPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA, + int theStudyId, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_Gen* theGenImpl ) +{ + Unexpect aCatch( SALOME_SalomeException ); + MESSAGE( "ACISPlugin_OperationsCreator::Create" ); + + if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() ) { + ACISPlugin_IOperations* anOper = new ACISPlugin_IOperations( theGenImpl, theStudyId ); + _mapOfOperations[theStudyId] = anOper; + + // Import/Export ACIS + TFunction_DriverTable::Get()->AddDriver( ACISPlugin_ExportDriver::GetID(), + new ACISPlugin_ExportDriver() ); + TFunction_DriverTable::Get()->AddDriver( ACISPlugin_ImportDriver::GetID(), + new ACISPlugin_ImportDriver() ); + + ACISPlugin_IECallBack* ACISCallBack = new ACISPlugin_IECallBack( anOper ); + GEOMImpl_IECallBack::Register( "ACIS", ACISCallBack ); + } + + ACISPlugin_Operations_i* aServant = + new ACISPlugin_Operations_i( thePOA, theEngine, _mapOfOperations[theStudyId] ); + + return aServant; +} diff --git a/src/ACISPlugin_OperationsCreator.hh b/src/ACISPlugin_OperationsCreator.hh new file mode 100755 index 0000000..1d803d8 --- /dev/null +++ b/src/ACISPlugin_OperationsCreator.hh @@ -0,0 +1,47 @@ +// 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_ACISPlugin_OperationsCreator_HXX_ +#define _GEOM_ACISPlugin_OperationsCreator_HXX_ + +// internal includes +#include "ACISPlugin_Engine.hxx" +#include "ACISPlugin_IOperations.hxx" + +// GEOM includes +#include "GEOM_Gen_i.hh" + +// C++ includes +#include + +//===================================================================== +// Operations creator +//===================================================================== +class ACISPLUGINENGINE_EXPORT ACISPlugin_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 _mapOfOperations; +}; + +#endif diff --git a/src/ACISPlugin_Operations_i.cc b/src/ACISPlugin_Operations_i.cc new file mode 100644 index 0000000..34d14cc --- /dev/null +++ b/src/ACISPlugin_Operations_i.cc @@ -0,0 +1,134 @@ +// 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 "ACISPlugin_Operations_i.hh" +#include + +// KERNEL includes +#include + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +ACISPlugin_Operations_i::ACISPlugin_Operations_i( PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::ACISPlugin_IOperations* theImpl ) +:GEOM_IOperations_i( thePOA, theEngine, theImpl ) +{ + MESSAGE( "ACISPlugin_Operations_i::ACISPlugin_Operations_i" ); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +ACISPlugin_Operations_i::~ACISPlugin_Operations_i() +{ + MESSAGE( "ACISPlugin_Operations_i::~ACISPlugin_Operations_i" ); +} + +//============================================================================= +/*! + * ExportACIS + * Export a shape to ACIS format + * \param theOriginal The shape to export + * \param theFileName The name of the exported file + */ +//============================================================================= +void ACISPlugin_Operations_i::ExportACIS( 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()->ExportACIS( anOriginal, aFileName ); + free( aFileName ); +} + +//============================================================================= +/*! + * ImportACIS + * Import a shape from ACIS format + * \param theFileName The name of the file to import + * \return List of GEOM_Objects, containing the created shape and propagation groups. + */ +//============================================================================= +GEOM::ListOfGO* ACISPlugin_Operations_i::ImportACIS( 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()->ImportACIS( 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 ACISPlugin_Operations_i::GetVersion() +{ + return ACISPLUGIN_VERSION; +} +//============================================================================= +/*! + * \brief Get version of the plugin. + * \return the string representation of the plugin's version +*/ +//============================================================================= + +char* ACISPlugin_Operations_i::GetVersionStr() +{ + return (char*)ACISPLUGIN_VERSION_STR; +} diff --git a/src/ACISPlugin_Operations_i.hh b/src/ACISPlugin_Operations_i.hh new file mode 100644 index 0000000..bb378ea --- /dev/null +++ b/src/ACISPlugin_Operations_i.hh @@ -0,0 +1,56 @@ +// 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 _ACISPlugin_Operations_i_HeaderFile +#define _ACISPlugin_Operations_i_HeaderFile + +// idl includes +#include +#include CORBA_SERVER_HEADER( GEOM_Gen ) +#include CORBA_SERVER_HEADER( ACISPlugin_Gen ) + +// internal includes +#include "ACISPlugin_Engine.hxx" +#include "ACISPlugin_IOperations.hxx" + +// GEOM includes +#include + +class ACISPLUGINENGINE_EXPORT ACISPlugin_Operations_i : + public virtual POA_ACISPlugin::GEOM_IACISPluginOperations, + public virtual GEOM_IOperations_i +{ +public: + ACISPlugin_Operations_i( PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + ::ACISPlugin_IOperations* theImpl ); + ~ACISPlugin_Operations_i(); + + void ExportACIS( GEOM::GEOM_Object_ptr, const char* ); + GEOM::ListOfGO* ImportACIS( const char* ); + + // Version information + virtual int GetVersion(); + virtual char* GetVersionStr(); + + ::ACISPlugin_IOperations* GetOperations() + { return (::ACISPlugin_IOperations*)GetImpl(); } +}; + +#endif diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..11efe78 --- /dev/null +++ b/src/__init__.py @@ -0,0 +1,23 @@ +# -*- 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 +# + +# ACISPLUGIN : binding of C++ implementation with Python +# File : __init__.py +# diff --git a/src/resources/ACISPlugin_msg_en.ts b/src/resources/ACISPlugin_msg_en.ts new file mode 100644 index 0000000..523c0db --- /dev/null +++ b/src/resources/ACISPlugin_msg_en.ts @@ -0,0 +1,49 @@ + + + + + @default + + MEN_EXPORTACIS + ACIS + + + TOP_EXPORTACIS + Export ACIS + + + STB_EXPORTACIS + Export ACIS + + + MEN_IMPORTACIS + ACIS + + + TOP_IMPORTACIS + Import ACIS + + + STB_IMPORTACIS + Import ACIS + + + ACISPLUGIN_ACIS_FILES + ACIS files( *.sat ) + + + + ACISPlugin_ExportDlg + + ACISPLUGIN_EXPORT_TITLE + Export ACIS + + + + ACISPlugin_ImportDlg + + ACISPLUGIN_IMPORT_TITLE + Import ACIS + + + diff --git a/src/resources/ACISPlugin_msg_fr.ts b/src/resources/ACISPlugin_msg_fr.ts new file mode 100644 index 0000000..d6f7345 --- /dev/null +++ b/src/resources/ACISPlugin_msg_fr.ts @@ -0,0 +1,49 @@ + + + + + @default + + MEN_EXPORTACIS + ACIS + + + TOP_EXPORTACIS + Exporter ACIS + + + STB_EXPORTACIS + Exporter ACIS + + + MEN_IMPORTACIS + ACIS + + + TOP_IMPORTACIS + Importer ACIS + + + STB_IMPORTACIS + Importer ACIS + + + ACISPLUGIN_ACIS_FILES + ACIS Fichiers( *.sat ) + + + + ACISPlugin_ExportDlg + + ACISPLUGIN_EXPORT_TITLE + Exporter ACIS + + + + ACISPlugin_ImportDlg + + ACISPLUGIN_IMPORT_TITLE + Importer ACIS + + + \ No newline at end of file diff --git a/src/resources/ACISPlugin_msg_ja.ts b/src/resources/ACISPlugin_msg_ja.ts new file mode 100644 index 0000000..8b1b675 --- /dev/null +++ b/src/resources/ACISPlugin_msg_ja.ts @@ -0,0 +1,49 @@ + + + + + @default + + MEN_EXPORTACIS + ACIS + + + TOP_EXPORTACIS + Export ACIS + + + STB_EXPORTACIS + Export ACIS + + + MEN_IMPORTACIS + ACIS + + + TOP_IMPORTACIS + Import ACIS + + + STB_IMPORTACIS + Import ACIS + + + ACISPLUGIN_ACIS_FILES + ACIS files( *.sat ) + + + + ACISPlugin_ExportDlg + + ACISPLUGIN_EXPORT_TITLE + Export ACIS + + + + ACISPlugin_ImportDlg + + ACISPLUGIN_IMPORT_TITLE + Import ACIS + + + \ No newline at end of file