From de33bd5e0f52566884f809408e5ba8e2b55ab661 Mon Sep 17 00:00:00 2001 From: akl Date: Thu, 18 Sep 2008 07:32:17 +0000 Subject: [PATCH] Fix of issue 0019967: EDF SMESH 806: TUI script example is missing for the Concatenate and ConcatenateWithGroups functions. --- src/SMESH_SWIG/Makefile.am | 1 + src/SMESH_SWIG/SMESH_BuildCompound.py | 98 +++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/SMESH_SWIG/SMESH_BuildCompound.py diff --git a/src/SMESH_SWIG/Makefile.am b/src/SMESH_SWIG/Makefile.am index dc8d2a32c..5e1d20e3e 100644 --- a/src/SMESH_SWIG/Makefile.am +++ b/src/SMESH_SWIG/Makefile.am @@ -90,6 +90,7 @@ dist_salomescript_DATA= \ SMESH_Nut.py \ SMESH_GroupLyingOnGeom.py \ SMESH_AdvancedEditor.py \ + SMESH_BuildCompound.py \ PAL_MESH_041_mesh.py \ PAL_MESH_043_2D.py \ PAL_MESH_043_3D.py \ diff --git a/src/SMESH_SWIG/SMESH_BuildCompound.py b/src/SMESH_SWIG/SMESH_BuildCompound.py new file mode 100644 index 000000000..27341db18 --- /dev/null +++ b/src/SMESH_SWIG/SMESH_BuildCompound.py @@ -0,0 +1,98 @@ +# Copyright (C) 2003 CEA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# +# +# File : SMESH_BuildCompound.py +# Author : Alexander KOVALEV +# Module : SMESH +# $Header$ + +# ! Please, if you edit this example file, update also +# ! SMESH_SRC/doc/salome/gui/SMESH/input/tui_creating_meshes.doc +# ! as some sequences of symbols from this example are used during +# ! documentation generation to identify certain places of this file + +import geompy +import smesh + +## create a bottom box +Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.) + +# get a top face +Psup1=geompy.MakeVertex(100., 100., 50.) +Fsup1=geompy.GetFaceNearPoint(Box_inf, Psup1) +# get a bottom face +Pinf1=geompy.MakeVertex(100., 100., 0.) +Finf1=geompy.GetFaceNearPoint(Box_inf, Pinf1) + +## create a top box +Box_sup = geompy.MakeBox(100., 100., 50., 200., 200., 100.) + +# get a top face +Psup2=geompy.MakeVertex(150., 150., 100.) +Fsup2=geompy.GetFaceNearPoint(Box_sup, Psup2) +# get a bottom face +Pinf2=geompy.MakeVertex(150., 150., 50.) +Finf2=geompy.GetFaceNearPoint(Box_sup, Pinf2) + +## Publish in the study +geompy.addToStudy(Box_inf, "Box_inf") +geompy.addToStudyInFather(Box_inf, Fsup1, "Fsup") +geompy.addToStudyInFather(Box_inf, Finf1, "Finf") + +geompy.addToStudy(Box_sup, "Box_sup") +geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup") +geompy.addToStudyInFather(Box_sup, Finf2, "Finf") + +## create a bottom mesh +Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf") +algo1D_1=Mesh_inf.Segment() +algo1D_1.NumberOfSegments(10) +algo2D_1=Mesh_inf.Quadrangle() +algo3D_1=Mesh_inf.Hexahedron() +Mesh_inf.Compute() + +# create a group on the top face +Gsup1=Mesh_inf.Group(Fsup1, "Sup") +# create a group on the bottom face +Ginf1=Mesh_inf.Group(Finf1, "Inf") + +## create a top mesh +Mesh_sup = smesh.Mesh(Box_sup, "Mesh_sup") +algo1D_2=Mesh_sup.Segment() +algo1D_2.NumberOfSegments(5) +algo2D_2=Mesh_sup.Quadrangle() +algo3D_2=Mesh_sup.Hexahedron() +Mesh_sup.Compute() + +# create a group on the top face +Gsup2=Mesh_sup.Group(Fsup2, "Sup") +# create a group on the bottom face +Ginf2=Mesh_sup.Group(Finf2, "Inf") + +## create compounds +# create a compound of two meshes with renaming groups with the same names and +# merging of elements with the given tolerance +Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05) +smesh.SetName(Compound1, 'Compound_with_RenamedGrps_and_MergeElems') +# create a compound of two meshes with uniting groups with the same names and +# creating groups of all elements +Compound2 = smesh.smesh.ConcatenateWithGroups([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05) +smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems') +#end -- 2.39.2