From 572e80143c178fd41fd61438b178fea14cd8ea12 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 9 Dec 2019 16:17:15 +0300 Subject: [PATCH] Initial integration --- CMakeLists.txt | 226 ++++++++ COPYING | 504 ++++++++++++++++++ README | 98 ++++ SalomeSHAPERSTUDYConfig.cmake.in | 116 ++++ adm_local/CMakeLists.txt | 24 + adm_local/cmake_files/CMakeLists.txt | 28 + .../cmake_files/FindSalomeSHAPERSTUDY.cmake | 33 ++ adm_local/unix/CMakeLists.txt | 20 + adm_local/unix/config_files/CMakeLists.txt | 27 + .../unix/config_files/check_SHAPERSTUDY.m4 | 75 +++ bin/CMakeLists.txt | 31 ++ bin/VERSION.in | 3 + idl/CMakeLists.txt | 42 ++ idl/SHAPERSTUDY_Gen.idl | 82 +++ resources/CMakeLists.txt | 30 ++ resources/SHAPERSTUDYCatalog.xml.in | 70 +++ resources/SalomeApp.xml.in | 13 + src/CMakeLists.txt | 36 ++ src/CXX/CMakeLists.txt | 66 +++ src/PY/CMakeLists.txt | 32 ++ src/PY/SHAPERSTUDY.py | 291 ++++++++++ src/PY/SHAPERSTUDY_Field.py | 138 +++++ src/PY/SHAPERSTUDY_IOperations.py | 173 ++++++ src/PY/SHAPERSTUDY_Object.py | 132 +++++ src/PY/SHAPERSTUDY_utils.py | 166 ++++++ src/SWIG/CMakeLists.txt | 94 ++++ test/test0.py | 16 + 27 files changed, 2566 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 COPYING create mode 100644 README create mode 100644 SalomeSHAPERSTUDYConfig.cmake.in create mode 100644 adm_local/CMakeLists.txt create mode 100644 adm_local/cmake_files/CMakeLists.txt create mode 100644 adm_local/cmake_files/FindSalomeSHAPERSTUDY.cmake create mode 100644 adm_local/unix/CMakeLists.txt create mode 100644 adm_local/unix/config_files/CMakeLists.txt create mode 100644 adm_local/unix/config_files/check_SHAPERSTUDY.m4 create mode 100644 bin/CMakeLists.txt create mode 100644 bin/VERSION.in create mode 100644 idl/CMakeLists.txt create mode 100644 idl/SHAPERSTUDY_Gen.idl create mode 100644 resources/CMakeLists.txt create mode 100644 resources/SHAPERSTUDYCatalog.xml.in create mode 100644 resources/SalomeApp.xml.in create mode 100644 src/CMakeLists.txt create mode 100644 src/CXX/CMakeLists.txt create mode 100644 src/PY/CMakeLists.txt create mode 100644 src/PY/SHAPERSTUDY.py create mode 100644 src/PY/SHAPERSTUDY_Field.py create mode 100644 src/PY/SHAPERSTUDY_IOperations.py create mode 100644 src/PY/SHAPERSTUDY_Object.py create mode 100644 src/PY/SHAPERSTUDY_utils.py create mode 100644 src/SWIG/CMakeLists.txt create mode 100644 test/test0.py diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..758ece0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,226 @@ +# Copyright (C) 2012-2019 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 +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) +PROJECT(SalomeSHAPERSTUDY C CXX) + +# Ensure a proper linker behavior: +CMAKE_POLICY(SET CMP0003 NEW) + +# Versioning +# =========== +# Project name, upper case +STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) + +SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 3) +SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) +SET(${PROJECT_NAME_UC}_VERSION + ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) +SET(${PROJECT_NAME_UC}_VERSION_DEV 1) + +# Common CMake macros +# =================== +SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files") +IF(EXISTS ${CONFIGURATION_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") + INCLUDE(SalomeMacros) +ELSE() + MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !") +ENDIF() + +# Find KERNEL +# =========== +SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL") +IF(EXISTS ${KERNEL_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") + INCLUDE(SalomeMacros) + FIND_PACKAGE(SalomeKERNEL REQUIRED) + KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA +ELSE(EXISTS ${KERNEL_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR") +ENDIF(EXISTS ${KERNEL_ROOT_DIR}) + +# Platform setup +# ============== +INCLUDE(SalomeSetupPlatform) # From KERNEL +# Always build libraries as shared objects: +SET(BUILD_SHARED_LIBS TRUE) +# Local macros: +LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files") + +# User options +# ============ +OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) +#OPTION(SALOME_BUILD_DOC "Generate SALOME SHAPERSTUDY documentation" ON) + +IF(SALOME_BUILD_TESTS) + ENABLE_TESTING() +ENDIF() +# IF(SALOME_BUILD_DOC) +# FIND_PACKAGE(SalomeDoxygen) +# SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC) +# ENDIF() + +## +## From KERNEL: +## +FIND_PACKAGE(SalomePythonInterp REQUIRED) +FIND_PACKAGE(SalomePythonLibs REQUIRED) +FIND_PACKAGE(SalomeOmniORB REQUIRED) +FIND_PACKAGE(SalomeOmniORBPy REQUIRED) +FIND_PACKAGE(SalomeSWIG REQUIRED) + +# Find GUI +# =========== +# SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI") +# IF(EXISTS ${GUI_ROOT_DIR}) +# LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files") +# FIND_PACKAGE(SalomeGUI REQUIRED) +# ADD_DEFINITIONS(${GUI_DEFINITIONS}) +# INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS}) +# ELSE(EXISTS ${GUI_ROOT_DIR}) +# MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR") +# ENDIF(EXISTS ${GUI_ROOT_DIR}) + +## +## From GUI: +## +# Qt +#FIND_PACKAGE(SalomeQt5 REQUIRED) + +# Find GEOM +# =========== +SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM") +IF(EXISTS ${GEOM_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files") + FIND_PACKAGE(SalomeGEOM REQUIRED) + ADD_DEFINITIONS(${GEOM_DEFINITIONS}) + INCLUDE_DIRECTORIES(${GEOM_INCLUDE_DIRS}) + IF(SALOME_BUILD_GUI) + IF(NOT SALOME_GEOM_BUILD_GUI) + MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM with GUI, please set SALOME_BUILD_GUI=ON in GEOM module") + ENDIF(NOT SALOME_GEOM_BUILD_GUI) + ENDIF(SALOME_BUILD_GUI) +ELSE(EXISTS ${GEOM_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR") +ENDIF(EXISTS ${GEOM_ROOT_DIR}) + +# Detection summary: +SALOME_PACKAGE_REPORT_AND_CHECK() + +# Directories +# (default values taken from KERNEL) +# =========== +SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries") +SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs") +SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files") +SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers") +SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH + "Install path: SALOME scripts") +SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH + "Install path: SALOME script data") +SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH + "Install path: SALOME Python scripts") +SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH + "Install path: SALOME application skeleton - scripts") +SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH + "Install path: SALOME application skeleton - Python") +#SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff") +#SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH +# "Install path: SALOME Python shared modules") +SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH "Install path: SALOME CMake files") +SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH + "Install path: local SALOME config files (obsolete, to be removed)") + +SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources") +SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation") + +# Specific to SHAPERSTUDY: +SET(SALOME_SHAPERSTUDY_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/shaperstudy" CACHE PATH + "Install path: SALOME SHAPERSTUDY specific data") + +MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS) +MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON) +MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES) +MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) +MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC) +MARK_AS_ADVANCED(SALOME_SHAPERSTUDY_INSTALL_RES_DATA) + +# Accumulate environment variables for SHAPERSTUDY module +SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}) +SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) + +# Sources +# ======== + +ADD_SUBDIRECTORY(idl) +ADD_SUBDIRECTORY(adm_local) +ADD_SUBDIRECTORY(resources) +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(bin) +# IF(SALOME_BUILD_DOC) +# ADD_SUBDIRECTORY(doc) +# ENDIF() + +# Configuration export +# (here only the level 1 prerequisites are exposed) +# ==================== +INCLUDE(CMakePackageConfigHelpers) + +# List of targets in this project we want to make visible to the rest of the world. +# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" +SET(_${PROJECT_NAME}_exposed_targets + SalomeIDLSHAPERSTUDY +) + +# Add all targets to the build-tree export set +EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} + FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake) + +# Create the configuration files: +# - in the build tree: + +# Ensure the variables are always defined for the configure: +SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}") + +SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") + +# Build variables that will be expanded when configuring SalomeConfig.cmake: +# SALOME_CONFIGURE_PREPARE() #For use in the future + +CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in + ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" + PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX + GUI_ROOT_DIR) + +WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + VERSION ${${PROJECT_NAME_UC}_VERSION} + COMPATIBILITY AnyNewerVersion) + +# Install the CMake configuration files: +INSTALL(FILES + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}") + +# Install the export set for use with the install-tree +INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" + FILE ${PROJECT_NAME}Targets.cmake) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..b1e3f5a --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/README b/README new file mode 100644 index 0000000..57cc844 --- /dev/null +++ b/README @@ -0,0 +1,98 @@ +*************************** +About SALOME SHAPERSTUDY sample +*************************** + +SALOME SHAPERSTUDY module is a SALOME module, providing SHAPER -> SMESH connecting. + +For more information about SALOME platform please visit the SALOME web site: + + + +======= +License +======= + +SALOME platform is distributed under the GNU Lesser General Public License. +See COPYING file for more details. + +Also, additional information can be found at SALOME platform web site: + + + +============ +Installation +============ + +-------------- +Pre-requisites +-------------- + +SALOME platform relies on a set of third-party softwares; some of them are needed +at build time only, while other ones are needed in runtime also. + +For more information about the pre-requisites please visit SALOME platform web +site: + +* Check Release Notes and Software Requirements of the latest SALOME release at + + + +* Pre-requisites page at SALOME web site: + + + +Note: SALOME SHAPERSTUDY needs SALOME KERNEL and SALOME GUI as pre-requisites. + +------------------ +Basic Installation +------------------ + +The build procedure of the SALOME platform is implemented with CMake. +In order to build the module you have to do the following actions: + +1. Set up environment for pre-requisites (see "Pre-requisites" section above). + +2. Create a build directory: + + % mkdir SHAPERSTUDY_BUILD + +3. Configure the build procedure: + + % cd SHAPERSTUDY_BUILD + % cmake -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX= + + where + - is either Release or Debug (default: Release); + - is a destination folder to install SALOME SHAPERSTUDY + module (default: /usr); + - is a path to the SALOME SHAPERSTUDY sources directory. + + Note: by default (if CMAKE_INSTALL_PREFIX option is not given), SALOME SHAPERSTUDY + module will be configured for installation to the /usr directory that requires + root permissions to complete the installation. + +4. Build and install: + + % make + % make install + + This will install SALOME SHAPERSTUDY module to the + specified to cmake command on the previous step. + +------------------- +Custom installation +------------------- + +SALOME SHAPERSTUDY module supports a set of advanced configuration options; +for more details learn CMakeLists.txt file in the root source directory. + +You can also use other options of cmake command to customize your installation. +Learn more about available options by typing + + % cmake --help + +=============== +Troubleshooting +=============== + +Please, send a mail to webmaster.salome@opencascade.com. diff --git a/SalomeSHAPERSTUDYConfig.cmake.in b/SalomeSHAPERSTUDYConfig.cmake.in new file mode 100644 index 0000000..eb29620 --- /dev/null +++ b/SalomeSHAPERSTUDYConfig.cmake.in @@ -0,0 +1,116 @@ +# - Config file for the @PROJECT_NAME@ package +# It defines the following variables. +# Specific to the pacakge @PROJECT_NAME@ itself: +# @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file +# + +############################################################### +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE: +@PACKAGE_INIT@ + + +# Package root dir: +SET_AND_CHECK(SHAPERSTUDY_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@") + +# Include directories +SET_AND_CHECK(SHAPERSTUDY_INCLUDE_DIRS "${SHAPERSTUDY_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@") +SET(SHAPERSTUDY_INCLUDE_DIRS "${SHAPERSTUDY_INCLUDE_DIRS};@_SalomeSHAPERSTUDY_EXTRA_HEADERS@") +SET(SHAPERSTUDY_DEFINITIONS "@GUI_DEFINITIONS@") + +# Package specific environment variables +@_SalomeSHAPERSTUDY_EXTRA_ENV_FULL@ + +# Load the dependencies for the libraries of @PROJECT_NAME@ +# (contains definitions for IMPORTED targets). This is only +# imported if we are not built as a subproject (in this case targets are already there) +IF(NOT TARGET SalomeIDLSHAPERSTUDY AND NOT @PROJECT_NAME@_BINARY_DIR) + INCLUDE("${SHAPERSTUDY_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE_LOCAL}/SalomeSHAPERSTUDYTargets.cmake") +ENDIF() + +#### Now the specificities + +# Options exported by the package: +SET(SALOME_SHAPERSTUDY_BUILD_TESTS @SALOME_BUILD_TESTS@) +SET(SALOME_SHAPERSTUDY_BUILD_DOC @SALOME_BUILD_DOC@) + +# Level 1 prerequisites: +SET_AND_CHECK(GUI_ROOT_DIR_EXP "@PACKAGE_GUI_ROOT_DIR@") + +# For all prerequisites, load the corresponding targets if the package was used +# in CONFIG mode. This ensures dependent projects link correctly +# without having to set LD_LIBRARY_PATH: +SET(_PREREQ_@PROJECT_NAME@ @_PREREQ_LIST@) +SET(_PREREQ_@PROJECT_NAME@_CONFIG_DIR @_PREREQ_DIR_LIST@) +SET(_PREREQ_@PROJECT_NAME@_COMPONENTS "@_PREREQ_COMPO_LIST@") +LIST(LENGTH _PREREQ_@PROJECT_NAME@_CONFIG_DIR _list_len_@PROJECT_NAME@) +IF(NOT _list_len_@PROJECT_NAME@ EQUAL 0) + # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ... + MATH(EXPR _range_@PROJECT_NAME@ "${_list_len_@PROJECT_NAME@}-1") + FOREACH(_p_@PROJECT_NAME@ RANGE ${_range_@PROJECT_NAME@}) + LIST(GET _PREREQ_@PROJECT_NAME@ ${_p_@PROJECT_NAME@} _pkg_@PROJECT_NAME@ ) + LIST(GET _PREREQ_@PROJECT_NAME@_CONFIG_DIR ${_p_@PROJECT_NAME@} _pkg_dir_@PROJECT_NAME@) + LIST(GET _PREREQ_@PROJECT_NAME@_COMPONENTS ${_p_@PROJECT_NAME@} _pkg_compo_@PROJECT_NAME@) + IF(NOT OMIT_DETECT_PACKAGE_${_pkg_@PROJECT_NAME@}) + MESSAGE(STATUS "===> Reloading targets from ${_pkg_@PROJECT_NAME@} ...") + IF(NOT _pkg_compo_@PROJECT_NAME@) + FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE + PATHS "${_pkg_dir_@PROJECT_NAME@}" + NO_DEFAULT_PATH) + ELSE() + STRING(REPLACE "," ";" _compo_lst_@PROJECT_NAME@ "${_pkg_compo_@PROJECT_NAME@}") + MESSAGE(STATUS "===> (components: ${_pkg_compo_@PROJECT_NAME@})") + FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE + COMPONENTS ${_compo_lst_@PROJECT_NAME@} + PATHS "${_pkg_dir_@PROJECT_NAME@}" + NO_DEFAULT_PATH) + ENDIF() + ENDIF() + ENDFOREACH() +ENDIF() + +# Installation directories +SET(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@") +SET(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@") +SET(SALOME_INSTALL_IDLS "@SALOME_INSTALL_IDLS@") +SET(SALOME_INSTALL_HEADERS "@SALOME_INSTALL_HEADERS@") +SET(SALOME_INSTALL_SCRIPT_SCRIPTS "@SALOME_INSTALL_SCRIPT_SCRIPTS@") +SET(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@") +SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@") +SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "@SALOME_INSTALL_APPLISKEL_SCRIPTS@") +SET(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@") +SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@") +SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@") +SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@") +SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@") +SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@") +SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@") + +# Include GUI targets if they were not already loaded: +IF(NOT (TARGET Event)) + INCLUDE("${GUI_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeGUITargets.cmake") +ENDIF() + +# Exposed SHAPERSTUDY targets: +SET(SHAPERSTUDY_SalomeIDLSHAPERSTUDY SalomeIDLSHAPERSTUDY) \ No newline at end of file diff --git a/adm_local/CMakeLists.txt b/adm_local/CMakeLists.txt new file mode 100644 index 0000000..5c3ab10 --- /dev/null +++ b/adm_local/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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(unix) +ADD_SUBDIRECTORY(cmake_files) diff --git a/adm_local/cmake_files/CMakeLists.txt b/adm_local/cmake_files/CMakeLists.txt new file mode 100644 index 0000000..63ccc36 --- /dev/null +++ b/adm_local/cmake_files/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2012-2019 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 +# + +# =============================================================== +# Files to be installed +# =============================================================== + +# These files are data, module or lib files +SET(_adm_data + FindSalomeSHAPERSTUDY.cmake +) +INSTALL(FILES ${_adm_data} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL}) diff --git a/adm_local/cmake_files/FindSalomeSHAPERSTUDY.cmake b/adm_local/cmake_files/FindSalomeSHAPERSTUDY.cmake new file mode 100644 index 0000000..a0da83f --- /dev/null +++ b/adm_local/cmake_files/FindSalomeSHAPERSTUDY.cmake @@ -0,0 +1,33 @@ +# Copyright (C) 2007-2019 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 +# + +IF(NOT SalomePYHELLO_FIND_QUIETLY) + MESSAGE(STATUS "Looking for Salome PYHELLO ...") +ENDIF() + +SET(CMAKE_PREFIX_PATH "${PYHELLO_ROOT_DIR}") +SALOME_FIND_PACKAGE(SalomePYHELLO SalomePYHELLO CONFIG) + +IF(NOT SalomePYHELLO_FIND_QUIETLY) + MESSAGE(STATUS "Found Salome PYHELLO: ${PYHELLO_ROOT_DIR}") +ENDIF() + +FOREACH(_res ${SalomePYHELLO_EXTRA_ENV}) + SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomePYHELLO_EXTRA_ENV_${_res}}") +ENDFOREACH() diff --git a/adm_local/unix/CMakeLists.txt b/adm_local/unix/CMakeLists.txt new file mode 100644 index 0000000..5c1ad09 --- /dev/null +++ b/adm_local/unix/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2012-2019 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(config_files) diff --git a/adm_local/unix/config_files/CMakeLists.txt b/adm_local/unix/config_files/CMakeLists.txt new file mode 100644 index 0000000..cfd1b14 --- /dev/null +++ b/adm_local/unix/config_files/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +SET(_m4_data + check_SHAPERSTUDY.m4 +) + +INSTALL(FILES ${_m4_data} DESTINATION ${SALOME_INSTALL_AMCONFIG_LOCAL}/config_files) diff --git a/adm_local/unix/config_files/check_SHAPERSTUDY.m4 b/adm_local/unix/config_files/check_SHAPERSTUDY.m4 new file mode 100644 index 0000000..fb58bac --- /dev/null +++ b/adm_local/unix/config_files/check_SHAPERSTUDY.m4 @@ -0,0 +1,75 @@ +dnl Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl + +# Check availability of SHAPERSTUDY binary distribution +# +# Author : Marc Tajchman (CEA, 2002) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_SHAPERSTUDY],[ + +AC_CHECKING(for SHAPERSTUDY) + +SHAPERSTUDY_ok=no + +AC_ARG_WITH(SHAPERSTUDY, + --with-shaperstudy=DIR root directory path of SHAPERSTUDY installation, + SHAPERSTUDY_DIR="$withval",SHAPERSTUDY_DIR="") + +if test "x$SHAPERSTUDY_DIR" = "x" ; then + +# no --with-py-hello option used + + if test "x$SHAPERSTUDY_ROOT_DIR" != "x" ; then + + # SHAPERSTUDY_ROOT_DIR environment variable defined + SHAPERSTUDY_DIR=$SHAPERSTUDY_ROOT_DIR + + else + + # search SHAPERSTUDY binaries in PATH variable + AC_PATH_PROG(TEMP, SHAPERSTUDYGUI.py) + if test "x$TEMP" != "x" ; then + SHAPERSTUDY_BIN_DIR=`dirname $TEMP` + SHAPERSTUDY_DIR=`dirname $SHAPERSTUDY_BIN_DIR` + fi + + fi +# +fi + +if test -f ${SHAPERSTUDY_DIR}/bin/salome/SHAPERSTUDY.py ; then + SHAPERSTUDY_ok=yes + AC_MSG_RESULT(Using SHAPERSTUDY distribution in ${SHAPERSTUDY_DIR}) + + if test "x$SHAPERSTUDY_ROOT_DIR" == "x" ; then + SHAPERSTUDY_ROOT_DIR=${SHAPERSTUDY_DIR} + fi + AC_SUBST(SHAPERSTUDY_ROOT_DIR) +else + AC_MSG_WARN("Cannot find compiled SHAPERSTUDY distribution") +fi + +AC_MSG_RESULT(for SHAPERSTUDY: $SHAPERSTUDY_ok) + +])dnl + diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt new file mode 100644 index 0000000..a51b5da --- /dev/null +++ b/bin/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2012-2019 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(VERSION.in VERSION INSTALL ${SALOME_INSTALL_BINS}) +#SALOME_CONFIGURE_FILE(runSHAPERSTUDY.in runSHAPERSTUDY INSTALL ${SALOME_INSTALL_BINS} EXEC_PERMS) + +# =============================================================== +# Files to be installed +# =============================================================== + +SET(_bin_scripts + +) + +SALOME_INSTALL_SCRIPTS("${_bin_scripts}" ${SALOME_INSTALL_SCRIPT_SCRIPTS}) diff --git a/bin/VERSION.in b/bin/VERSION.in new file mode 100644 index 0000000..fa7593a --- /dev/null +++ b/bin/VERSION.in @@ -0,0 +1,3 @@ +[SALOME SHAPERSTUDY] : @SALOMESHAPERSTUDY_VERSION@ +[DEVELOPMENT] : @SALOMESHAPERSTUDY_VERSION_DEV@ +[DESCRIPTION] : SHAPERSTUDY SALOME module diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt new file mode 100644 index 0000000..2389f2a --- /dev/null +++ b/idl/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright (C) 2012-2019 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) # Provided by KERNEL + +INCLUDE_DIRECTORIES( + ${OMNIORB_INCLUDE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${KERNEL_INCLUDE_DIRS} +) + +SET(SalomeIDLSHAPERSTUDY_IDLSOURCES + SHAPERSTUDY_Gen.idl +) + +SET(_idl_include_dirs + ${KERNEL_ROOT_DIR}/idl/salome + ${GEOM_ROOT_DIR}/idl/salome +) + +SET(_idl_link_flags + ${KERNEL_SalomeIDLKernel} +) + +OMNIORB_ADD_MODULE(SalomeIDLSHAPERSTUDY "${SalomeIDLSHAPERSTUDY_IDLSOURCES}" "${_idl_include_dirs}" "${_idl_link_flags}") +INSTALL(TARGETS SalomeIDLSHAPERSTUDY EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/idl/SHAPERSTUDY_Gen.idl b/idl/SHAPERSTUDY_Gen.idl new file mode 100644 index 0000000..e5a3d56 --- /dev/null +++ b/idl/SHAPERSTUDY_Gen.idl @@ -0,0 +1,82 @@ +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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 __SHAPERSTUDY_GEN__ +#define __SHAPERSTUDY_GEN__ + +#include "GEOM_Gen.idl" +#include "SALOMEDS.idl" +#include "SALOME_Exception.idl" + +module SHAPERSTUDY_ORB +{ +interface Gen : GEOM::GEOM_Gen +{ +}; + +interface IShapesOperations : GEOM::GEOM_IShapesOperations +{ +}; + +interface IGroupOperations : GEOM::GEOM_IGroupOperations +{ +}; + +interface IFieldOperations : GEOM::GEOM_IFieldOperations +{ +}; + +interface IMeasureOperations : GEOM::GEOM_IMeasureOperations +{ +}; + +interface BaseObject : GEOM::GEOM_BaseObject +{ +}; + +interface SHAPER_Object : GEOM::GEOM_Object +{ +}; + +interface Field : GEOM::GEOM_Field +{ +}; + +interface FieldStep : GEOM::GEOM_FieldStep +{ +}; + +interface DoubleFieldStep : GEOM::GEOM_DoubleFieldStep +{ +}; + +interface IntFieldStep : GEOM::GEOM_IntFieldStep +{ +}; + +interface BoolFieldStep : GEOM::GEOM_BoolFieldStep +{ +}; + +}; + +#endif diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt new file mode 100644 index 0000000..5b76885 --- /dev/null +++ b/resources/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +SET(SHAPERSTUDY_RESOURCES_FILES + #SHAPERSTUDY_small.png +) + +INSTALL(FILES ${SHAPERSTUDY_RESOURCES_FILES} DESTINATION ${SALOME_SHAPERSTUDY_INSTALL_RES_DATA}) + +SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_SHAPERSTUDY_INSTALL_RES_DATA}) +SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SHAPERSTUDYCatalog.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SHAPERSTUDYCatalog.xml INSTALL ${SALOME_SHAPERSTUDY_INSTALL_RES_DATA}) diff --git a/resources/SHAPERSTUDYCatalog.xml.in b/resources/SHAPERSTUDYCatalog.xml.in new file mode 100644 index 0000000..54447e4 --- /dev/null +++ b/resources/SHAPERSTUDYCatalog.xml.in @@ -0,0 +1,70 @@ + + + + + + + + + + + + SHAPERSTUDY + SHAPERSTUDY + Data + SALOME team + @SALOMESHAPERSTUDY_VERSION@ + + 1 + SHAPERSTUDY.png + + + + SHAPERSTUDY_Gen + unknown + + + + makeBanner + vsr + @SALOMESHAPERSTUDY_VERSION@ + unknown + 0 + + + name + string + unknown + + + + + return + string + unknown + + + + + + + createObject + vsr + @SALOMESHAPERSTUDY_VERSION@ + unknown + 0 + + + name + string + unknown + + + + + + + + + + diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in new file mode 100644 index 0000000..3e14f8e --- /dev/null +++ b/resources/SalomeApp.xml.in @@ -0,0 +1,13 @@ + +
+ + + + + +
+
+ + +
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..cb3225b --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (C) 2012-2019 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 +# + +## +# Common packages +## +SET(SUBDIRS_COMMON + #CXX + #SWIG + PY +) + +SET(SUBDIRS + ${SUBDIRS_COMMON} +) + +FOREACH(dir ${SUBDIRS}) + ADD_SUBDIRECTORY(${dir}) +ENDFOREACH(dir ${SUBDIRS}) + diff --git a/src/CXX/CMakeLists.txt b/src/CXX/CMakeLists.txt new file mode 100644 index 0000000..23b3d88 --- /dev/null +++ b/src/CXX/CMakeLists.txt @@ -0,0 +1,66 @@ +# Copyright (C) 2012-2019 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 +# + + +# --- options --- +# additional include directories +INCLUDE_DIRECTORIES( + ${KERNEL_INCLUDE_DIRS} + ${GEOM_INCLUDE_DIRS} + ${OpenCASCADE_INCLUDE_DIR} + ${SHAPER_INCLUDE_DIRS} +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${OpenCASCADE_DEFINITIONS} +) + +# libraries to link to +SET(_link_LIBRARIES + # ${OpenCASCADE_ModelingAlgorithms_LIBRARIES} + # ${OpenCASCADE_ModelingData_LIBRARIES} + # ${OpenCASCADE_ApplicationFramework_LIBRARIES} + # ${GEOM_NMTTools} + # ${GEOM_GEOMUtils} +) + +# --- headers --- + +# header files / no moc processing +SET(SHAPERSTUDYCore_HEADERS +) + +# --- sources --- + +# sources / static +SET(SHAPERSTUDYCore_SOURCES +) + +# --- rules --- + +ADD_LIBRARY(SHAPERSTUDYCore ${SHAPERSTUDYCore_SOURCES}) +IF(WIN32) + TARGET_COMPILE_OPTIONS(SHAPERSTUDYCore PRIVATE /bigobj) +ENDIF(WIN32) + +TARGET_LINK_LIBRARIES(SHAPERSTUDYCore ${_link_LIBRARIES} ) +INSTALL(TARGETS SHAPERSTUDYCore EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${SHAPERSTUDYCore_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/PY/CMakeLists.txt b/src/PY/CMakeLists.txt new file mode 100644 index 0000000..a4dfa52 --- /dev/null +++ b/src/PY/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (C) 2012-2019 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 +# + +# --- scripts --- + +# scripts / static +SET(_bin_SCRIPTS + SHAPERSTUDY.py + SHAPERSTUDY_Field.py + SHAPERSTUDY_IOperations.py + SHAPERSTUDY_Object.py + SHAPERSTUDY_utils.py +) + +# --- rules --- +SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) \ No newline at end of file diff --git a/src/PY/SHAPERSTUDY.py b/src/PY/SHAPERSTUDY.py new file mode 100644 index 0000000..6730fb2 --- /dev/null +++ b/src/PY/SHAPERSTUDY.py @@ -0,0 +1,291 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +import SHAPERSTUDY_ORB__POA +import SALOME_ComponentPy +import SALOME_DriverPy +import SALOMEDS +from SHAPERSTUDY_utils import findOrCreateComponent, moduleName, getStudy, getORB + +__entry2IOR__ = {} + +class SHAPERSTUDY(SHAPERSTUDY_ORB__POA.Gen, + SALOME_ComponentPy.SALOME_ComponentPy_i, + SALOME_DriverPy.SALOME_DriverPy_i): + + + ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9} + + def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ): + """ + Construct an instance of SHAPERSTUDY module engine. + The class SHAPERSTUDY implements CORBA interface Gen (see SHAPERSTUDY_Gen.idl). + It is inherited (via GEOM_Gen) from the classes SALOME_ComponentPy_i (implementation of + Engines::EngineComponent CORBA interface - SALOME component) and SALOME_DriverPy_i + (implementation of SALOMEDS::Driver CORBA interface - SALOME module's engine). + """ + SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, + contID, containerName, instanceName, interfaceName, False) + SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName) + # + #self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) + # + pass + + def publish( self, theShaperObj ): + """ + Publish GEOM_Object corresponding to a given SHAPER object + """ + return SHAPERSTUDY_Object() + + def AddInStudy( self, theObject, theName, theFather ): + """ + Adds in theStudy a object theObject under theFather with a name theName, + if theFather is not NULL the object is placed under theFather's SObject. + Returns a SObject where theObject is placed + """ + so = SALOMEDS.SALOMEDS_SObject() + return so + + def AddSubShape( theMainShape, theIndices ): + """ + Add a sub-shape defined by indices in theIndices + (contains unique IDs of sub-shapes inside theMainShape) + """ + go = SHAPERSTUDY_Object()._this() + return go + + def RemoveObject( self, theObject ): + """ + Removes the object from the component + """ + return + + def GetIFieldOperations( self ): + """ + """ + return SHAPERSTUDY_IFieldOperations() + + def GetIGroupOperations( self ): + """ + """ + return SHAPERSTUDY_IGroupOperations() + + def GetIShapesOperations( self ): + """ + """ + return SHAPERSTUDY_IShapesOperations() + + def GetIMeasureOperations( self ): + """ + """ + return SHAPERSTUDY_IMeasureOperations() + + def GetStringFromIOR( self, theObject ): + """ + Returns a string which contains an IOR of the SHAPERSTUDY_Object + """ + IOR = "" + if theObject and getORB(): + IOR = getORB().object_to_string( theObject ) + pass + return IOR + + def GetAllDumpNames( self ): + """ + Returns all names with which Object's was dumped + into python script to avoid the same names in SMESH script + """ + return [""] + + def GetDumpName( self, theStudyEntry ): + """ + Returns a name with which a GEOM_Object was dumped into python script + + Parameters: + theStudyEntry is an entry of the Object in the study + """ + return "" + + + def Save( self, component, URL, isMultiFile ): + """ + Saves data. + Nothing to do here because in our case all data + are stored in the SALOMEDS attributes. + """ + return "" + + def Load( self, component, stream, URL, isMultiFile ): + """ + Loads data + """ + global __entry2IOR__ + __entry2IOR__.clear() + # + return 1 + + def IORToLocalPersistentID(self, sobject, IOR, isMultiFile, isASCII): + """ + Gets persistent ID for the CORBA object. + It's enough to use study entry. + """ + return sobject.GetID() + + def LocalPersistentIDToIOR(self, sobject, persistentID, isMultiFile, isASCII): + "Converts persistent ID of the object to its IOR." + global __entry2IOR__ + if persistentID in __entry2IOR__: + return __entry2IOR__[persistentID] + return "" + + def DumpPython( self, isPublished, isMultiFile ): + """ + Dump module data to the Python script. + """ + return ("".encode(), 1) + + + + def CreateGroup( self, theMainShape, theShapeType ): + """ + Creates a new group which will store sub-shapes of theMainShape + """ + return GetIGroupOperations().CreateGroup( theMainShape, theShapeType ); + + def ExtractShapes( self, aShape, aType, isSorted = False ): + """ + Extract shapes (excluding the main shape) of given type. + + Parameters: + aShape The shape. + aType The shape type (see geompy.ShapeType) + isSorted Boolean flag to switch sorting on/off. + + Returns: + List of sub-shapes of type aType, contained in aShape. + """ + return [ SHAPERSTUDY_Object()._this() ] + + def GetSubShape( self, aShape, ListOfID ): + """ + Obtain a composite sub-shape of aShape, composed from sub-shapes + of aShape, selected by their unique IDs inside aShape + + Parameters: + aShape Shape to get sub-shape of. + ListOfID List of sub-shapes indices. + """ + return SHAPERSTUDY_Object()._this() + + def GetSubShapeID( self, aShape, aSubShape ): + """ + Obtain unique ID of sub-shape aSubShape inside aShape + of aShape, selected by their unique IDs inside aShape + + Parameters: + aShape Shape to get sub-shape of. + aSubShape Sub-shapes of aShape. + """ + return 1 + + def MinDistance( self, theShape1, theShape2 ): + """ + Get minimal distance between the given shapes. + """ + return 0. + + def NumberOfEdges( self, theShape ): + """ + Gives quantity of edges in the given shape. + """ + return 0 + + def NumberOfFaces( self, ): + """ + Gives quantity of faces in the given shape. + """ + return 0 + + def PointCoordinates( self, theVertex ): + """ + Get point coordinates + """ + return 0,0,0 + + def SubShapeAll( self, aShape, aType ): + """ + Explode a shape on sub-shapes of a given type. + If the shape itself matches the type, it is also returned. + """ + return [ SHAPERSTUDY_Object()._this() ] + + def SubShapeName( self, aSubObj, aMainObj ): + """ + Get name for sub-shape aSubObj of shape aMainObj + """ + return "" + + def SubShapes( self, aShape, anIDs ): + """ + Get a set of sub-shapes defined by their unique IDs inside theMainShape + """ + return [ SHAPERSTUDY_Object()._this() ] + + def Tolerance( self, theShape ): + """ + Get min and max tolerances of sub-shapes of theShape + + Returns: + [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax] + """ + return [0,0, 0,0, 0,0] + + def UnionList( self, theGroup, theSubShapes ): + """ + Adds to the group all the given shapes. No errors, if some shapes are already included. + """ + return GetIGroupOperations().UnionList( theGroup, theSubShapes ) + + def addToStudy( self, aShape, aName ): + """ + Publish in study aShape with name aName + """ + try: + so = self.AddInStudy(aShape, aName, None ) + if so and aName: so.SetAttrString("AttributeName", aName) + except: + print("addToStudyInFather() failed") + return "" + return so.GetStudyEntry() + + def addToStudyInFather(self, aFather, aShape, aName): + """ + Publish in study aShape with name aName as sub-object of previously published aFather + """ + try: + so = self.AddInStudy(aShape, aName, aFather ) + if so and aName: so.SetAttrString("AttributeName", aName) + except: + print("addToStudyInFather() failed") + return "" + return so.GetStudyEntry() diff --git a/src/PY/SHAPERSTUDY_Field.py b/src/PY/SHAPERSTUDY_Field.py new file mode 100644 index 0000000..5b8b026 --- /dev/null +++ b/src/PY/SHAPERSTUDY_Field.py @@ -0,0 +1,138 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +import SHAPERSTUDY_ORB__POA +import GEOM + +class SHAPERSTUDY_Field(SHAPERSTUDY_ORB__POA.Field): + """ + Construct an instance of SHAPERSTUDY Field. + """ + def __init__ ( self, *args ): + pass + + def GetDataType( self ): + """ + Returns type of field data (GEOM.field_data_type) + """ + return GEOM.FDT_Double + + def GetShape( self ): + """ + Returns the shape the field lies on + """ + return SHAPERSTUDY_Object() + + def GetSteps( self ): + """ + Returns a list of time step IDs in the field + """ + return [1] + + def GetComponents( self ): + """ + Returns names of components + """ + return ['X'] + + def GetDimension( self ): + """ + Returns dimension of the shape the field lies on: + 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape + """ + return -1 + + pass + + + +class SHAPERSTUDY_FieldStep(SHAPERSTUDY_ORB__POA.FieldStep): + """ + Construct an instance of SHAPERSTUDY FieldStep. + """ + def __init__ ( self, *args): + pass + + def GetStamp( self ): + """ + Returns the time of the field step + """ + return 100 + + def GetID( self ): + """ + Returns the number of the field step + """ + return 1 + + pass + + +class SHAPERSTUDY_DoubleFieldStep(SHAPERSTUDY_ORB__POA.DoubleFieldStep): + """ + Construct an instance of SHAPERSTUDY FieldStep. + """ + def __init__ ( self, *args): + SHAPERSTUDY_FieldStep.__init__(self, *args) + pass + + def GetValues( self ): + """ + Returns values of the field step + """ + return [1.0] + + pass + + +class SHAPERSTUDY_IntFieldStep(SHAPERSTUDY_ORB__POA.IntFieldStep): + """ + Construct an instance of SHAPERSTUDY FieldStep. + """ + def __init__ ( self, *args): + SHAPERSTUDY_FieldStep.__init__(self, *args) + pass + + def GetValues( self ): + """ + Returns values of the field step + """ + return [1] + + pass + + +class SHAPERSTUDY_BoolFieldStep(SHAPERSTUDY_ORB__POA.BoolFieldStep): + """ + Construct an instance of SHAPERSTUDY FieldStep. + """ + def __init__ ( self, *args): + SHAPERSTUDY_FieldStep.__init__(self, *args) + pass + + def GetValues( self ): + """ + Returns values of the field step + """ + return [True] + + pass diff --git a/src/PY/SHAPERSTUDY_IOperations.py b/src/PY/SHAPERSTUDY_IOperations.py new file mode 100644 index 0000000..ee644b8 --- /dev/null +++ b/src/PY/SHAPERSTUDY_IOperations.py @@ -0,0 +1,173 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +import SHAPERSTUDY_ORB__POA + +class SHAPERSTUDY_IShapesOperations(SHAPERSTUDY_ORB__POA.IShapesOperations): + """ + Construct an instance of SHAPERSTUDY IShapesOperations. + """ + def __init__ ( self, *args): + pass + + def GetAllSubShapesIDs( self, theShape, theShapeType, isSorted ): + """ + Explode a shape on sub-shapes of a given type. + + Parameters: + theShape Shape to be exploded. + theShapeType Type of sub-shapes to be retrieved. + isSorted If this parameter is TRUE, sub-shapes will be + sorted by coordinates of their gravity centers. + """ + return [1] + + def GetSharedShapes( self, theShape1, theShape2, theShapeType ): + """ + Get sub-shapes, shared by input shapes. + + Parameters: + theShape1 Shape to find sub-shapes in. + theShape2 Shape to find shared sub-shapes with. + theShapeType Type of sub-shapes to be retrieved. + """ + return [ SHAPERSTUDY_Object()._this() ] + + def GetSubShapeIndex( self, theMainShape, theSubShape ): + """ + Get global index of theSubShape in theMainShape. + """ + return 2 + + def GetSubShape( self, theMainShape, theID ): + """ + Get a sub-shape defined by its unique ID within theMainShape + """ + return SHAPERSTUDY_Object()._this() + + def GetInPlace( self, theShapeWhere, theShapeWhat ): + """ + Get sub-shape(s) of \a theShapeWhere, which are + coincident with \a theShapeWhat or could be a part of it. + """ + return SHAPERSTUDY_Object()._this() + + def GetInPlaceMap( self, theShapeWhere, theShapeWhat ): + """ + A sort of GetInPlace functionality, returning for each sub-shape ID of + \a theShapeWhat a list of corresponding sub-shape IDs of \a theShapeWhere. + """ + return [[]] + + def IsDone( self ): + """ + To know, if the operation was successfully performed + """ + return False + + pass + + +class SHAPERSTUDY_IGroupOperations(SHAPERSTUDY_ORB__POA.IGroupOperations): + """ + Construct an instance of SHAPERSTUDY IShapesOperations. + """ + def __init__ ( self, *args): + pass + + def CreateGroup( self, theMainShape, theShapeType ): + """ + Creates a new group which will store sub-shapes of theMainShape + """ + return SHAPERSTUDY_Object()._this() + + def UnionList( self, theGroup, theSubShapes ): + """ + Adds to the group all the given shapes. No errors, if some shapes are already included. + + Parameters: + theGroup is a GEOM group to which the new sub-shapes are added. + theSubShapes is a list of sub-shapes to be added. + """ + return + + def IsDone( self ): + """ + To know, if the operation was successfully performed + """ + return False + + def GetMainShape( self, theGroup ): + """ + Returns a main shape associated with the group + """ + return SHAPERSTUDY_Object()._this() + + def GetType( self, theGroup ): + """ + Returns a type (int) of sub-objects stored in the group + """ + return SHAPERSTUDY_Object()._this() + + def GetObjects( self, theGroup ): + """ + Returns a list of sub-objects ID stored in the group + """ + return [2] + + pass + +class SHAPERSTUDY_IFieldOperations(SHAPERSTUDY_ORB__POA.IFieldOperations): + """ + Construct an instance of SHAPERSTUDY IFieldOperations. + """ + def __init__ ( self, *args): + pass + + def GetFields( self, shape ): + """ + Returns all fields on a shape + """ + return [ SHAPERSTUDY_Field() ] + + pass + + +class SHAPERSTUDY_IMeasureOperations(SHAPERSTUDY_ORB__POA.IMeasureOperations): + """ + Construct an instance of SHAPERSTUDY IMeasureOperations. + """ + def __init__ ( self, *args): + pass + + def GetVertexByIndex( self, theShape, theIndex, theUseOri ): + """ + Get a vertex sub-shape by index. + + Parameters: + theShape Shape to find sub-shape. + theIndex Index to find vertex by this index (starting from zero) + theUseOri To consider edge/wire orientation or not + """ + return [ SHAPERSTUDY_Field() ] + + pass diff --git a/src/PY/SHAPERSTUDY_Object.py b/src/PY/SHAPERSTUDY_Object.py new file mode 100644 index 0000000..46eb7f1 --- /dev/null +++ b/src/PY/SHAPERSTUDY_Object.py @@ -0,0 +1,132 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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 +# + +import SHAPERSTUDY_ORB__POA +import GEOM +from SHAPERSTUDY_utils import getEngine + +class SHAPERSTUDY_BaseObject(SHAPERSTUDY_ORB__POA.BaseObject): + """ + Construct an instance of SHAPER_BaseObject. + """ + def __init__ ( self, *args): + pass + + def GetName( self ): + """ + Get name of the object associated with this object. + """ + return "" + + def GetEntry( self ): + """ + Get internal (unique) entry of the object in the component's data tree. + """ + return '0:0:0:1' + + def GetType( self ): + """ + Get internal type of operation created this object. + In SMESH is used to find out if an object is GROUP (type == 37) + """ + return 1 + + def GetTick( self ): + """ + Get value of a modification counter of the object + """ + return 1 + + def GetStudyEntry( self ): + """ + Get a Study entry where this object was published. + """ + return '0:0:0:1' + + def IsShape( self ): + """ + Return true if geom object representes a shape. + For example, method return false for GEOM_MARKER + """ + return False + + def IsSame( self, other ): + """ + Return true if passed object is identical to this object + """ + return False + + def GetGen( self ): + """ + Return the engine creating this object + """ + return getEngine() + + pass + + + +class SHAPERSTUDY_Object(SHAPERSTUDY_ORB__POA.SHAPER_Object): + """ + Construct an instance of SHAPERSTUDY Object. + """ + def __init__ ( self, *args): + pass + + def GetShapeType( self ): + """ + Get a GEOM.shape_type of the object value. + """ + return GEOM.SHAPE + + def IsMainShape( self ): + """ + Returns True if this object is not a sub-shape of another object. + """ + return False + + def GetSubShapeIndices( self ): + """ + Get a list of ID's of sub-shapes in the main shape. + """ + return [1] + + def GetMainShape( self ): + """ + Get a main shape object to which this object is a sub-shape. + """ + return + + def getShape( self ): + """ + Get the TopoDS_Shape, for colocated case only. + Called by GEOM_Client to get TopoDS_Shape pointer + """ + return 0 + + def GetShapeStream( self ): + """ + Get geometric shape of the object as a byte stream in BRep format + """ + return ; + + pass diff --git a/src/PY/SHAPERSTUDY_utils.py b/src/PY/SHAPERSTUDY_utils.py new file mode 100644 index 0000000..f26a2de --- /dev/null +++ b/src/PY/SHAPERSTUDY_utils.py @@ -0,0 +1,166 @@ +# Copyright (C) 2007-2019 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 : SHAPERSTUDY_utils.py +# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +# --- +# +__all__ = [ + #"moduleID", + #"objectID", + #"unknownID", + "moduleName", + "modulePixmap", + "verbose", + "getORB", + "getNS", + "getLCC", + "getEngine", + "getStudy", + "getEngineIOR", + "findOrCreateComponent", + "getObjectID", + ] + + +from omniORB import CORBA +from SALOME_NamingServicePy import SALOME_NamingServicePy_i +from LifeCycleCORBA import LifeCycleCORBA +import SALOMEDS +import SALOMEDS_Attributes_idl +import SHAPERSTUDY_ORB +import os + +### +# Get SHAPERSTUDY module's name +### +def moduleName(): + return "SHAPERSTUDY" + +### +# Get module's pixmap name +### +def modulePixmap(): + return "SHAPERSTUDY_small.png" + +### +# Get verbose level +### +__verbose__ = None +def verbose(): + global __verbose__ + if __verbose__ is None: + try: + __verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) ) + except: + __verbose__ = 0 + pass + pass + return __verbose__ + +### +# Get ORB reference +### +__orb__ = None +def getORB(): + global __orb__ + if __orb__ is None: + __orb__ = CORBA.ORB_init( [''], CORBA.ORB_ID ) + pass + return __orb__ + +### +# Get naming service instance +### +__naming_service__ = None +def getNS(): + global __naming_service__ + if __naming_service__ is None: + __naming_service__ = SALOME_NamingServicePy_i( getORB() ) + pass + return __naming_service__ + +## +# Get life cycle CORBA instance +## +__lcc__ = None +def getLCC(): + global __lcc__ + if __lcc__ is None: + __lcc__ = LifeCycleCORBA( getORB() ) + pass + return __lcc__ + +## +# Get study +### +__study__ = None +def getStudy(): + global __study__ + if __study__ is None: + obj = getNS().Resolve( '/Study' ) + __study__ = obj._narrow( SALOMEDS.Study ) + pass + return __study__ + +### +# Get SHAPERSTUDY engine +### +__engine__ = None +def getEngine(): + global __engine__ + if __engine__ is None: + __engine__ = getLCC().FindOrLoadComponent( "FactoryServerPy", moduleName() ) + pass + return __engine__ + +### +# Get SHAPERSTUDY engine IOR +### +def getEngineIOR(): + IOR = "" + if getORB() and getEngine(): + IOR = getORB().object_to_string( getEngine() ) + pass + return IOR + +### +# Find or create SHAPERSTUDY component object in a study +### +def findOrCreateComponent(): + study = getStudy() + father =study.FindComponent( moduleName() ) + if father is None: + builder = study.NewBuilder() + father = builder.NewComponent( moduleName() ) + attr = builder.FindOrCreateAttribute( father, "AttributeName" ) + attr.SetValue( moduleName() ) + attr = builder.FindOrCreateAttribute( father, "AttributePixMap" ) + attr.SetPixMap( modulePixmap() ) + attr = builder.FindOrCreateAttribute( father, "AttributeLocalID" ) + attr.SetValue( moduleID() ) + try: + builder.DefineComponentInstance( father, getEngine() ) + pass + except: + pass + pass + return father + diff --git a/src/SWIG/CMakeLists.txt b/src/SWIG/CMakeLists.txt new file mode 100644 index 0000000..c788197 --- /dev/null +++ b/src/SWIG/CMakeLists.txt @@ -0,0 +1,94 @@ +# Copyright (C) 2012-2019 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(${SWIG_USE_FILE}) + +# --- options --- +# additional include directories +INCLUDE_DIRECTORIES( + ${SHAPER_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${OpenCASCADE_INCLUDE_DIR} + ${KERNEL_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/src/CXX +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${OpenCASCADE_DEFINITIONS} + ${OMNIORB_DEFINITIONS} + ${PYTHON_DEFINITIONS} +) + +# libraries to link to +SET(_link_LIBRARIES +) + +# --- headers --- + +# header files / to be processed by moc +SET(SHAPERSTUDY_Swig_HEADERS +) + +# --- sources --- + +# sources / static +SET(SHAPERSTUDY_Swig_SOURCES + SHAPERSTUDY_Swig.i + ${SHAPERSTUDY_Swig_HEADERS} +) + +# workaround about SWIG_ADD_MODULE bug: remove duplicates in include directories +GET_DIRECTORY_PROPERTY(_cmake_include_directories INCLUDE_DIRECTORIES) +LIST(REMOVE_DUPLICATES _cmake_include_directories) +SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${_cmake_include_directories}") + +# swig flags +SET_SOURCE_FILES_PROPERTIES(SHAPERSTUDY_Swig.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(SHAPERSTUDY_Swig.i PROPERTIES SWIG_FLAGS "-py3") +SET_SOURCE_FILES_PROPERTIES(SHAPERSTUDY_swig_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H") + +# --- scripts --- + +# scripts / swig wrappings +SET(_swig_SCRIPTS + ${CMAKE_CURRENT_BINARY_DIR}/SHAPERSTUDY_Swig.py +) + +# --- rules --- +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(SHAPERSTUDY_Swig python ${SHAPERSTUDY_Swig_SOURCES}) +ELSE() + SWIG_ADD_LIBRARY(SHAPERSTUDY_Swig LANGUAGE python SOURCES ${SHAPERSTUDY_Swig_SOURCES}) +ENDIF() + + +SWIG_LINK_LIBRARIES(SHAPERSTUDY_Swig ${_link_LIBRARIES}) +SWIG_CHECK_GENERATION(SHAPERSTUDY_Swig) +IF(WIN32) + SET_TARGET_PROPERTIES(_SHAPERSTUDY_Swig PROPERTIES DEBUG_OUTPUT_NAME _SHAPERSTUDY_Swig_d) +ENDIF(WIN32) + +INSTALL(TARGETS _SHAPERSTUDY_Swig DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${SHAPERSTUDY_Swig_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) + +SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_SHAPERSTUDY_Swig_REAL_NAME}") diff --git a/test/test0.py b/test/test0.py new file mode 100644 index 0000000..d01f5fa --- /dev/null +++ b/test/test0.py @@ -0,0 +1,16 @@ +# test module loading. Throw this test away +import salome +salome.salome_init() + +from SHAPERSTUDY_utils import getEngine +import SHAPERSTUDY_Field +import SHAPERSTUDY_IOperations +import SHAPERSTUDY_Object + +gen = getEngine() +print(gen) + +gen.GetAllDumpNames() +gen.GetDumpName('a') + + -- 2.39.2