mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-16 23:07:55 +05:00
Compare commits
236 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f897399166 | ||
![]() |
3dada3ac1c | ||
![]() |
3628387a8b | ||
![]() |
d77455bec0 | ||
![]() |
386c243bd1 | ||
![]() |
419b248e23 | ||
![]() |
0c82f25ea9 | ||
![]() |
42b1e5a1ea | ||
![]() |
1e56cfc237 | ||
![]() |
4698ac46c4 | ||
![]() |
512bf4c67a | ||
![]() |
67feb126ff | ||
![]() |
0d99124b62 | ||
![]() |
086dfca578 | ||
![]() |
ad427fadef | ||
![]() |
c4da8107c8 | ||
![]() |
55b640ee17 | ||
![]() |
78d008f3a2 | ||
![]() |
d72c6cd028 | ||
![]() |
ae49976071 | ||
![]() |
1bcfb1186e | ||
![]() |
fbbd6a9e07 | ||
![]() |
5e34fe0812 | ||
![]() |
ec3ebbe891 | ||
![]() |
5f12362860 | ||
![]() |
0f3f338dc8 | ||
![]() |
981c0534ea | ||
![]() |
bbafce4b04 | ||
![]() |
20db2ca25d | ||
![]() |
c13ae14b5a | ||
![]() |
14e1a694c4 | ||
![]() |
e3ce834889 | ||
![]() |
3bfb88115e | ||
![]() |
aecc16bb84 | ||
![]() |
e067674b75 | ||
![]() |
c52059c3f8 | ||
![]() |
6395ebefdf | ||
![]() |
f7a34e7081 | ||
![]() |
a501322551 | ||
![]() |
efb533a09c | ||
![]() |
221a1f9cef | ||
![]() |
d2ccc47fec | ||
![]() |
071708e71c | ||
![]() |
d07da73210 | ||
![]() |
1e6d06f174 | ||
![]() |
d617faae6b | ||
![]() |
e8fc8b6907 | ||
![]() |
09ece3edc1 | ||
![]() |
c1d63ef1f8 | ||
![]() |
9473f01eac | ||
![]() |
7725eb65c0 | ||
![]() |
132bafd2dc | ||
![]() |
cfc267474f | ||
![]() |
9b8d462a3d | ||
![]() |
4823245056 | ||
![]() |
611d40ba2a | ||
![]() |
e06f87b076 | ||
![]() |
ddba456747 | ||
![]() |
5a3993c7b0 | ||
![]() |
c586fe244b | ||
![]() |
9f73090059 | ||
![]() |
901ba4f298 | ||
![]() |
1c82b096f9 | ||
![]() |
fe14e2fc44 | ||
![]() |
922cc08eea | ||
![]() |
63e04ef7a7 | ||
![]() |
78d08f2f51 | ||
![]() |
5ff491732f | ||
![]() |
656b91bf45 | ||
![]() |
abd699810f | ||
![]() |
fe6ea9b095 | ||
![]() |
7c90108313 | ||
![]() |
db6a6a7fe5 | ||
![]() |
888b3b52e1 | ||
![]() |
66be812a4e | ||
![]() |
be1d76dd6a | ||
![]() |
75780cdf0f | ||
![]() |
f190cc9ae6 | ||
![]() |
89b8ea7bd7 | ||
![]() |
bb74bfbe1e | ||
![]() |
46676347f2 | ||
![]() |
a3eca73f94 | ||
![]() |
de644ac6fe | ||
![]() |
e6d054cfcd | ||
![]() |
66a2554913 | ||
![]() |
ade417c569 | ||
![]() |
335b028279 | ||
![]() |
1b56fc0813 | ||
![]() |
c00b6875b6 | ||
![]() |
b6f0965afb | ||
![]() |
cdb4ec65a7 | ||
![]() |
4598d83cc4 | ||
![]() |
23463956b0 | ||
![]() |
a847e2c649 | ||
![]() |
0dc7370a1a | ||
![]() |
736d34a14f | ||
![]() |
a775d71f3f | ||
![]() |
e3980c1c79 | ||
![]() |
ac075ee14b | ||
![]() |
8bd22224ca | ||
![]() |
c6dad39806 | ||
![]() |
79d9367898 | ||
![]() |
f504886648 | ||
![]() |
807a056cd8 | ||
![]() |
15ca7707dd | ||
![]() |
58bfedf8f6 | ||
![]() |
8df37edc3d | ||
![]() |
d3582bad2b | ||
![]() |
81ba4eae5b | ||
![]() |
93082a7c84 | ||
![]() |
71b630d73e | ||
![]() |
4bd9a6f6fe | ||
![]() |
9fddcc1f36 | ||
![]() |
8a3c509833 | ||
![]() |
6a0d013cc0 | ||
![]() |
8db1e932e3 | ||
![]() |
d6f16273ad | ||
![]() |
8d33dd3a86 | ||
![]() |
8d26af3d7b | ||
![]() |
f4e6b4a197 | ||
![]() |
2bfc3d1007 | ||
![]() |
8687a56839 | ||
![]() |
f9cf20ad5b | ||
![]() |
ef169a51e2 | ||
![]() |
22d3109060 | ||
![]() |
25a3dc9150 | ||
![]() |
016f03aaff | ||
![]() |
5d251af706 | ||
![]() |
656de216bc | ||
![]() |
4048b73d92 | ||
![]() |
7dbab99806 | ||
![]() |
ee9734889c | ||
![]() |
064bf22985 | ||
![]() |
f26bc594ae | ||
![]() |
923a73f295 | ||
![]() |
e416f88e14 | ||
![]() |
d7d68d8f96 | ||
![]() |
686c7023c5 | ||
![]() |
26386f270f | ||
![]() |
81eb14d320 | ||
![]() |
cb793ede66 | ||
![]() |
b980fc7fda | ||
![]() |
30bf08e12b | ||
![]() |
1405980f7e | ||
![]() |
ea9614aed9 | ||
![]() |
1f04a1ae85 | ||
![]() |
b5f99c472c | ||
![]() |
57e4a74870 | ||
![]() |
5dfdaa8e0b | ||
![]() |
496aa6dc0f | ||
![]() |
6fbe1acba9 | ||
![]() |
bbdad62780 | ||
![]() |
665d9f4816 | ||
![]() |
95c850c1c0 | ||
![]() |
fde5bbfe1c | ||
![]() |
23d3a9b07a | ||
![]() |
08f4a1d3d5 | ||
![]() |
2a3778cbc2 | ||
![]() |
7cd67a0174 | ||
![]() |
090649639c | ||
![]() |
11cbc17d51 | ||
![]() |
01ead53342 | ||
![]() |
8647067a5b | ||
![]() |
5088f18afd | ||
![]() |
dd7a8e88ba | ||
![]() |
c6482451ab | ||
![]() |
fcc928b687 | ||
![]() |
822c54d232 | ||
![]() |
436cccec5f | ||
![]() |
49fd9a6330 | ||
![]() |
535033fcd5 | ||
![]() |
c94d2e489e | ||
![]() |
bb27da6b38 | ||
![]() |
150483de56 | ||
![]() |
1c03b6900c | ||
![]() |
df260abc61 | ||
![]() |
39f7977c42 | ||
![]() |
13b2d4d02d | ||
![]() |
47c785f741 | ||
![]() |
54a5d9072f | ||
![]() |
43c219aae9 | ||
![]() |
ed0f1a6b82 | ||
![]() |
125a3a0c88 | ||
![]() |
16eda1b07a | ||
![]() |
2ea12bde89 | ||
![]() |
d05f7ac43d | ||
![]() |
7c35075817 | ||
![]() |
f1da3f8ded | ||
![]() |
e2fe8c1360 | ||
![]() |
63cf6cca2e | ||
![]() |
d07a864e83 | ||
![]() |
b654dab419 | ||
![]() |
e87935b0f9 | ||
![]() |
4784596a38 | ||
![]() |
6f0f4ed5d1 | ||
![]() |
c9d3c88044 | ||
![]() |
627494a5b0 | ||
![]() |
48e4c0a02d | ||
![]() |
33502d28ed | ||
![]() |
000dfcbd77 | ||
![]() |
004cf4db73 | ||
![]() |
eb232fee26 | ||
![]() |
efa7eecc97 | ||
![]() |
3b33c84634 | ||
![]() |
9f557687e2 | ||
![]() |
ca407fcec6 | ||
![]() |
9c7a707978 | ||
![]() |
9157430337 | ||
![]() |
3256455164 | ||
![]() |
5410290368 | ||
![]() |
ee3393d541 | ||
![]() |
25c737135e | ||
![]() |
6c3f954171 | ||
![]() |
2940ca79a8 | ||
![]() |
aa818f57a9 | ||
![]() |
485d7cea0a | ||
![]() |
8e439e4b0a | ||
![]() |
175b357b21 | ||
![]() |
a41868ac87 | ||
![]() |
2f5ed2c56a | ||
![]() |
fa02ef2a4f | ||
![]() |
4558fc1b44 | ||
![]() |
991d2a1931 | ||
![]() |
64c20fc0e7 | ||
![]() |
cccc6496b1 | ||
![]() |
6fc8283dbb | ||
![]() |
7d2c08f06a | ||
![]() |
bfd48ef62a | ||
![]() |
3d5efd4572 | ||
![]() |
ac813fd986 | ||
![]() |
d6f1d8730f | ||
![]() |
96bab5d2a8 | ||
![]() |
7f0efc8881 | ||
![]() |
d90d0665f7 | ||
![]() |
1aa43a9db3 | ||
![]() |
b6fca18ac3 |
97
CMakeLists.txt
Executable file → Normal file
97
CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2013-2017 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2013-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -19,41 +19,43 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
|
||||
INCLUDE(CMakeDependentOption)
|
||||
|
||||
# Project name
|
||||
# ============
|
||||
# original
|
||||
PROJECT(SalomeGEOM C CXX)
|
||||
|
||||
# Ensure a proper linker behavior:
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
IF(WIN32)
|
||||
CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Versioning
|
||||
# ===========
|
||||
# Project name, upper case
|
||||
# upper case
|
||||
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
|
||||
|
||||
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
|
||||
SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
|
||||
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 0)
|
||||
|
||||
# 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)
|
||||
INCLUDE(SalomeMacros NO_POLICY_SCOPE)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
|
||||
ENDIF()
|
||||
|
||||
# Versioning
|
||||
# ===========
|
||||
SALOME_SETUP_VERSION(9.13.0)
|
||||
MESSAGE(STATUS "Building ${PROJECT_NAME_UC} ${${PROJECT_NAME_UC}_VERSION} from \"${${PROJECT_NAME_UC}_GIT_SHA1}\"")
|
||||
|
||||
# Find SalomeBootstrap
|
||||
# ===========
|
||||
SET(SALOMEBOOTSTRAP_ROOT_DIR $ENV{SALOMEBOOTSTRAP_ROOT_DIR} CACHE PATH "Path to the Salome Bootstrap")
|
||||
IF(EXISTS ${SALOMEBOOTSTRAP_ROOT_DIR})
|
||||
FIND_PACKAGE(SalomeBootstrap REQUIRED)
|
||||
ADD_DEFINITIONS(${SALOMEBOOTSTRAP_DEFINITIONS})
|
||||
INCLUDE_DIRECTORIES(${SALOMEBOOTSTRAP_INCLUDE_DIRS})
|
||||
ELSE(EXISTS ${SALOMEBOOTSTRAP_ROOT_DIR})
|
||||
MESSAGE(FATAL_ERROR "We absolutely need a Salome Bootstrap, please define SALOMEBOOTSTRAP_ROOT_DIR")
|
||||
ENDIF(EXISTS ${SALOMEBOOTSTRAP_ROOT_DIR})
|
||||
|
||||
# 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")
|
||||
FIND_PACKAGE(SalomeKERNEL REQUIRED)
|
||||
KERNEL_WITH_CORBA() #check whether KERNEL built with CORBA
|
||||
ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
|
||||
@ -67,8 +69,6 @@ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
|
||||
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
|
||||
# ============
|
||||
@ -103,6 +103,7 @@ FIND_PACKAGE(SalomeOmniORB REQUIRED)
|
||||
FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
|
||||
FIND_PACKAGE(SalomeLibXml2 REQUIRED)
|
||||
FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C)
|
||||
FIND_PACKAGE(Eigen3 3.2.5 REQUIRED)
|
||||
|
||||
# Other KERNEL optionals:
|
||||
IF(SALOME_BUILD_TESTS)
|
||||
@ -121,10 +122,9 @@ ENDIF()
|
||||
IF(SALOME_BUILD_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)
|
||||
SALOME_GUI_WITH_CORBA() #check whether GUI built with CORBA
|
||||
SALOME_GUI_MODE(SALOME_USE_OCCVIEWER SALOME_USE_VTKVIEWER SALOME_USE_SALOMEOBJECT
|
||||
SALOME_GUI_MODE(SALOME_USE_OCCVIEWER SALOME_USE_VTKVIEWER SALOME_USE_PV3DVIEWER SALOME_USE_SALOMEOBJECT
|
||||
OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_PYCONSOLE)
|
||||
ADD_DEFINITIONS(${GUI_DEFINITIONS})
|
||||
INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
|
||||
@ -139,17 +139,10 @@ ENDIF(SALOME_BUILD_GUI)
|
||||
##
|
||||
|
||||
IF(SALOME_BUILD_GUI)
|
||||
IF(NOT SALOME_GUI_BUILD_WITH_QT5)
|
||||
# Qt
|
||||
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
|
||||
# PyQt
|
||||
FIND_PACKAGE(SalomePyQt4 REQUIRED)
|
||||
ELSE()
|
||||
# Qt
|
||||
FIND_PACKAGE(SalomeQt5 REQUIRED)
|
||||
# PyQt
|
||||
FIND_PACKAGE(SalomePyQt5 REQUIRED)
|
||||
ENDIF()
|
||||
# Qt
|
||||
FIND_PACKAGE(SalomeQt5 REQUIRED)
|
||||
# PyQt
|
||||
FIND_PACKAGE(SalomePyQt5 REQUIRED)
|
||||
ENDIF(SALOME_BUILD_GUI)
|
||||
|
||||
##
|
||||
@ -158,6 +151,13 @@ ENDIF(SALOME_BUILD_GUI)
|
||||
|
||||
FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
|
||||
|
||||
SET(CommonGeomLib_ROOT_DIR $ENV{CommonGeomLib_ROOT_DIR} CACHE PATH "Path to the CommonGeomLib tool")
|
||||
IF(EXISTS ${CommonGeomLib_ROOT_DIR})
|
||||
FIND_PACKAGE(SalomeCommonGeomLib REQUIRED)
|
||||
ELSE(EXISTS ${CommonGeomLib_ROOT_DIR})
|
||||
MESSAGE(FATAL_ERROR "We absolutely need the CommonGeomLib tool, please define CommonGeomLib_ROOT_DIR !")
|
||||
ENDIF(EXISTS ${CommonGeomLib_ROOT_DIR})
|
||||
|
||||
IF(SALOME_GEOM_USE_VTK)
|
||||
FIND_PACKAGE(SalomeVTK REQUIRED)
|
||||
ADD_DEFINITIONS(-DWITH_VTK)
|
||||
@ -219,6 +219,16 @@ SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOM
|
||||
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED})
|
||||
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
|
||||
|
||||
# For salome test
|
||||
# ===============
|
||||
SET(GEOM_TEST_DIR ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
|
||||
IF(SALOME_BUILD_TESTS)
|
||||
CONFIGURE_FILE(CTestTestfileInstall.cmake.in CTestTestfileInstall.cmake @ONLY)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake
|
||||
DESTINATION ${GEOM_TEST_DIR}
|
||||
RENAME CTestTestfile.cmake)
|
||||
ENDIF()
|
||||
|
||||
# Sources
|
||||
# ========
|
||||
ADD_SUBDIRECTORY(idl)
|
||||
@ -227,13 +237,13 @@ ADD_SUBDIRECTORY(adm_local)
|
||||
ADD_SUBDIRECTORY(resources)
|
||||
ADD_SUBDIRECTORY(bin)
|
||||
ADD_SUBDIRECTORY(src)
|
||||
IF(SALOME_BUILD_DOC)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
IF(SALOME_BUILD_TESTS)
|
||||
ADD_SUBDIRECTORY(test)
|
||||
ENDIF()
|
||||
|
||||
# Header configuration
|
||||
# ====================
|
||||
SALOME_XVERSION(${PROJECT_NAME})
|
||||
SALOME_CONFIGURE_FILE(GEOM_version.h.in GEOM_version.h INSTALL ${SALOME_INSTALL_HEADERS})
|
||||
|
||||
# Configuration export
|
||||
@ -287,19 +297,21 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
|
||||
SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
|
||||
SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
|
||||
SET(OPENCASCADE_ROOT_DIR "${OPENCASCADE_ROOT_DIR}")
|
||||
SET(CommonGeomLib_ROOT_DIR "${CommonGeomLib_ROOT_DIR}")
|
||||
SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
|
||||
SET(OPENCV_ROOT_DIR "${OPENCV_ROOT_DIR}")
|
||||
|
||||
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
|
||||
|
||||
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
|
||||
SALOME_CONFIGURE_PREPARE(OpenCV OpenCASCADE VTK)
|
||||
SALOME_CONFIGURE_PREPARE(OpenCV OpenCASCADE CommonGeomLib VTK)
|
||||
|
||||
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
|
||||
KERNEL_ROOT_DIR GUI_ROOT_DIR OPENCASCADE_ROOT_DIR VTK_ROOT_DIR OPENCV_ROOT_DIR)
|
||||
KERNEL_ROOT_DIR GUI_ROOT_DIR OPENCASCADE_ROOT_DIR CommonGeomLib_ROOT_DIR
|
||||
VTK_ROOT_DIR OPENCV_ROOT_DIR)
|
||||
|
||||
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
|
||||
# Get the relative path of the include directory so
|
||||
@ -324,8 +336,3 @@ INSTALL(FILES
|
||||
# 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)
|
||||
|
||||
# Application tests
|
||||
INSTALL(FILES CTestTestfileInstall.cmake
|
||||
DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test
|
||||
RENAME CTestTestfile.cmake)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2017 CEA/DEN, EDF R&D
|
||||
# Copyright (C) 2017-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -17,10 +17,11 @@
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
|
||||
SET(OpenCASCADE_VERSION @OpenCASCADE_VERSION@)
|
||||
SET(OpenCASCADE_SP_VERSION @OpenCASCADE_SP_VERSION@)
|
||||
|
||||
SET(PYTHON_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/python_test_driver.py")
|
||||
SET(COMPONENT_NAME GEOM)
|
||||
SET(TIMEOUT 300)
|
||||
|
||||
SUBDIRS(examples)
|
||||
SUBDIRS(xao)
|
||||
SUBDIRS(examples xao other)
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
|
12
README
12
README
@ -13,7 +13,7 @@ SALOME Geometry module implements the CAD modeling services:
|
||||
|
||||
For more information please visit the SALOME platform web site:
|
||||
|
||||
<http://www.salome-platform.org/>
|
||||
<https://www.salome-platform.org/>
|
||||
|
||||
=======
|
||||
License
|
||||
@ -22,10 +22,6 @@ 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:
|
||||
|
||||
<http://www.salome-platform.org/downloads/license/>
|
||||
|
||||
============
|
||||
Installation
|
||||
============
|
||||
@ -42,11 +38,7 @@ site:
|
||||
|
||||
* Check Release Notes and Software Requirements of the latest SALOME release at
|
||||
|
||||
<http://www.salome-platform.org/downloads/current-version/>
|
||||
|
||||
* Pre-requisites page at SALOME web site:
|
||||
|
||||
<http://www.salome-platform.org/downloads/license/>
|
||||
<https://github.com/SalomePlatform/.github/wiki/SAT/>
|
||||
|
||||
Note: SALOME Geometry module needs SALOME KERNEL and SALOME GUI as
|
||||
pre-requisites.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2013-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
2
adm_local/CMakeLists.txt
Executable file → Normal file
2
adm_local/CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
|
2
adm_local/unix/CMakeLists.txt
Executable file → Normal file
2
adm_local/unix/CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
2
adm_local/unix/config_files/CMakeLists.txt
Executable file → Normal file
2
adm_local/unix/config_files/CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
|
@ -1,4 +1,4 @@
|
||||
dnl Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
dnl Copyright (C) 2007-2024 CEA, EDF, 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
|
||||
|
2
adm_local/unix/config_files/check_GUI.m4
Executable file → Normal file
2
adm_local/unix/config_files/check_GUI.m4
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
dnl Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
dnl Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
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
|
||||
|
@ -1,4 +1,4 @@
|
||||
dnl Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
dnl Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
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
|
||||
|
2
bin/CMakeLists.txt
Executable file → Normal file
2
bin/CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2012-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
1
bin/VERSION.in
Executable file → Normal file
1
bin/VERSION.in
Executable file → Normal file
@ -1,3 +1,4 @@
|
||||
[SALOME GEOM] : @SALOMEGEOM_VERSION@
|
||||
[DEVELOPMENT] : @SALOMEGEOM_VERSION_DEV@
|
||||
[DESCRIPTION] : SALOME Geometry module
|
||||
[SHA1] : @SALOMEGEOM_GIT_SHA1@
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env python3
|
||||
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2018 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2018-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
2
doc/CMakeLists.txt
Executable file → Normal file
2
doc/CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
|
8
doc/salome/CMakeLists.txt
Executable file → Normal file
8
doc/salome/CMakeLists.txt
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
@ -20,6 +20,8 @@
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(tui)
|
||||
ADD_SUBDIRECTORY(gui)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
IF(SALOME_BUILD_DOC)
|
||||
ADD_SUBDIRECTORY(tui)
|
||||
ADD_SUBDIRECTORY(gui)
|
||||
ENDIF()
|
||||
|
7
doc/salome/examples/0README
Normal file
7
doc/salome/examples/0README
Normal file
@ -0,0 +1,7 @@
|
||||
This folder contains example Python scripts which are used in the documentation of Geometry module,
|
||||
i.e. those mentioned in *.doc files in {root_src}/doc/salome/gui/GEOM/input folder.
|
||||
|
||||
These tests are exported into the ${GEOM_ROOT_DIR}/share/doc/salome/examples/GEOM folder and can be
|
||||
executed with the `salome test` command, as a part of whole testing procedure.
|
||||
|
||||
Other Python scripts aimed for testing purposes must be put into the ${root_src}/test folder!
|
@ -1,7 +1,7 @@
|
||||
# 3D Sketcher
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2007-2017 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -19,31 +19,36 @@
|
||||
|
||||
INCLUDE(tests.set)
|
||||
|
||||
SET(TEST_REINIT_SALOME "False")
|
||||
SALOME_CONFIGURE_FILE(tests.py.in tests.py)
|
||||
SET(TEST_INSTALL_DIRECTORY ${GEOM_TEST_DIR}/examples)
|
||||
SET(EXAMPLES_INSTALL_DIRECTORY ${SALOME_INSTALL_DOC}/examples/GEOM)
|
||||
|
||||
SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
|
||||
IF(SALOME_BUILD_TESTS)
|
||||
|
||||
# Install 'salome test' staff
|
||||
# ---------------------------
|
||||
|
||||
INSTALL(FILES CTestTestfileInstall.cmake
|
||||
DESTINATION ${TEST_INSTALL_DIRECTORY}
|
||||
RENAME CTestTestfile.cmake)
|
||||
INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||
|
||||
# Add tests for 'make test'
|
||||
# -------------------------
|
||||
|
||||
SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
|
||||
|
||||
IF(GEOM_JOIN_TESTS)
|
||||
ADD_TEST(NAME GEOM_examples COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py tests.py)
|
||||
ELSE(GEOM_JOIN_TESTS)
|
||||
FOREACH(test ${GOOD_TESTS})
|
||||
GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
|
||||
ADD_TEST(NAME ${testname}
|
||||
COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${test})
|
||||
SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
|
||||
COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/test/test_helper.py ${CMAKE_CURRENT_SOURCE_DIR}/${test})
|
||||
SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}" LABELS "examples")
|
||||
ENDFOREACH()
|
||||
ENDIF(GEOM_JOIN_TESTS)
|
||||
|
||||
# install Python scripts
|
||||
SALOME_INSTALL_SCRIPTS("${EXAMPLES_TESTS}" ${SALOME_INSTALL_DOC}/examples/GEOM)
|
||||
ENDIF()
|
||||
|
||||
# Application tests
|
||||
# Install example scripts and data
|
||||
# --------------------------------
|
||||
|
||||
SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/examples)
|
||||
INSTALL(FILES ${GOOD_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||
|
||||
INSTALL(FILES CTestTestfileInstall.cmake
|
||||
DESTINATION ${TEST_INSTALL_DIRECTORY}
|
||||
RENAME CTestTestfile.cmake)
|
||||
INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||
IF(SALOME_BUILD_TESTS OR SALOME_BUILD_DOC)
|
||||
INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} DESTINATION ${EXAMPLES_INSTALL_DIRECTORY})
|
||||
ENDIF()
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2015-2017 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
# Copyright (C) 2015-2024 CEA, EDF, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@ -17,11 +17,13 @@
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
SET(SCRIPTS_DIR "../../../../share/doc/salome/examples/GEOM")
|
||||
|
||||
INCLUDE(tests.set)
|
||||
|
||||
FOREACH(tfile ${GOOD_TESTS})
|
||||
GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE)
|
||||
SET(TEST_NAME GEOM_${BASE_NAME})
|
||||
ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile})
|
||||
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
|
||||
SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME})
|
||||
ADD_TEST(${TEST_NAME} python ${PYTHON_TEST_DRIVER} ${TIMEOUT} ${SCRIPTS_DIR}/${tfile})
|
||||
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME};${COMPONENT_NAME}_examples")
|
||||
ENDFOREACH()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Geom Field
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,6 +1,6 @@
|
||||
# --- salome initialization
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
|
||||
# --- geom Python interface
|
||||
import GEOM
|
||||
|
212
doc/salome/examples/XYZ_to_UV.py
Normal file
212
doc/salome/examples/XYZ_to_UV.py
Normal file
@ -0,0 +1,212 @@
|
||||
# Test XYZtoUV and UVtoXYZ methods
|
||||
|
||||
import salome
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
toler = 1e-04
|
||||
|
||||
# Create "Horse saddle"
|
||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0, 'OX')
|
||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0, 'OY')
|
||||
Sphere_1 = geompy.MakeSphereR(100, 'Sphere_1')
|
||||
[Edge_1,Edge_2,Edge_3] = geompy.ExtractShapes(Sphere_1, geompy.ShapeType["EDGE"], True)
|
||||
geompy.addToStudyInFather( Sphere_1, Edge_1, 'Edge_1' )
|
||||
geompy.addToStudyInFather( Sphere_1, Edge_2, 'Edge_2' )
|
||||
geompy.addToStudyInFather( Sphere_1, Edge_3, 'Edge_3' )
|
||||
|
||||
Rotation_1 = geompy.MakeRotation(Edge_3, OX, 90*math.pi/180.0, 'Rotation_1')
|
||||
Rotation_2 = geompy.MakeRotation(Rotation_1, OY, 180*math.pi/180.0, 'Rotation_2')
|
||||
Translation_1 = geompy.MakeTranslation(Rotation_2, 200, 0, 0, 'Translation_1')
|
||||
Translation_2 = geompy.MakeTranslation(Edge_3, 100, 100, 0, 'Translation_2')
|
||||
Translation_3 = geompy.MakeTranslation(Translation_2, 0, -200, 0, 'Translation_3')
|
||||
|
||||
Filling_1 = geompy.MakeFilling([Translation_2, Edge_3, Translation_3])
|
||||
geompy.addToStudy(Filling_1, 'Filling_1')
|
||||
|
||||
HorseSaddle = geompy.LimitTolerance(Filling_1, toler, 'HorseSaddle')
|
||||
|
||||
# Get 100 equidistant points on the "Horse saddle"
|
||||
CompoundOfVertices = geompy.MakeVertexInsideFace(HorseSaddle, 100, "CompoundOfVertices")
|
||||
assert(geompy.NumberOfSubShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"]) == 100)
|
||||
|
||||
# Extract the vertices
|
||||
listOfVertices = geompy.ExtractShapes(CompoundOfVertices, geompy.ShapeType["VERTEX"], True)
|
||||
|
||||
# Get list of coordinates of all 100 vertices
|
||||
listOfCoords = []
|
||||
for aV in listOfVertices:
|
||||
listOfCoords += geompy.PointCoordinates(aV)
|
||||
pass
|
||||
|
||||
# Test 1: with normalization of parameters
|
||||
|
||||
# Convert XYZ to UV
|
||||
listOfParams_norm = geompy.XYZtoUV(HorseSaddle, listOfCoords, True)
|
||||
assert(len(listOfParams_norm) == 200)
|
||||
|
||||
# Convert UV to XYZ
|
||||
listOfCoords_new1 = geompy.UVtoXYZ(HorseSaddle, listOfParams_norm, True)
|
||||
assert(len(listOfCoords_new1) == 300)
|
||||
|
||||
# Compare listOfCoords_new with listOfCoords
|
||||
for (c1, c2) in zip(listOfCoords, listOfCoords_new1):
|
||||
assert(abs(c1 - c2) < toler)
|
||||
pass
|
||||
|
||||
# Test 2: without normalization of parameters
|
||||
|
||||
# Convert XYZ to UV
|
||||
listOfParams = geompy.XYZtoUV(HorseSaddle, listOfCoords, False)
|
||||
assert(len(listOfParams) == 200)
|
||||
|
||||
# Convert UV to XYZ
|
||||
listOfCoords_new2 = geompy.UVtoXYZ(HorseSaddle, listOfParams, False)
|
||||
assert(len(listOfCoords_new2) == 300)
|
||||
|
||||
# Compare listOfCoords_new with listOfCoords
|
||||
for (c1, c2) in zip(listOfCoords, listOfCoords_new2):
|
||||
assert(abs(c1 - c2) < toler)
|
||||
pass
|
||||
|
||||
# Test 3: Check exceptions throwing if point (XYZ or UV) is out of face
|
||||
listXYZ_3 = listOfCoords[:3]
|
||||
listXYZ_3[2] = listXYZ_3[2] + 1.0 # move along OZ
|
||||
try:
|
||||
geompy.XYZtoUV(HorseSaddle, listXYZ_3, True)
|
||||
except RuntimeError:
|
||||
print(geompy.MeasuOp.GetErrorCode(), ", it's OK")
|
||||
pass
|
||||
except Exception:
|
||||
assert False, 'Unexpected exception raised'
|
||||
else:
|
||||
assert False, 'XYZtoUV should raise an exception if input point is out of face'
|
||||
|
||||
listUV_2 = [2, 2] # each parameter value should be in [0,1] range (for normalized case)
|
||||
try:
|
||||
geompy.UVtoXYZ(HorseSaddle, listUV_2, True)
|
||||
except RuntimeError:
|
||||
print(geompy.MeasuOp.GetErrorCode(), ", it's OK")
|
||||
pass
|
||||
except Exception:
|
||||
assert False, 'Unexpected exception raised'
|
||||
else:
|
||||
assert False, 'UVtoXYZ should raise an exception if input parameters are out of face'
|
||||
|
||||
# parameter U should be in [4.71239, 7.85398] range (on this face, for not normalized case)
|
||||
# parameter V should be in [0, 1] range (on this face, for not normalized case)
|
||||
listUV_2 = [10, 10]
|
||||
try:
|
||||
geompy.UVtoXYZ(HorseSaddle, listUV_2, True)
|
||||
except RuntimeError:
|
||||
print(geompy.MeasuOp.GetErrorCode(), ", it's OK")
|
||||
pass
|
||||
except Exception:
|
||||
assert False, 'Unexpected exception raised'
|
||||
else:
|
||||
assert False, 'UVtoXYZ should raise an exception if input parameters are out of face'
|
||||
|
||||
# Test 4: Check exceptions in case of invalid data type (wrong length of array or type of elements)
|
||||
|
||||
# 1. Length of input array is not divisible by 3 (for XYZtoUV) or by 2 (for UVtoXYZ)
|
||||
listXYZ_4 = listOfCoords[:4]
|
||||
assert(len(listXYZ_4) == 4)
|
||||
try:
|
||||
geompy.XYZtoUV(HorseSaddle, listXYZ_4, True)
|
||||
except RuntimeError:
|
||||
print(geompy.MeasuOp.GetErrorCode(), ", it's OK")
|
||||
pass
|
||||
except Exception:
|
||||
assert False, 'Unexpected exception raised'
|
||||
else:
|
||||
assert False, 'XYZtoUV should raise an exception if input list length is not divisible by 3'
|
||||
|
||||
listUV_3 = listOfParams[:3]
|
||||
assert(len(listUV_3) == 3)
|
||||
try:
|
||||
geompy.UVtoXYZ(HorseSaddle, listUV_3, True)
|
||||
except RuntimeError:
|
||||
print(geompy.MeasuOp.GetErrorCode(), ", it's OK")
|
||||
pass
|
||||
except Exception:
|
||||
assert False, 'Unexpected exception raised'
|
||||
else:
|
||||
assert False, 'UVtoXYZ should raise an exception if input list length is not divisible by 2'
|
||||
|
||||
# 2. Input array contains data of wrong type
|
||||
listXYZ_w = ['a', 'b', 'c']
|
||||
try:
|
||||
geompy.XYZtoUV(HorseSaddle, listXYZ_w, True)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
assert False, 'XYZtoUV should raise TypeError if input list contains not numerical data'
|
||||
|
||||
listXYZ_w = [10.0, '10.0', 10.0]
|
||||
try:
|
||||
geompy.XYZtoUV(HorseSaddle, listXYZ_w, True)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
assert False, 'XYZtoUV should raise TypeError if input list contains not numerical data'
|
||||
|
||||
listUV_w = ['a', 'b']
|
||||
try:
|
||||
geompy.UVtoXYZ(HorseSaddle, listUV_w, True)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
assert False, 'UVtoXYZ should raise TypeError if input list contains not numerical data'
|
||||
|
||||
listUV_w = [10.0, '10.0']
|
||||
try:
|
||||
geompy.UVtoXYZ(HorseSaddle, listUV_w, True)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
assert False, 'UVtoXYZ should raise TypeError if input list contains not numerical data'
|
||||
|
||||
# Test 5: a. Translate each of the 100 points by toler*2.0 along the face normal
|
||||
# and check that the XYZtoUV method fails by raising an exception.
|
||||
# b. Translate each of the 100 points by toler*0.7 along the face normal
|
||||
# and check that we obtain a result.
|
||||
for ii in range(100):
|
||||
# cc - coordinates of point #ii
|
||||
cc = listOfCoords[ii*3 : ii*3 + 3]
|
||||
|
||||
pnt = geompy.MakeVertex(cc[0], cc[1], cc[2])
|
||||
normal = geompy.GetNormal(HorseSaddle, pnt)
|
||||
vv = geompy.VectorCoordinates(normal)
|
||||
norm = np.linalg.norm(vv)
|
||||
if norm > toler:
|
||||
vec = vv / norm
|
||||
# a. Move cc by toler*2.0 (XYZtoUV should fail)
|
||||
pp_2tol = [cc[0] + vec[0]*toler*2.0,
|
||||
cc[1] + vec[1]*toler*2.0,
|
||||
cc[2] + vec[2]*toler*2.0]
|
||||
try:
|
||||
geompy.XYZtoUV(HorseSaddle, pp_2tol)
|
||||
except RuntimeError:
|
||||
pass
|
||||
except Exception:
|
||||
assert False, 'Unexpected exception raised'
|
||||
else:
|
||||
assert False, 'XYZtoUV should raise an exception if input point is out of face'
|
||||
pass
|
||||
|
||||
# b. Move cc by toler*0.7 (XYZtoUV should not fail)
|
||||
pp_07tol = [cc[0] + vec[0]*toler*0.7,
|
||||
cc[1] + vec[1]*toler*0.7,
|
||||
cc[2] + vec[2]*toler*0.7]
|
||||
UV_pp = geompy.XYZtoUV(HorseSaddle, pp_07tol, False)
|
||||
# compare with value from listOfParams (computed above)
|
||||
UV_cc = listOfParams[ii*2 : ii*2 + 2]
|
||||
for (c1, c2) in zip(UV_pp, UV_cc):
|
||||
assert(abs(c1 - c2) < toler)
|
||||
pass
|
||||
pass
|
||||
pass
|
@ -1,7 +1,7 @@
|
||||
# Creation of PipeTShape
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of DividedDisk
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of DividedCylinder
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Angle
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Using SALOME NoteBook
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Point
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Line
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Circle
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of an Ellipse
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of an Arc
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Curve
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Vector
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Plane
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Local Coordinate System
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Surface From Face
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
57
doc/salome/examples/basic_geom_objs_ex11.py
Normal file
57
doc/salome/examples/basic_geom_objs_ex11.py
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2022-2024 CEA, EDF
|
||||
#
|
||||
# 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 unittest
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
||||
class BasicGeomObjsEx11(unittest.TestCase):
|
||||
|
||||
def testNoRaiseOnMakeFaceWires(self):
|
||||
"""
|
||||
Work in pair with testRaiseOnMakeFaceWires
|
||||
"""
|
||||
pts = [(0,0,0),(1,0,0),(1,1,1e-6),(0,1,0)] # diff with testRaiseOnMakeFaceWires is 1e-6 instead of 1e-5
|
||||
vertices = [ geompy.MakeVertex(*list(elt)) for elt in pts]
|
||||
polyline0 = geompy.MakePolyline([ vertices[nodeidx] for nodeidx in range(len(pts)) ], True)
|
||||
wire_0 = geompy.MakeFaceWires( [ polyline0 ] , isPlanarWanted = True, theName=None, raiseException=True) # isPlanarWanted and raiseException are expected to be True here !
|
||||
self.assertTrue(wire_0) # wire_0 is expected to be not None because wire has been created and detected to be planar
|
||||
wire_1 = geompy.MakeFace( polyline0 , isPlanarWanted = True, theName=None, raiseException=True) # isPlanarWanted and raiseException are expected to be True here !
|
||||
self.assertTrue(wire_1)
|
||||
|
||||
def testRaiseOnMakeFaceWires(self):
|
||||
"""
|
||||
Work in pair with testNoRaiseOnMakeFaceWires
|
||||
"""
|
||||
pts = [(0,0,0),(1,0,0),(1,1,1e-5),(0,1,0)] # diff with testRaiseOnMakeFaceWires is 1e-5 instead of 1e-6
|
||||
vertices = [ geompy.MakeVertex(*list(elt)) for elt in pts]
|
||||
polyline0 = geompy.MakePolyline([ vertices[nodeidx] for nodeidx in range(len(pts)) ], True)
|
||||
# MakeFaceWires is expected to fail here because third point is too far from Oxy plane
|
||||
self.assertRaises( RuntimeError, geompy.MakeFaceWires, [ polyline0 ] , True, None, True )# isPlanarWanted and raiseException are expected to be True here !
|
||||
wire_0 = geompy.MakeFaceWires( [ polyline0 ] , isPlanarWanted = True, theName=None, raiseException=False) # returns something bug wire_0 is incorrect
|
||||
self.assertRaises( RuntimeError, geompy.MakeFace, polyline0 , True, None, True )# isPlanarWanted and raiseException are expected to be True here !
|
||||
wire_1 = geompy.MakeFace( polyline0 , isPlanarWanted = True, theName=None, raiseException=False) # returns something bug wire_1 is incorrect
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -1,7 +1,7 @@
|
||||
# Partition
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Archimede
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Restore presentation parameters and sub-shapes
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Get shared sub-shapes
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Basic Properties
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Multi Transformation
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Explode on Blocks
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Propagate
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Fuse
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Common
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Cut
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Section
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Bounding Box
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Quadrangle Face
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Hexagonal Solid
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Center of masses
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
56
doc/salome/examples/check_bop.py
Normal file
56
doc/salome/examples/check_bop.py
Normal file
@ -0,0 +1,56 @@
|
||||
# ExtractBOPFailure example
|
||||
|
||||
import math
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
||||
### Prepare shapes for Partition
|
||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0, theName="OX")
|
||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0, theName="OY")
|
||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1, theName="OZ")
|
||||
|
||||
Vertex_1 = geompy.MakeVertex(0, 0, 0, theName="Vertex_1")
|
||||
Vertex_2 = geompy.MakeVertex(10, 0, 0, theName="Vertex_2")
|
||||
Vertex_3 = geompy.MakeVertex(0, 0.005, 0, theName="Vertex_3")
|
||||
Vertex_4 = geompy.MakeVertex(10, 0.015, 0, theName="Vertex_4")
|
||||
Vertex_5 = geompy.MakeVertex(0, 0.02, 0, theName="Vertex_5")
|
||||
Vertex_6 = geompy.MakeVertex(10, 0.02, 0, theName="Vertex_6")
|
||||
|
||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2, theName="Line_1")
|
||||
Line_2 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4, theName="Line_2")
|
||||
Line_3 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6, theName="Line_3")
|
||||
|
||||
Extrusion_1 = geompy.MakePrismVecH(Line_1, OY, 1, theName="Extrusion_1")
|
||||
Extrusion_2 = geompy.MakePrismVecH(Line_2, OZ, 1, theName="Extrusion_2")
|
||||
Extrusion_3 = geompy.MakePrismVecH(Line_3, OY, -1, theName="Extrusion_3")
|
||||
|
||||
Limit_tolerance_1 = geompy.LimitTolerance(Extrusion_2, 0.01, theName="Limit_tolerance_1")
|
||||
|
||||
Extrusion_4 = geompy.MakePrismVecH(Extrusion_1, OZ, -1, theName="Extrusion_4")
|
||||
Extrusion_5 = geompy.MakePrismVecH(Extrusion_3, OZ, -1, theName="Extrusion_5")
|
||||
|
||||
Revolution_1 = geompy.MakeRevolution(Limit_tolerance_1, OX, 45*math.pi/180.0, theName="Revolution_1")
|
||||
|
||||
### Try Partition
|
||||
try :
|
||||
Partition_1 = geompy.MakePartition([Extrusion_4, Extrusion_5, Revolution_1], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0, theName="Partition_1")
|
||||
except :
|
||||
print("EXCEPTION: Partition problem")
|
||||
|
||||
### Extract failures
|
||||
(IsValid, ShapeRes, ShapeErrors) = geompy.ExtractBOPFailure([Extrusion_4, Extrusion_5, Revolution_1], theTimer=True, theVerbose=True, theName="InvalidBOPResult")
|
||||
|
||||
### Publish incriminated sub-shapes (reflect errors in their names)
|
||||
for shapeError in ShapeErrors:
|
||||
list_ids = shapeError.incriminated
|
||||
list_subs = geompy.SubShapes(ShapeRes, list_ids)
|
||||
ii = 1
|
||||
for subshape in list_subs:
|
||||
geompy.addToStudyInFather( ShapeRes, subshape, 'SubShape_with_%s_%d'%(str(shapeError.error),ii) )
|
||||
ii = ii+1
|
||||
|
||||
if salome.sg.hasDesktop():
|
||||
salome.sg.updateObjBrowser()
|
@ -1,7 +1,7 @@
|
||||
# Check Compound of Blocks
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
45
doc/salome/examples/check_conformity.py
Normal file
45
doc/salome/examples/check_conformity.py
Normal file
@ -0,0 +1,45 @@
|
||||
# Check Conformity
|
||||
|
||||
import salome
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
||||
O = geompy.MakeVertex(0, 0, 0)
|
||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||
Vertex_1 = geompy.MakeVertex(-30, -70, 0)
|
||||
Vertex_2 = geompy.MakeVertex(-30, 50, 0)
|
||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_1)
|
||||
Vertex_3 = geompy.MakeVertex(0, -50, 0)
|
||||
Vertex_4 = geompy.MakeVertex(-40, -10, 0)
|
||||
Vertex_5 = geompy.MakeVertex(0, 40, 0)
|
||||
Arc_1 = geompy.MakeArc(Vertex_5, Vertex_4, Vertex_3)
|
||||
Vertex_6 = geompy.MakeVertex(10, -50, 4)
|
||||
Vertex_7 = geompy.MakeVertex(10, -50, 10)
|
||||
Vertex_8 = geompy.MakeVertex(10, 40, 10)
|
||||
Arc_1_vertex_3 = geompy.GetSubShape(Arc_1, [3])
|
||||
Line_2 = geompy.MakeLineTwoPnt(Arc_1_vertex_3, Vertex_6)
|
||||
Line_3 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_7)
|
||||
Line_4 = geompy.MakeLineTwoPnt(Vertex_7, Vertex_8)
|
||||
Vertex_9 = geompy.MakeVertex(15, 40, 10)
|
||||
Vertex_10 = geompy.MakeVertex(17, 0, 6)
|
||||
Vertex_11 = geompy.MakeVertex(17, 0, 3)
|
||||
Line_5 = geompy.MakeLineTwoPnt(Vertex_8, Vertex_9)
|
||||
Line_6 = geompy.MakeLineTwoPnt(Vertex_9, Vertex_10)
|
||||
Line_7 = geompy.MakeLineTwoPnt(Vertex_10, Vertex_11)
|
||||
Arc_1_vertex_2 = geompy.GetSubShape(Arc_1, [2])
|
||||
Line_8 = geompy.MakeLineTwoPnt(Vertex_11, Arc_1_vertex_2)
|
||||
Wire_1 = geompy.MakeWire([Arc_1, Line_2, Line_3, Line_4, Line_5, Line_6, Line_7, Line_8], 1e-07)
|
||||
Wire_2 = geompy.MakeWire([Line_1], 1e-07)
|
||||
Compound_1 = geompy.MakeCompound([Wire_1, Wire_2])
|
||||
|
||||
# Get CheckConformity tool
|
||||
cc = geompy.CheckConformity(Compound_1)
|
||||
valid = cc.isValid()
|
||||
dist = cc.distantShapes()
|
||||
small = cc.smallEdges()
|
||||
interfer = cc.interferingSubshapes()
|
||||
intersect = cc.selfIntersected2D()
|
@ -1,7 +1,7 @@
|
||||
# Detect Self-intersections
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Detect Self-intersections fast
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Check Shape
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Prism
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Revolution
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Filling
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Pipe
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a PipeWithDifferentSections
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a PipeWithShellSections
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a PipeShellsWithoutPath
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Creation of a PipeBiNormalAlongVector
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Middle Path
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of Tangent Plane On Face
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
2
doc/salome/examples/complex_objs_ex11.py
Executable file → Normal file
2
doc/salome/examples/complex_objs_ex11.py
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
# Apply thickness for shell
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
203
doc/salome/examples/curvature_face.py
Normal file
203
doc/salome/examples/curvature_face.py
Normal file
@ -0,0 +1,203 @@
|
||||
# Curvature of a Face along given direction
|
||||
|
||||
import salome
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
def test_acceptance():
|
||||
"""
|
||||
Acceptance test [tuleap29472]
|
||||
"""
|
||||
Vector = [0,100,100]
|
||||
O = geompy.MakeVertex(0, 0, 0)
|
||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||
Cylinder_1 = geompy.MakeCylinderRH(100, 300)
|
||||
Translation_1 = geompy.MakeTranslation(Cylinder_1, 0, 0, -150)
|
||||
Vertex_1 = geompy.MakeVertex(100, 0, 0)
|
||||
Vertex_2 = geompy.MakeVertex(100, -Vector[2], Vector[1])
|
||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
|
||||
Plane_1 = geompy.MakePlane(Vertex_1, Line_1, 2000)
|
||||
Rotation_1 = geompy.MakeRotation(Translation_1, OZ, 90*math.pi/180.0)# avoid to have degenerated edge across Vertex_1
|
||||
|
||||
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Rotation_1, geompy.ShapeType["FACE"], True)
|
||||
|
||||
curvature_29472 = np.array( geompy.VectorCoordinates( geompy.CurvatureOnFace(Face_2, Vertex_1, geompy.MakeVectorDXDYDZ(*Vector))) ).reshape(1,3)
|
||||
expected_curvature = np.array( [-200.0,0.0,0.0] ).reshape(1,3)
|
||||
assert( np.isclose( 0.0, np.linalg.norm( curvature_29472 - expected_curvature ) ,rtol=0,atol=1e-5 ) )
|
||||
|
||||
Intersection_1 = geompy.MakeSection(Face_2, Plane_1, True)
|
||||
geompy.addToStudy( O, 'O' )
|
||||
geompy.addToStudy( OX, 'OX' )
|
||||
geompy.addToStudy( OY, 'OY' )
|
||||
geompy.addToStudy( OZ, 'OZ' )
|
||||
geompy.addToStudy( Vertex_1, 'Vertex_1' )
|
||||
geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
|
||||
geompy.addToStudy( Translation_1, 'Translation_1' )
|
||||
geompy.addToStudy( Vertex_2, 'Vertex_2' )
|
||||
geompy.addToStudy( Line_1, 'Line_1' )
|
||||
geompy.addToStudy( Plane_1, 'Plane_1' )
|
||||
geompy.addToStudy( Rotation_1, 'Rotation_1' )
|
||||
geompy.addToStudyInFather( Rotation_1, Face_1, 'Face_1' )
|
||||
geompy.addToStudyInFather( Rotation_1, Face_2, 'Face_2' )
|
||||
geompy.addToStudyInFather( Rotation_1, Face_3, 'Face_3' )
|
||||
geompy.addToStudy( Intersection_1, 'Intersection_1' )
|
||||
angle = math.asin(Vector[2]/math.sqrt(Vector[1]*Vector[1]+Vector[2]*Vector[2]))
|
||||
tmp = geompy.MakeTranslation(Intersection_1,*[-elt for elt in geompy.PointCoordinates(Vertex_1)])
|
||||
tmp = geompy.MakeRotation(tmp,OX,-angle)
|
||||
Intersection_1_OXY = geompy.MakeTranslation(tmp,*geompy.PointCoordinates(Vertex_1))
|
||||
geompy.addToStudy( Intersection_1_OXY, 'Intersection_1_OXY' )
|
||||
|
||||
eps = 0.01
|
||||
offset = 0.75
|
||||
p0 = np.array( geompy.PointCoordinates( geompy.MakeVertexOnCurve(Intersection_1_OXY,offset-eps) ) ).reshape(1,3)
|
||||
p1 = np.array( geompy.PointCoordinates( geompy.MakeVertexOnCurve(Intersection_1_OXY,offset) ) ).reshape(1,3)
|
||||
p2 = np.array( geompy.PointCoordinates( geompy.MakeVertexOnCurve(Intersection_1_OXY,offset+eps) ) ).reshape(1,3)
|
||||
assert( np.isclose(0.0,np.linalg.norm(p1- np.array(geompy.PointCoordinates(Vertex_1)).reshape(1,3) ),rtol=0,atol=1e-8) )
|
||||
p01=(p0+p1)/2
|
||||
p12=(p1+p2)/2
|
||||
v0 = (p1-p0)/np.linalg.norm(p1-p0)
|
||||
v1 = (p2-p1)/np.linalg.norm(p2-p1)
|
||||
computedRadius = 1/np.linalg.norm((v1-v0)/np.linalg.norm(p12-p01))
|
||||
# manual detection of radius : https://fr.wikipedia.org/wiki/Courbure_d%27un_arc
|
||||
circle = geompy.MakeCircle(O,OZ,computedRadius)
|
||||
circle = geompy.MakeTranslation(circle,100-computedRadius,0,0)
|
||||
geompy.addToStudy(circle, "expectedCircle")
|
||||
print("Radius expected is {}".format(computedRadius))
|
||||
print("Radius obtain by CurvatureOnFace is {}".format(np.linalg.norm(curvature_29472)))
|
||||
|
||||
O = geompy.MakeVertex(0, 0, 0, 'O')
|
||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0, 'OX')
|
||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0, 'OY')
|
||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1, 'OZ')
|
||||
|
||||
pXYZ = geompy.MakeVertex(105, 105, 105, 'pXYZ')
|
||||
pY = geompy.MakeVertex(0, 105, 0, 'pY')
|
||||
pZ = geompy.MakeVertex(0, 0, 105, 'pZ')
|
||||
|
||||
vZ_XY = geompy.MakeVectorDXDYDZ(-1, -1, 1, 'vZ-XY')
|
||||
vZ_XY2 = geompy.MakeVectorDXDYDZ(-1, -1, 10, 'vZ-XY')
|
||||
vZ_XY3 = geompy.MakeVectorDXDYDZ(-1, -1, 100, 'vZ-XY')
|
||||
|
||||
R = 100.0
|
||||
|
||||
# I. Curvature of a Sphere
|
||||
Sphere_1 = geompy.MakeSphereR(R, 'Sphere_1')
|
||||
[Sph] = geompy.ExtractShapes(Sphere_1, geompy.ShapeType["FACE"], True, "Sph")
|
||||
|
||||
curvature_1 = geompy.CurvatureOnFace(Sph, pXYZ, OX, 'curvature_sph_pXYZ_OX')
|
||||
curvature_2 = geompy.CurvatureOnFace(Sph, pXYZ, vZ_XY, 'curvature_sph_pXYZ_vt')
|
||||
curvature_3 = geompy.CurvatureOnFace(Sph, pY, OX, 'curvature_sph_pY_OX')
|
||||
|
||||
# All sphere curvature radiuces = R
|
||||
assert(abs(geompy.BasicProperties(curvature_1)[0] - R) < 1e-07)
|
||||
assert(abs(geompy.BasicProperties(curvature_2)[0] - R) < 1e-07)
|
||||
assert(abs(geompy.BasicProperties(curvature_3)[0] - R) < 1e-07)
|
||||
|
||||
# Pole
|
||||
isExcept = False
|
||||
try:
|
||||
geompy.CurvatureOnFace(Sph, pZ, OX)
|
||||
except:
|
||||
isExcept = True
|
||||
assert(isExcept)
|
||||
|
||||
# Normal direction
|
||||
isExcept = False
|
||||
try:
|
||||
geompy.CurvatureOnFace(Sph, pY, OY)
|
||||
except:
|
||||
isExcept = True
|
||||
assert(isExcept)
|
||||
|
||||
# II. Curvature of a Cylinder
|
||||
Cylinder_1 = geompy.MakeCylinderRH(R, 300, 'Cylinder_1')
|
||||
[Face_1,Face_2,Face_3] = geompy.ExtractShapes(Cylinder_1, geompy.ShapeType["FACE"], True, "Face")
|
||||
|
||||
# Curvature radius of a cylinder along any direction, orthogonal to its Z axis, equal to R
|
||||
curvature_4 = geompy.CurvatureOnFace(Face_2, pY, OX, 'curvature_cyl_pY_OX')
|
||||
assert(abs(geompy.BasicProperties(curvature_4)[0] - R) < 1e-07)
|
||||
|
||||
# Curvature radius of a cylinder along its Z direction is infinite
|
||||
curvature_zero = geompy.CurvatureOnFace(Face_2, pY, OZ)
|
||||
assert(geompy.MeasuOp.GetErrorCode() == "ZERO_CURVATURE")
|
||||
assert(not curvature_zero)
|
||||
|
||||
# Curvature radius of a cylinder along some direction, different from two above
|
||||
curvature_5 = geompy.CurvatureOnFace(Face_2, pY, vZ_XY, 'curvature_cyl_pY_vZ_XY')
|
||||
curvature_6 = geompy.CurvatureOnFace(Face_2, pY, vZ_XY2, 'curvature_cyl_pY_vZ_XY2')
|
||||
curvature_7 = geompy.CurvatureOnFace(Face_2, pY, vZ_XY3, 'curvature_cyl_pY_vZ_XY3')
|
||||
|
||||
# R < r5 < r6 < r7
|
||||
# r5 = 100.01, r6 = 101.0, r7 = 200
|
||||
r5 = geompy.BasicProperties(curvature_5)[0]
|
||||
r6 = geompy.BasicProperties(curvature_6)[0]
|
||||
r7 = geompy.BasicProperties(curvature_7)[0]
|
||||
|
||||
assert(R + 1e-07 < r5)
|
||||
assert(r5 + 1e-07 < r6)
|
||||
assert(r6 + 1e-07 < r7)
|
||||
|
||||
# Projection aborted. Point is out of the face boundaries.
|
||||
isExcept = False
|
||||
try:
|
||||
pXY_Z = geompy.MakeVertex(105, 105, -105, 'pXY_Z')
|
||||
geompy.CurvatureOnFace(Face_2, pXY_Z, OX, 'curvature_cyl_pXY_Z')
|
||||
except:
|
||||
isExcept = True
|
||||
assert(isExcept)
|
||||
|
||||
# Projection aborted (point on axis). Equal distances to many points.
|
||||
isExcept = False
|
||||
try:
|
||||
geompy.CurvatureOnFace(Face_2, O, vZ_XY, 'curvature_cyl_O')
|
||||
except:
|
||||
isExcept = True
|
||||
assert(isExcept)
|
||||
|
||||
# Curvature radius of a planar face is infinite
|
||||
curvature_zero_2 = geompy.CurvatureOnFace(Face_1, pZ, OX)
|
||||
assert(geompy.MeasuOp.GetErrorCode() == "ZERO_CURVATURE")
|
||||
assert(not curvature_zero_2)
|
||||
|
||||
# III. Curvature of a "Horse saddle"
|
||||
[Edge_1,Edge_2,Edge_3] = geompy.ExtractShapes(Sphere_1, geompy.ShapeType["EDGE"], True)
|
||||
geompy.addToStudyInFather( Sphere_1, Edge_1, 'Edge_1' )
|
||||
geompy.addToStudyInFather( Sphere_1, Edge_2, 'Edge_2' )
|
||||
geompy.addToStudyInFather( Sphere_1, Edge_3, 'Edge_3' )
|
||||
|
||||
Rotation_1 = geompy.MakeRotation(Edge_3, OX, 90*math.pi/180.0, 'Rotation_1')
|
||||
Rotation_2 = geompy.MakeRotation(Rotation_1, OY, 180*math.pi/180.0, 'Rotation_2')
|
||||
Translation_1 = geompy.MakeTranslation(Rotation_2, 200, 0, 0, 'Translation_1')
|
||||
Translation_2 = geompy.MakeTranslation(Edge_3, 100, 100, 0, 'Translation_2')
|
||||
Translation_3 = geompy.MakeTranslation(Translation_2, 0, -200, 0, 'Translation_3')
|
||||
Filling_1 = geompy.MakeFilling([Translation_2, Edge_3, Translation_3])
|
||||
geompy.addToStudy(Filling_1, 'Filling_1')
|
||||
Vertex_2 = geompy.MakeVertex(100, 0, 0, 'Vertex_2')
|
||||
|
||||
curvature_Y = geompy.CurvatureOnFace(Filling_1, Vertex_2, OY, 'curvature_Y')
|
||||
curvature_Z = geompy.CurvatureOnFace(Filling_1, Vertex_2, OZ, 'curvature_Z')
|
||||
|
||||
cury = np.array( geompy.VectorCoordinates(curvature_Y) ).reshape(1,3)
|
||||
curz = np.array( geompy.VectorCoordinates(curvature_Z) ).reshape(1,3)
|
||||
cury_expected = np.array( [50,0,0] ).reshape(1,3)
|
||||
curz_expected = np.array( [-100,0,0] ).reshape(1,3)
|
||||
assert( np.isclose( 0.0, np.linalg.norm( cury - cury_expected ) ,rtol=0,atol=1e-5 ) )
|
||||
assert( np.isclose( 0.0, np.linalg.norm( curz - curz_expected ) ,rtol=0,atol=1e-5 ) )
|
||||
|
||||
# Normal direction
|
||||
norm_1 = geompy.GetNormal(Filling_1, Vertex_2, "Normal_1")
|
||||
isExcept = False
|
||||
try:
|
||||
geompy.CurvatureOnFace(Filling_1, Vertex_2, norm_1)
|
||||
except:
|
||||
isExcept = True
|
||||
assert(isExcept)
|
||||
|
||||
# acceptance case
|
||||
test_acceptance()
|
@ -1,7 +1,7 @@
|
||||
# Fast intersection
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Check Free Boundaries
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Check Free Faces
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Get Non Blocks
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Import/Export
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
@ -45,6 +45,9 @@ geompy.ExportVTK(sphere, f_vtk2, 0.1)
|
||||
f_xao = os.path.join(tmpdir, "sphere.xao")
|
||||
geompy.ExportXAO(sphere, [], [], "author", f_xao)
|
||||
|
||||
# export sphere to XAO format memory buffer (bytes array)
|
||||
buff_xao = geompy.ExportXAOMem(sphere, [], [], "author")
|
||||
|
||||
# import BREP file
|
||||
sphere_brep = geompy.ImportBREP(f_brep)
|
||||
|
||||
@ -64,6 +67,9 @@ sphere_stl2 = geompy.ImportSTL(f_stl2)
|
||||
# import XAO file
|
||||
ok, sphere_xao, sub_shapes, groups, fields = geompy.ImportXAO(f_xao)
|
||||
|
||||
# import XAO data from memory buffer (bytes array)
|
||||
ok_mem, sphere_xao_mem, sub_shapes_mem, groups_mem, fields_mem = geompy.ImportXAOMem(buff_xao)
|
||||
|
||||
# clean up
|
||||
for f in f_brep, f_iges, f_step, f_stl1, f_stl2, f_vtk1, f_vtk2, f_xao:
|
||||
os.remove(f)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Inertia
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
63
doc/salome/examples/kind_of_shape.py
Normal file
63
doc/salome/examples/kind_of_shape.py
Normal file
@ -0,0 +1,63 @@
|
||||
# Sample: KindOfShape method for Edges
|
||||
|
||||
import salome
|
||||
from inspect import getfile
|
||||
from os.path import abspath, dirname, join
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
||||
O = geompy.MakeVertex(0, 0, 0)
|
||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||
Vertex_1 = geompy.MakeVertex(0, 0, 0)
|
||||
Vertex_2 = geompy.MakeVertex(50, 100, 0)
|
||||
Vertex_3 = geompy.MakeVertex(-10, 60, 0)
|
||||
Vertex_4 = geompy.MakeVertex(0, 100, 0)
|
||||
Vertex_5 = geompy.MakeVertex(-100, 100, 0)
|
||||
Vertex_6 = geompy.MakeVertex(-100, 0, 0)
|
||||
Vertex_7 = geompy.MakeVertex(-200, 0, 0)
|
||||
Vertex_8 = geompy.MakeVertex(-200, 100, 0)
|
||||
|
||||
# create some curves
|
||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
|
||||
Circle_1 = geompy.MakeCircle(Vertex_2, OZ, 50)
|
||||
Ellipse_1 = geompy.MakeEllipse(Vertex_1, OZ, 200, 100, Line_1)
|
||||
Arc_1 = geompy.MakeArc(Vertex_2, Vertex_3, Vertex_1)
|
||||
Curve_1 = geompy.MakeCurveParametric("t", "50*sin(t)", "0", 0, 360, 30, GEOM.Interpolation, True)
|
||||
Curve_2 = geompy.MakeCurveParametric("-t", "50*cos(t)", "t", 0, 360, 14, GEOM.Bezier, True)
|
||||
Curve_5 = geompy.MakeInterpol([Vertex_1, Vertex_4, Vertex_5, Vertex_6, Vertex_7, Vertex_8], False, False)
|
||||
Curve_7 = geompy.MakeBezier([Vertex_5, Vertex_6, Vertex_7, Vertex_8], True)
|
||||
Curve_8 = geompy.MakeBezier([Vertex_5, Vertex_6, Vertex_1, Vertex_4], False)
|
||||
|
||||
# show information for all curves
|
||||
props = geompy.KindOfShape(Line_1)
|
||||
print("KindOfShape(Line_1): ", props)
|
||||
# [SEGMENT, 0.,0.,0., 50.,100.,0.]
|
||||
props = geompy.KindOfShape(Circle_1)
|
||||
print("KindOfShape(Circle_1): ", props)
|
||||
# [CIRCLE, 50.,100.,0., 0.,0.,1., 50.]
|
||||
props = geompy.KindOfShape(Ellipse_1)
|
||||
print("KindOfShape(Ellipse_1): ", props)
|
||||
# [ELLIPSE, 0.,0.,0., 0.,0.,1., 200., 100., 0.44721,0.89443,0., 0.44721,0.89443,0.]
|
||||
props = geompy.KindOfShape(Arc_1)
|
||||
print("KindOfShape(Arc_1): ", props)
|
||||
# [ARC_CIRCLE, 47.5,38.75,0., 0.,0.,1., 61.301, 50.,100.,0., 0.,0.,0.]
|
||||
props = geompy.KindOfShape(Curve_1)
|
||||
print("KindOfShape(Curve_1): ", props)
|
||||
# [CRV_BSPLINE, 0, 3, 33, 31, 0, 31, 0.,0.,0.,..., 4,1,...,1,4]
|
||||
props = geompy.KindOfShape(Curve_2)
|
||||
print("KindOfShape(Curve_2): ", props)
|
||||
# [CRV_BEZIER, 15, 0, 0.,50.,0.,...,-360.,-14.18455,360.]
|
||||
props = geompy.KindOfShape(Curve_5)
|
||||
print("KindOfShape(Curve_5): ", props)
|
||||
# [CRV_BSPLINE, 0, 3, 8, 6, 0, 6, 0.,0.,0.,..., 100.,0.,0.,100.,200.,300.,400.,500., 4,1,1,1,1,4]
|
||||
props = geompy.KindOfShape(Curve_7)
|
||||
print("KindOfShape(Curve_7): ", props)
|
||||
# [CRV_BEZIER, 5, 0, -100.,100.,0., -100.,0.,0., -200.,0.,0., -200.,100.,0., -100.,100.,0.]
|
||||
props = geompy.KindOfShape(Curve_8)
|
||||
print("KindOfShape(Curve_8): ", props)
|
||||
# [CRV_BEZIER, 4, 0, -100.,100.,0., -100.,0.,0., 0.,0.,0., 0.,100.,0.]
|
137
doc/salome/examples/kind_of_shape_cone.py
Normal file
137
doc/salome/examples/kind_of_shape_cone.py
Normal file
@ -0,0 +1,137 @@
|
||||
# Sample: KindOfShape method for faces, which are results of partitioning of a conical surface with a prism with complex base.
|
||||
# Faces of the prism are not perpendicular to cone axis, therefore contour-wires of resulting cone fragments are composed of lines and 2-order curves.
|
||||
|
||||
import sys
|
||||
import salome
|
||||
|
||||
salome.salome_init()
|
||||
import salome_notebook
|
||||
notebook = salome_notebook.NoteBook()
|
||||
|
||||
###
|
||||
### GEOM component
|
||||
###
|
||||
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
import math
|
||||
import SALOMEDS
|
||||
|
||||
|
||||
def approximatelyEqual(a, b, epsilon = 1e-5):
|
||||
return abs(a - b) <= ((abs(b) if (abs(a) < abs(b)) else abs(a)) * epsilon)
|
||||
|
||||
|
||||
def assertShapeKindEquals(iShapeInfo, iKind):
|
||||
assert (len(iShapeInfo) > 0), "Yielded data array is empty."
|
||||
assert (iShapeInfo[0] == iKind), f"Expected shape kind is {iKind}, but yielded kind is {iShapeInfo[0]}."
|
||||
|
||||
|
||||
def assertConePropsEqual(iShapeName, iShapeInfo, iExpectedShapeInfo):
|
||||
assertShapeKindEquals(iShapeInfo, geompy.kind.CONE2D)
|
||||
assert (len(iShapeInfo) == len(iExpectedShapeInfo)), f"{iShapeName}: Yielded data array is of unexpected length."
|
||||
for idx in range(1, len(iShapeInfo)):
|
||||
assert (approximatelyEqual(iShapeInfo[idx], iExpectedShapeInfo[idx])), f"{iShapeName}: Yielded data array element is not equal to the expected value."
|
||||
|
||||
|
||||
def assertConeInfoEquals(iFace, iExpectedShapeInfo, iAddRestoredConeToStudy = False):
|
||||
ShapeInfo = geompy.KindOfShape(iFace)
|
||||
print("ShapeInfo of " + iFace.GetName() + " = ", end = "")
|
||||
print(ShapeInfo, ', ')
|
||||
assertConePropsEqual(iFace.GetName(), ShapeInfo, iExpectedShapeInfo)
|
||||
|
||||
if (iAddRestoredConeToStudy):
|
||||
BottomLidCenter = geompy.MakeVertex(ShapeInfo[1], ShapeInfo[2], ShapeInfo[3])
|
||||
AxisAuxPnt = geompy.MakeVertex(ShapeInfo[1] + ShapeInfo[4], ShapeInfo[2] + ShapeInfo[5], ShapeInfo[3] + ShapeInfo[6])
|
||||
Axis = geompy.MakeVector(BottomLidCenter, AxisAuxPnt)
|
||||
R1 = ShapeInfo[7] # Bottom lid radius.
|
||||
R2 = ShapeInfo[8] # Top lid radius.
|
||||
H = ShapeInfo[9]
|
||||
RestoredCone = geompy.MakeCone(BottomLidCenter, Axis, R1, R2, H)
|
||||
geompy.addToStudy(RestoredCone, iFace.GetName() + '__RestoredCone')
|
||||
|
||||
|
||||
# iExpectedConeFragmentShapeInfos is a dictionary of [IndexOfFace, ExpectedShapeInfoOfFace]. IndexOfFace is zero-based index, not one-based one as in Shaper GUI!
|
||||
def partitionConeAndAssertShapeInfosEqual(iCone, iPartitioningShape, iExpectedConeFragmentShapeInfos, iAddResultsToStudy):
|
||||
PartitionedCone = geompy.MakePartition([iCone], [iPartitioningShape], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||
if (iAddResultsToStudy):
|
||||
geompy.addToStudy(PartitionedCone, "Partitioned" + iCone.GetName())
|
||||
|
||||
ConeFragments = geompy.ExtractShapes(PartitionedCone, geompy.ShapeType["FACE"], True)
|
||||
ConeFragmentsIdxs = iExpectedConeFragmentShapeInfos.keys()
|
||||
for ConeFragmentIdx in ConeFragmentsIdxs:
|
||||
assert (ConeFragmentIdx < len(ConeFragments)), f"Num of faces, {iCone.GetName()} is partitioned into, <= {ConeFragmentIdx} (zero-based index)."
|
||||
ConeFragment = ConeFragments[ConeFragmentIdx]
|
||||
ConeFragmentName = f"Partitioned{iCone.GetName()}_Face_{ConeFragmentIdx+1}" # Add index to a name as Shaper GUI does.
|
||||
|
||||
if (iAddResultsToStudy):
|
||||
geompy.addToStudyInFather(PartitionedCone, ConeFragment, ConeFragmentName)
|
||||
else:
|
||||
ConeFragment.SetName(ConeFragmentName)
|
||||
|
||||
assertConeInfoEquals(ConeFragment, iExpectedConeFragmentShapeInfos[ConeFragmentIdx], iAddResultsToStudy)
|
||||
|
||||
|
||||
geompy = geomBuilder.New()
|
||||
|
||||
OriginalConeBaseCenter = geompy.MakeVertex(100, 130, -60)
|
||||
OriginalConeAxisAuxPnt = geompy.MakeVertex(100, 230, 40)
|
||||
OriginalConeAxis = geompy.MakeVector(OriginalConeBaseCenter, OriginalConeAxisAuxPnt)
|
||||
OriginalCone = geompy.MakeCone(OriginalConeBaseCenter, OriginalConeAxis, 100, 50, 300)
|
||||
PrismSubstrateCenter = geompy.MakeVertex(100, 1000, 50)
|
||||
PrismDirAuxPnt = geompy.MakeVertex(100, 950, 50)
|
||||
PrismDir = geompy.MakeVector(PrismSubstrateCenter, PrismDirAuxPnt)
|
||||
PrismSubstrate = geompy.MakeDiskPntVecR(PrismSubstrateCenter, PrismDir, 100)
|
||||
sk = geompy.Sketcher2D()
|
||||
sk.addPoint(0.395986, 43.346713)
|
||||
sk.addSegmentAbsolute(66.321537, 41.733575)
|
||||
sk.addSegmentAbsolute(80.619408, -2.852314)
|
||||
sk.addSegmentAbsolute(67.641539, -38.565150)
|
||||
sk.addSegmentAbsolute(22.193602, -56.632163)
|
||||
sk.addSegmentAbsolute(-19.060136, -51.084351)
|
||||
sk.addSegmentAbsolute(-60.823572, 34.825751)
|
||||
sk.addSegmentAbsolute(-13.047004, 55.727527)
|
||||
sk.close()
|
||||
PrismBase = sk.wire(PrismSubstrate)
|
||||
Prism = geompy.MakePrismVecH(PrismBase, PrismDir, 1400)
|
||||
geompy.addToStudy( OriginalConeBaseCenter, 'OriginalConeBaseCenter' )
|
||||
geompy.addToStudy( OriginalConeAxisAuxPnt, 'OriginalConeAxisAuxPnt' )
|
||||
geompy.addToStudy( OriginalConeAxis, 'OriginalConeAxis' )
|
||||
geompy.addToStudy( OriginalCone, 'OriginalCone' )
|
||||
geompy.addToStudy( PrismSubstrateCenter, 'PrismSubstrateCenter' )
|
||||
geompy.addToStudy( PrismDirAuxPnt, 'PrismDirAuxPnt' )
|
||||
geompy.addToStudy( PrismDir, 'PrismDir' )
|
||||
geompy.addToStudy( PrismSubstrate, 'PrismSubstrate' )
|
||||
geompy.addToStudy( PrismBase, 'PrismBase' )
|
||||
geompy.addToStudy( Prism, 'Prism' )
|
||||
|
||||
# Test on the original cone
|
||||
ExpectedOriginalConeFragmentsShapeInfos = {
|
||||
3: ["CONE2D", 100.0, 215.76160602318674, 25.761606023186744, 0.0, 0.7071067811865475, 0.7071067811865475, 79.7857956051852, 54.62305376134459, 150.9764510630437],
|
||||
5: ["CONE2D", 100.0, 129.99999999999753, -60.000000000002466, 0.0, 0.7071067811865475, 0.7071067811865475, 100.00000000000058, 69.82277418813575, 181.06335487118898],
|
||||
11: ["CONE2D", 100.0, 216.57653245407857, 26.57653245407856, 0.0, 0.7071067811865475, 0.7071067811865475, 79.59371560336794, 52.95933239773038, 159.80629923382543]
|
||||
}
|
||||
partitionConeAndAssertShapeInfosEqual(OriginalCone, Prism, ExpectedOriginalConeFragmentsShapeInfos, True)
|
||||
|
||||
# Test on isotropically scaled cone. Non-isotropical scaling does not preserve shape kind - it is desired behavior.
|
||||
ScaledCone = geompy.MakeScaleTransform(OriginalCone, OriginalConeAxisAuxPnt, 2)
|
||||
ScaledCone.SetName('ScaledCone')
|
||||
ExpectedScaledConeFragmentsShapeInfos = {
|
||||
4: ["CONE2D", 100.0, 29.9999999999999, -160.00000000000009, 0.0, 0.7071067811865475, 0.7071067811865475, 200.00000000000003, 162.64508449690112, 224.1294930185934],
|
||||
6: ["CONE2D", 100.0, 262.09898500769475, 72.09898500769472, 0.0, 0.7071067811865475, 0.7071067811865475, 145.2937445981814, 120.13428858458612, 150.95673608157182],
|
||||
12: ["CONE2D", 100.0, 262.8999708414969, 72.8999708414969, 0.0, 0.7071067811865475, 0.7071067811865475, 145.10495042660943, 117.46838914559419, 165.8193676860916]
|
||||
}
|
||||
partitionConeAndAssertShapeInfosEqual(ScaledCone, Prism, ExpectedScaledConeFragmentsShapeInfos, False)
|
||||
|
||||
# Test on a cone, mirrored relative to a point.
|
||||
PntMirroredCone = geompy.MakeMirrorByPoint(OriginalCone, OriginalConeAxisAuxPnt)
|
||||
PntMirroredCone.SetName('PntMirroredCone')
|
||||
ExpectedPntMirroredConeFragmentsShapeInfos = {
|
||||
2: ["CONE2D", 100.0, 229.8712015945071, 39.87120159450711, -0.0, -0.7071067811865475, -0.7071067811865475, 76.39941588513841, 51.25530645152799, 150.8646566016625],
|
||||
7: ["CONE2D", 100.0, 330.0, 140.0, -0.0, -0.7071067811865475, -0.7071067811865475, 100.0, 71.73019727352477, 169.61881635885143],
|
||||
10: ["CONE2D", 100.0, 249.15532313133338, 59.15532313133339, -0.0, -0.7071067811865475, -0.7071067811865475, 80.9447269211102, 51.428754043115056, 177.09583726797095]
|
||||
}
|
||||
partitionConeAndAssertShapeInfosEqual(PntMirroredCone, Prism, ExpectedPntMirroredConeFragmentsShapeInfos, False)
|
||||
|
||||
if salome.sg.hasDesktop():
|
||||
salome.sg.updateObjBrowser()
|
@ -1,7 +1,7 @@
|
||||
# Minimal Distance
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Normal to a Face
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Using SALOME NoteBook
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Point Coordinates
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# 2D polyline
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Box
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -3,7 +3,7 @@
|
||||
import math
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Sphere
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Torus
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Cone
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Disk
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Creation of a Rectangle
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
2
doc/salome/examples/repairing_operations_ex01.py
Executable file → Normal file
2
doc/salome/examples/repairing_operations_ex01.py
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
# Shape Processing
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Suppress Faces
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Close Contour
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Suppress Internal Wires
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Suppress Holes
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
salome.salome_init_without_session()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New()
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user