# Application tests
-INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} ${SESSION_FREE_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
+INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} ${SESSION_FREE_TESTS} ${SWIG_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
INSTALL(FILES Mesh_tri.med test_homard_adapt.med tutorial_4.00.med tutorial_4.xao tutorial_5.00.med tutorial_5.fr.med DESTINATION ${TEST_INSTALL_DIRECTORY})
INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
INSTALL(DIRECTORY MGAdapt_med_files DESTINATION ${TEST_INSTALL_DIRECTORY})
INCLUDE(tests.set)
-FOREACH(tfile ${GOOD_TESTS} ${BAD_TESTS})
+FOREACH(tfile ${GOOD_TESTS} ${BAD_TESTS} ${SWIG_TESTS})
GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE)
SET(TEST_NAME SMESH_${BASE_NAME})
ADD_TEST(${TEST_NAME} python ${PYTHON_TEST_DRIVER} ${TIMEOUT} ${tfile})
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+#-----------------------------GEOM----------------------------------------
+
+#----------Vertexes------------
+p1 = geompy.MakeVertex(20.0,30.0,40.0)
+p2 = geompy.MakeVertex(90.0,80.0,0.0)
+p3 = geompy.MakeVertex(30.0,80.0,200.0)
+
+#----------Edges---------------
+e1 = geompy.MakeEdge(p1,p2)
+e2 = geompy.MakeEdge(p2,p3)
+e3 = geompy.MakeEdge(p3,p1)
+
+#----------Wire----------------
+ListOfEdges = []
+ListOfEdges.append(e3)
+ListOfEdges.append(e2)
+ListOfEdges.append(e1)
+wire1 = geompy.MakeWire(ListOfEdges)
+
+
+#----------Face----------------
+WantPlanarFace = 1
+face1 = geompy.MakeFace(wire1,WantPlanarFace)
+
+Id_face1 = geompy.addToStudy(face1,"Face1")
+
+
+
+#-----------------------------SMESH-------------------------------------------
+
+# -- Init mesh --
+plane_mesh = salome.IDToObject( Id_face1)
+
+mesh = smesh.Mesh(plane_mesh, "Mesh_1")
+
+print("---------------------Hypothesis and Algorithms")
+
+#---------------- NumberOfSegments
+
+numberOfSegment = 9
+
+algoWireDes = mesh.Segment()
+listHyp = algoWireDes.GetCompatibleHypothesis()
+print(algoWireDes.GetName())
+algoWireDes.SetName("Ware descritisation")
+
+hypNbSeg = algoWireDes.NumberOfSegments(numberOfSegment)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "Nb. Segments")
+
+
+#--------------------------Max. Element Area
+maxElementArea = 200
+
+algoMef = mesh.Triangle()
+listHyp = algoMef.GetCompatibleHypothesis()
+print(algoMef.GetName())
+algoMef.SetName("Triangle (Mefisto)")
+
+hypArea200 = algoMef.MaxElementArea(maxElementArea)
+print(hypArea200.GetName())
+print(hypArea200.GetMaxElementArea())
+smesh.SetName(hypArea200, "Max. Element Area")
+
+
+print("---------------------Compute the mesh")
+
+ret = mesh.Compute()
+print(ret)
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_testExtrusion2D.py
+# Module : SMESH
+# Description : Create meshes to test extrusion of mesh elements along path
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+#----------------------------------GEOM
+
+# create points
+p1 = geompy.MakeVertex(100, 0, 0)
+p2 = geompy.MakeVertex(100, 0, 100)
+p3 = geompy.MakeVertex(0, 0, 0)
+p4 = geompy.MakeVertex(0, 100, 0)
+
+
+# create two vectors
+vector1 = geompy.MakeVector(p1,p2)
+vector2 = geompy.MakeVector(p3,p4)
+
+# make two ellipses
+ellipse1 = geompy.MakeEllipse(p1,vector1,50,25)
+ellipse2 = geompy.MakeEllipse(p3,vector2,300,50)
+
+# publish circular face and second circle
+id_ellipse1 = geompy.addToStudy(ellipse1, "Ellips 1")
+id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
+
+
+#---------------------------------SMESH
+
+# create the path mesh
+mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
+
+algoReg1 = mesh1.Segment()
+algoReg1.SetName("Regular_1D")
+hypNbSeg1 = algoReg1.NumberOfSegments(18)
+smesh.SetName(hypNbSeg1, "NumberOfSegments 1")
+
+# create the tool mesh
+mesh2 = smesh.Mesh(ellipse2, "Tool Mesh")
+algoReg2 = mesh2.Segment()
+algoReg2.SetName("Regular_1D")
+hypNbSeg2 = algoReg2.NumberOfSegments(34)
+smesh.SetName(hypNbSeg2, "NumberOfSegments 2")
+
+# compute meshes
+mesh1.Compute()
+mesh2.Compute()
+
+
+# ---- udate object browser
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_testExtrusion3D.py
+# Module : SMESH
+# Description : Create meshes to test extrusion of mesh elements along path
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+# create points to build two circles
+p1 = geompy.MakeVertex(0, 100, 0)
+p2 = geompy.MakeVertex(100, 0, 0)
+p3 = geompy.MakeVertex(0, -100, 0)
+p4 = geompy.MakeVertex(0, 70, 0)
+p5 = geompy.MakeVertex(0, 100, 30)
+p6 = geompy.MakeVertex(0, 130, 0)
+
+# create two circles
+circle = geompy.MakeCircleThreePnt(p1, p2, p3)
+cf = geompy.MakeCircleThreePnt(p4, p5, p6)
+
+# make circular face
+wire = geompy.MakeWire([cf])
+face = geompy.MakeFace(wire, 1)
+
+# publish circular face and second circle
+idcircle = geompy.addToStudy(circle, "Circle")
+idface = geompy.addToStudy(face, "Circular face")
+
+
+# init a Mesh with the circular face
+mesh1 = smesh.Mesh(face, "Mesh on circular face")
+
+# set hypotheses and algos to the first mesh
+numberOfSegments1 = 12
+algoReg1 = mesh1.Segment()
+algoReg1.SetName("Regular_1D")
+hypNbSeg1 = algoReg1.NumberOfSegments(numberOfSegments1)
+smesh.SetName(hypNbSeg1, "NumberOfSegments_" + str(numberOfSegments1))
+
+maxElementArea = 30
+
+algoMef = mesh1.Triangle()
+algoMef.SetName("MEFISTO_2D")
+hypArea = algoMef.MaxElementArea(maxElementArea)
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+
+# init a Mesh with the second circle
+mesh2 = smesh.Mesh(circle, "Mesh on circular edge")
+
+numberOfSegments2 = 12
+algoReg2 = mesh2.Segment()
+algoReg2.SetName("Regular_1D")
+hypNbSeg2 = algoReg2.NumberOfSegments(numberOfSegments2)
+smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2))
+
+
+# compute meshes
+mesh1.Compute()
+mesh2.Compute()
+
+# ---- update object browser
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+def GetNewNodes(mesh,Elems,OldNodes):
+ """
+ Auxiliary function, which return list of nodes from
+ given Elems avoided nodes from OldNodes
+ """
+ newnodes = []
+ for i in Elems:
+ nbn = mesh.GetElemNbNodes(i)
+ for j in range(0,nbn):
+ nn = mesh.GetElemNode(i,j)
+ isold = 0
+ for k in range(0,len(newnodes)):
+ if nn==newnodes[k]:
+ isold = 1
+ break
+ pass
+ if isold: continue
+ for k in range(0,len(OldNodes)):
+ if nn==OldNodes[k]:
+ isold = 1
+ break
+ pass
+ if isold: continue
+ newnodes.append(nn)
+ pass
+ pass
+ return newnodes
+
+
+# create empty mesh
+mesh = smesh.Mesh()
+
+tol = 0.001
+
+# create a cross from quadrangle faces
+# 1. create first edge and make extrusion along 0x
+n1 = mesh.AddNode(55,-5,0)
+n2 = mesh.AddNode(55,5,0)
+e1 = mesh.AddEdge([n1,n2])
+dir1 = SMESH.DirStruct(SMESH.PointStruct(-10,0,0))
+mesh.ExtrusionSweep([e1],dir1,11)
+# 2. create second edge and make extrusion along 0y
+n3 = mesh.AddNode(-5,-55,0)
+n4 = mesh.AddNode(5,-55,0)
+e2 = mesh.AddEdge([n3,n4])
+dir2 = SMESH.DirStruct(SMESH.PointStruct(0,10,0))
+mesh.ExtrusionSweep([e2],dir2,11)
+
+# since result has coincident nodes and faces
+# we have to make merge
+nodes = mesh.FindCoincidentNodes(0.001)
+mesh.MergeNodes(nodes)
+mesh.MergeEqualElements()
+
+# make extrusion faces along 0z
+faces = mesh.GetElementsByType(SMESH.FACE)
+nbf = len(faces)
+maxang = 2.0
+zstep = 5
+nbzsteps = 50
+dir3 = SMESH.DirStruct(SMESH.PointStruct(0,0,zstep))
+newfaces = [] # list for keeping created top faces
+ # during extrusion
+
+for i in range(0,nbzsteps):
+ mesh.ExtrusionSweep(faces,dir3,1)
+ # find top faces after each extrusion and keep them
+ res = mesh.GetLastCreatedElems()
+ nbr = len(res)
+ nfaces = []
+ for j in res:
+ nbn = mesh.GetElemNbNodes(j)
+ if nbn!=4: continue
+ nn1 = mesh.GetElemNode(j,0)
+ xyz1 = mesh.GetNodeXYZ(nn1)
+ nn2 = mesh.GetElemNode(j,1)
+ xyz2 = mesh.GetNodeXYZ(nn2)
+ nn3 = mesh.GetElemNode(j,2)
+ xyz3 = mesh.GetNodeXYZ(nn3)
+ if abs(xyz1[2]-xyz2[2])<tol and abs(xyz1[2]-xyz3[2])<tol :
+ # this face is a top face
+ nfaces.append(j)
+ pass
+ pass
+ if len(nfaces)!=nbf:
+ print("len(nfaces)!=nbf")
+ break
+ newfaces.append(nfaces)
+ # update faces for before next step of extrusion
+ faces = nfaces
+ pass
+
+# rotate faces from newfaces
+axisr1 = SMESH.AxisStruct(0,0,0,0,0,1)
+for i in range(0,nbzsteps):
+ ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps))
+ mesh.Rotate(newfaces[i],axisr1,ang,0)
+
+
+# create circles
+# create two edges and rotate them for creation
+# full circle
+n5 = mesh.AddNode(65,0,0)
+n6 = mesh.AddNode(67.5,0,0)
+n7 = mesh.AddNode(70,0,0)
+e56 = mesh.AddEdge([n5,n6])
+e67 = mesh.AddEdge([n6,n7])
+axisr2 = SMESH.AxisStruct(65,0,0,0,1,0)
+mesh.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol)
+res = mesh.GetLastCreatedElems()
+faces1 = []
+for i in res:
+ nbn = mesh.GetElemNbNodes(i)
+ if nbn>2: faces1.append(i)
+ pass
+nbf1 = len(faces1)
+
+# create other two edges and rotate them for creation
+# other full circle
+n8 = mesh.AddNode(-65,0,0)
+n9 = mesh.AddNode(-67.5,0,0)
+n10 = mesh.AddNode(-70,0,0)
+e8 = mesh.AddEdge([n8,n9])
+e9 = mesh.AddEdge([n9,n10])
+axisr3 = SMESH.AxisStruct(-65,0,0,0,-1,0)
+mesh.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol)
+res = mesh.GetLastCreatedElems()
+faces2 = []
+for i in res:
+ nbn = mesh.GetElemNbNodes(i)
+ if nbn>2: faces2.append(i)
+ pass
+nbf2 = len(faces2)
+
+# there are coincident nodes after rotation
+# therefore we have to merge nodes
+nodes = mesh.FindCoincidentNodes(0.001)
+mesh.MergeNodes(nodes)
+
+nbcircs = 2
+nbrsteps = 24
+nbrs = nbcircs*nbrsteps
+dz = nbzsteps*zstep/nbrs
+
+# create first spiral
+oldnodes = []
+newnodes = GetNewNodes(mesh,faces1,oldnodes)
+oldnodes = newnodes
+
+nodes = []
+mesh.RotationSweep(faces1,axisr1, math.pi*2/nbrsteps, nbrs, tol)
+res = mesh.GetLastCreatedElems()
+
+for i in range(0,nbrs):
+ volumes = []
+ for j in range(0,nbf1): volumes.append(res[i+j*nbrs])
+ newnodes = GetNewNodes(mesh,volumes,oldnodes)
+ for j in newnodes:
+ xyz = mesh.GetNodeXYZ(j)
+ mesh.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1))
+ pass
+ oldnodes = newnodes
+ pass
+
+# create second spiral
+oldnodes = []
+newnodes = GetNewNodes(mesh,faces2,oldnodes)
+oldnodes = newnodes
+
+nodes = []
+mesh.RotationSweep(faces2,axisr1, math.pi*2/nbrsteps, nbrs, tol)
+res = mesh.GetLastCreatedElems()
+
+for i in range(0,nbrs):
+ volumes = []
+ for j in range(0,nbf2): volumes.append(res[i+j*nbrs])
+ newnodes = GetNewNodes(mesh,volumes,oldnodes)
+ for j in newnodes:
+ xyz = mesh.GetNodeXYZ(j)
+ mesh.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1))
+ pass
+ oldnodes = newnodes
+ pass
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+from SMESH_test1 import *
+
+## Old style
+def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType):
+ if theShape != theSubShape:
+ aName = str(theSubShape)
+ geompy.addToStudyInFather(theShape,theSubShape,aName)
+
+ theMeshGen.Compute(theMesh,theShape)
+
+ aFilterMgr = theMeshGen.CreateFilterManager()
+ aFilter = aFilterMgr.CreateFilter()
+
+ aBelongToGeom = aFilterMgr.CreateBelongToGeom()
+ aBelongToGeom.SetGeom(theSubShape)
+ aBelongToGeom.SetElementType(theElemType)
+
+ aFilter.SetPredicate(aBelongToGeom)
+ aFilterMgr.UnRegister()
+ return aFilter.GetElementsId(theMesh)
+
+## Current style
+def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType):
+ if theShape != theSubShape:
+ aName = str(theSubShape)
+ geompy.addToStudyInFather(theShape,theSubShape,aName)
+
+ theMesh.Compute()
+ aFilter = smesh.GetFilter(theElemType, SMESH.FT_BelongToGeom, theSubShape)
+ return aFilter.GetElementsId(theMesh.GetMesh())
+
+
+anElemType = SMESH.FACE;
+print("anElemType =", anElemType)
+#anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType)
+anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType)
+print("Number of ids = ", len(anIds))
+print("anIds = ", anIds)
+## Check old version
+#anIds = CheckBelongToGeomFilterOld(smesh,mesh.GetMesh(),box,box,anElemType)
+#print "anIds = ", anIds
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 : 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+## 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.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.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
+smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
+#end
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_GroupFromGeom.py
+# Module : SMESH
+#
+from SMESH_test1 import *
+
+# Compute the mesh created in SMESH_test1
+
+mesh.Compute()
+
+# Create geometry groups on plane:
+aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"])
+geompy.AddObject(aGeomGroup1, 1)
+
+aGeomGroup2 = geompy.CreateGroup(face , geompy.ShapeType["EDGE"])
+
+geompy.AddObject(aGeomGroup2, 3)
+geompy.AddObject(aGeomGroup2, 6)
+geompy.AddObject(aGeomGroup2, 8)
+geompy.AddObject(aGeomGroup2, 10)
+
+geompy.addToStudy(aGeomGroup1, "Group on Faces")
+geompy.addToStudy(aGeomGroup2, "Group on Edges")
+
+aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
+aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+#==============================================================================
+# Info.
+# Bug (from script, bug) : SMESH_GroupFromGeom.py, PAL6945
+# Modified : 25/11/2004
+# Author : Kovaltchuk Alexey
+# Project : PAL/SALOME
+#==============================================================================
+#
+from SMESH_test1 import *
+
+
+# Compute the mesh created in SMESH_test1
+
+mesh.Compute()
+
+# Create geometry groups on plane:
+aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"])
+geompy.AddObject(aGeomGroup1, 1)
+
+aGeomGroup2 = geompy.CreateGroup(face , geompy.ShapeType["EDGE"])
+
+geompy.AddObject(aGeomGroup2, 3)
+geompy.AddObject(aGeomGroup2, 6)
+geompy.AddObject(aGeomGroup2, 8)
+geompy.AddObject(aGeomGroup2, 10)
+
+geompy.addToStudy(aGeomGroup1, "Group on Faces")
+geompy.addToStudy(aGeomGroup2, "Group on Edges")
+
+aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
+aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
+
+print("Create aGroupOnShell - a group linked to a shell")
+aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", SMESH.EDGE)
+print("aGroupOnShell type =", aGroupOnShell.GetType())
+print("aGroupOnShell size =", aGroupOnShell.Size())
+print("aGroupOnShell ids :", aGroupOnShell.GetListOfID())
+
+print(" ")
+
+print("Modify <LocalLength> hypothesis: 100 -> 50")
+hypLen1.SetLength(50)
+print("Contents of aGroupOnShell changes:")
+print("aGroupOnShell size =", aGroupOnShell.Size())
+print("aGroupOnShell ids :", aGroupOnShell.GetListOfID())
+
+print(" ")
+
+print("Re-compute mesh, contents of aGroupOnShell changes again:")
+mesh.Compute()
+print("aGroupOnShell size =", aGroupOnShell.Size())
+print("aGroupOnShell ids :", aGroupOnShell.GetListOfID())
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
+ aFilterMgr = smesh.CreateFilterManager()
+ aFilter = aFilterMgr.CreateFilter()
+
+ aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
+ aLyingOnGeom.SetGeom(theShape)
+ aLyingOnGeom.SetElementType(theElemType)
+
+ aFilter.SetPredicate(aLyingOnGeom)
+ anIds = aFilter.GetElementsId(theMesh)
+ aFilterMgr.UnRegister()
+
+ aGroup = theMesh.CreateGroup(theElemType, theName)
+ aGroup.Add(anIds)
+
+#Example
+from SMESH_test1 import *
+
+mesh.Compute()
+
+# First way
+BuildGroupLyingOn(mesh.GetMesh(), SMESH.FACE, "Group of faces lying on edge #1", edge )
+
+# Second way
+mesh.MakeGroup("Group of faces lying on edge #2", SMESH.FACE, SMESH.FT_LyingOnGeom, edge)
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+#####################################################################
+#Created :17/02/2005
+#Author :MASLOV Eugeny, KOVALTCHUK Alexey
+#####################################################################
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import os
+import math
+
+#Sketcher_1 creation
+print("Sketcher creation...")
+Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW")
+geompy.addToStudy(Sketcher_1, "Sketcher_1")
+Face_1 = geompy.MakeFace(Sketcher_1, 1)
+geompy.addToStudy(Face_1, "Face_1")
+
+#Line creation
+print("Line creation...")
+Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100))
+geompy.addToStudy(Line_1, "Line_1")
+
+#Prism creation
+print("Prism creation...")
+Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100)
+geompy.addToStudy(Prism_1, "Prism_1")
+
+#Sketcher_2 creation
+print("Sketcher creation...")
+Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0])
+geompy.addToStudy(Sketcher_2, "Sketcher_2")
+Face_2 = geompy.MakeFace(Sketcher_2, 1)
+geompy.addToStudy(Face_2, "Face_2")
+
+#Revolution creation
+print("Revolution creation...")
+Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi)
+geompy.addToStudy(Revolution_1, "Revolution_1")
+
+#Common applying
+print("Common of Revolution and Prism...")
+Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1)
+geompy.addToStudy(Common_1, "Common_1")
+
+#Explode Common_1 on edges
+CommonExplodedListEdges = geompy.SubShapeAll(Common_1, geompy.ShapeType["EDGE"])
+for i in range(0, len(CommonExplodedListEdges)):
+ name = "Edge_"+str(i+1)
+ geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name)
+
+#Fillet applying
+print("Fillet creation...")
+Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [5])
+geompy.addToStudy(Fillet_1, "Fillet_1")
+
+#Chamfer applying
+print("Chamfer creation...")
+cyl_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 50, 0, 45 ), theName='cyl_face')
+cyl_face_id = geompy.GetSubShapeID( Fillet_1, cyl_face )
+top_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 60, 0, 90 ), theName='top_face')
+top_face_id = geompy.GetSubShapeID( Fillet_1, top_face )
+Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, cyl_face_id, top_face_id, theName='Chamfer_1' )
+
+cyl_face = geompy.GetFaceNearPoint( Chamfer_1, geompy.MakeVertex( 80, 0, 85 ), theName='cyl_face')
+cyl_face_id = geompy.GetSubShapeID( Chamfer_1, cyl_face )
+top_face = geompy.GetFaceNearPoint( Chamfer_1, geompy.MakeVertex( 65, 0, 90 ), theName='top_face')
+top_face_id = geompy.GetSubShapeID( Chamfer_1, top_face )
+Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, cyl_face_id, top_face_id, theName='Chamfer_2' )
+
+#Import of the shape from "slots.brep"
+print("Import multi-rotation from the DATA_DIR/Shapes/Brep/slots.brep")
+thePath = os.getenv("DATA_DIR")
+theFileName = os.path.join( thePath,"Shapes","Brep","slots.brep")
+theShapeForCut = geompy.ImportBREP(theFileName)
+geompy.addToStudy(theShapeForCut, "slot.brep_1")
+
+#Cut applying
+print("Cut...")
+Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2)
+Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1")
+
+#Mesh creation
+
+# -- Init --
+shape_mesh = salome.IDToObject( Cut_1_ID )
+
+mesh = smesh.Mesh(shape_mesh, "Nut")
+
+#HYPOTHESIS CREATION
+print("-------------------------- Average length")
+theAverageLength = 5
+algoReg1D = mesh.Segment()
+hAvLength = algoReg1D.LocalLength(theAverageLength)
+print(hAvLength.GetName())
+print(hAvLength.GetId())
+print(hAvLength.GetLength())
+smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength))
+
+print("-------------------------- MaxElementArea")
+theMaxElementArea = 20
+algoMef = mesh.Triangle(smeshBuilder.MEFISTO)
+hArea = algoMef.MaxElementArea( theMaxElementArea )
+print(hArea.GetName())
+print(hArea.GetId())
+print(hArea.GetMaxElementArea())
+smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea))
+
+print("-------------------------- MaxElementVolume")
+theMaxElementVolume = 150
+algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hVolume = algoNg.MaxElementVolume( theMaxElementVolume )
+print(hVolume.GetName())
+print(hVolume.GetId())
+print(hVolume.GetMaxElementVolume())
+smesh.SetName(hVolume, "MaxElementVolume_"+str(theMaxElementVolume))
+
+
+print("-------------------------- compute the mesh of the mechanic piece")
+mesh.Compute()
+
+print("Information about the Nut:")
+print("Number of nodes : ", mesh.NbNodes())
+print("Number of edges : ", mesh.NbEdges())
+print("Number of faces : ", mesh.NbFaces())
+print("Number of triangles : ", mesh.NbTriangles())
+print("Number of quadrangles : ", mesh.NbQuadrangles())
+print("Number of volumes : ", mesh.NbVolumes())
+print("Number of tetrahedrons: ", mesh.NbTetras())
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Tetrahedrization of the geometry generated by the Python script GEOM_Partition1.py
+# Hypothesis and algorithms for the mesh generation are global
+# -- Rayon de la bariere
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+from math import sqrt
+
+
+#---------------------------------------------------------------
+
+barier_height = 7.0
+barier_radius = 5.6 / 2 # Rayon de la bariere
+colis_radius = 1.0 / 2 # Rayon du colis
+colis_step = 2.0 # Distance s�parant deux colis
+cc_width = 0.11 # Epaisseur du complement de colisage
+
+# --
+
+cc_radius = colis_radius + cc_width
+colis_center = sqrt(2.0)*colis_step/2
+
+# --
+
+boolean_common = 1
+boolean_cut = 2
+boolean_fuse = 3
+boolean_section = 4
+
+# --
+
+p0 = geompy.MakeVertex(0.,0.,0.)
+vz = geompy.MakeVectorDXDYDZ(0.,0.,1.)
+
+# --
+
+barier = geompy.MakeCylinder(p0, vz, barier_radius, barier_height)
+
+# --
+
+colis = geompy.MakeCylinder(p0, vz, colis_radius, barier_height)
+cc = geompy.MakeCylinder(p0, vz, cc_radius, barier_height)
+
+colis_cc = geompy.MakeCompound([colis, cc])
+colis_cc = geompy.MakeTranslation(colis_cc, colis_center, 0.0, 0.0)
+
+colis_cc_multi = geompy.MultiRotate1D(colis_cc, vz, 4)
+
+# --
+
+Compound1 = geompy.MakeCompound([colis_cc_multi, barier])
+SubShape_theShape = geompy.SubShapeAll(Compound1,geompy.ShapeType["SOLID"])
+alveole = geompy.MakePartition(SubShape_theShape)
+
+print("Analysis of the geometry to mesh (right after the Partition) :")
+
+subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"])
+
+print("number of Shells in alveole : ", len(subShellList))
+print("number of Faces in alveole : ", len(subFaceList))
+print("number of Edges in alveole : ", len(subEdgeList))
+
+subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"])
+
+## there are 9 sub-shapes
+
+comp1 = geompy.MakeCompound( [ subshapes[0], subshapes[1] ] )
+comp2 = geompy.MakeCompound( [ subshapes[2], subshapes[3] ] )
+comp3 = geompy.MakeCompound( [ subshapes[4], subshapes[5] ] )
+comp4 = geompy.MakeCompound( [ subshapes[6], subshapes[7] ] )
+
+compGOs = []
+compGOs.append( comp1 )
+compGOs.append( comp2 )
+compGOs.append( comp3 )
+compGOs.append( comp4 )
+comp = geompy.MakeCompound( compGOs )
+
+alveole = geompy.MakeCompound( [ comp, subshapes[8] ])
+
+idalveole = geompy.addToStudy(alveole, "alveole")
+
+print("Analysis of the geometry to mesh (right after the MakeCompound) :")
+
+subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"])
+
+print("number of Shells in alveole : ", len(subShellList))
+print("number of Faces in alveole : ", len(subFaceList))
+print("number of Edges in alveole : ", len(subEdgeList))
+
+status = geompy.CheckShape(alveole)
+print(" check status ", status)
+
+
+# ---- init a Mesh with the alveole
+shape_mesh = salome.IDToObject( idalveole )
+
+mesh = smesh.Mesh(shape_mesh, "MeshAlveole")
+
+print("-------------------------- create Hypothesis (In this case global hypothesis are used)")
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegments = 10
+
+regular1D = mesh.Segment()
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
+
+print("-------------------------- MaxElementArea")
+
+maxElementArea = 0.1
+
+mefisto2D = mesh.Triangle()
+hypArea = mefisto2D.MaxElementArea(maxElementArea)
+print(hypArea.GetName())
+print(hypArea.GetId())
+print(hypArea.GetMaxElementArea())
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+print("-------------------------- MaxElementVolume")
+
+maxElementVolume = 0.5
+
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
+
+print("-------------------------- compute the mesh of alveole ")
+ret = mesh.Compute()
+
+if ret != 0:
+ log=mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the Mesh_mechanic:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons: ", mesh.NbTetras())
+else:
+ print("problem when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# GEOM GEOM_SWIG : binding of C++ implementation with Python
+# File : GEOM_Sphere.py
+# Author : Damien COQUERET, Open CASCADE
+# Module : GEOM
+# $Header:
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+# It is an example of creating a hexahedrical mesh on a sphere.
+#
+# Used approach allows to avoid problems with degenerated and
+# seam edges without special processing of geometrical shapes
+
+#-----------------------------------------------------------------------
+#Variables
+Radius = 100.
+Dist = Radius / 2.
+Factor = 2.5
+Angle90 = math.pi / 2.
+NbSeg = 10
+
+PointsList = []
+ShapesList = []
+
+#Basic Elements
+P0 = geompy.MakeVertex(0., 0., 0.)
+P1 = geompy.MakeVertex(-Dist, -Dist, -Dist)
+P2 = geompy.MakeVertex(-Dist, -Dist, Dist)
+P3 = geompy.MakeVertex(-Dist, Dist, Dist)
+P4 = geompy.MakeVertex(-Dist, Dist, -Dist)
+
+VZ = geompy.MakeVectorDXDYDZ(0., 0., 1.)
+
+#Construction Elements
+PointsList.append(P1)
+PointsList.append(P2)
+PointsList.append(P3)
+PointsList.append(P4)
+PointsList.append(P1)
+
+PolyLine = geompy.MakePolyline(PointsList)
+
+Face1 = geompy.MakeFace(PolyLine, 1)
+Face2 = geompy.MakeScaleTransform(Face1, P0, Factor)
+Face3 = geompy.MakeScaleTransform(Face1, P0, -1.)
+
+#Models
+Sphere = geompy.MakeSphereR(Radius)
+
+Block = geompy.MakeHexa2Faces(Face1, Face2)
+Cube = geompy.MakeHexa2Faces(Face1, Face3)
+
+Common1 = geompy.MakeBoolean(Sphere, Block, 1)
+Common2 = geompy.MakeRotation(Common1, VZ, Angle90)
+
+MultiBlock1 = geompy.MakeMultiTransformation1D(Common1, 20, -1, 3)
+MultiBlock2 = geompy.MakeMultiTransformation1D(Common2, 30, -1, 3)
+
+#Reconstruct sphere from several blocks
+ShapesList.append(Cube)
+ShapesList.append(MultiBlock1)
+ShapesList.append(MultiBlock2)
+Compound = geompy.MakeCompound(ShapesList)
+
+Result = geompy.MakeGlueFaces(Compound, 0.1)
+
+#addToStudy
+Id_Sphere = geompy.addToStudy(Sphere, "Sphere")
+Id_Cube = geompy.addToStudy(Cube, "Cube")
+
+Id_Common1 = geompy.addToStudy(Common1, "Common1")
+Id_Common2 = geompy.addToStudy(Common2, "Common2")
+
+Id_MultiBlock1 = geompy.addToStudy(MultiBlock1, "MultiBlock1")
+Id_MultiBlock2 = geompy.addToStudy(MultiBlock2, "MultiBlock2")
+
+Id_Result = geompy.addToStudy(Result, "Result")
+
+#-----------------------------------------------------------------------
+#Meshing
+my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
+algo = my_hexa.Segment()
+algo.NumberOfSegments(NbSeg)
+my_hexa.Quadrangle()
+my_hexa.Hexahedron()
+my_hexa.Compute()
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# SMESH SMESH_SWIG : binding of C++ implementation with Python
+# File : SMESH_blocks.py
+# Author : Julia DOROVSKIKH
+# Module : SMESH
+# $Header$
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+import GEOM_Spanner
+
+isBlocksTest = 0 # False
+isMeshTest = 1 # True
+
+GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh)
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+#==============================================================================
+# Info.
+# Bug (from script, bug) : box.py, PAL5223
+# Modified : 25/11/2004
+# Author : Kovaltchuk Alexey
+# Project : PAL/SALOME
+#==============================================================================
+# Salome geometry and meshing for a box
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+from salome import sg
+
+# Plate
+
+box = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
+boxId = geompy.addToStudy(box,"box")
+
+# ---- SMESH
+
+# ---- init a Mesh
+
+box_mesh=smesh.Mesh(box, "box_mesh")
+
+# set Hypothesis and Algorithm
+
+alg1D = box_mesh.Segment()
+alg1D.SetName("algo1D")
+hypL1 = alg1D.LocalLength(0.25)
+smesh.SetName(hypL1, "LocalLength")
+
+alg2D = box_mesh.Quadrangle()
+alg2D.SetName("algo2D")
+
+alg3D = box_mesh.Hexahedron()
+alg3D.SetName("algo3D")
+
+# compute mesh
+
+box_mesh.Compute()
+
+sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Tetrahedrization of the geometry union of 2 boxes having a face in common
+# Hypothesis and algorithms for the mesh generation are global
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+# ---- define 2 boxes box1 and box2
+
+box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+
+idbox1 = geompy.addToStudy(box1, "box1")
+
+print("Analysis of the geometry box1 :")
+subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
+
+print("number of Shells in box1 : ", len(subShellList))
+print("number of Faces in box1 : ", len(subFaceList))
+print("number of Edges in box1 : ", len(subEdgeList))
+
+box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
+
+idbox2 = geompy.addToStudy(box2, "box2")
+
+print("Analysis of the geometry box2 :")
+subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
+
+print("number of Shells in box2 : ", len(subShellList))
+print("number of Faces in box2 : ", len(subFaceList))
+print("number of Edges in box2 : ", len(subEdgeList))
+
+# append the tow boxes to make ine shel, referrencing only once
+# the internal interface
+
+shell = geompy.MakePartition([box1, box2])
+idshell = geompy.addToStudy(shell, "shell")
+
+print("Analysis of the geometry shell (union of box1 and box2) :")
+subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
+
+print("number of Shells in shell : ", len(subShellList))
+print("number of Faces in shell : ", len(subFaceList))
+print("number of Edges in shell : ", len(subEdgeList))
+
+
+### ---------------------------- SMESH --------------------------------------
+
+# ---- init a Mesh with the shell
+
+mesh = smesh.Mesh(shell, "MeshBox2")
+
+
+# ---- set Hypothesis and Algorithm
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegments = 10
+
+regular1D = mesh.Segment()
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
+
+print("-------------------------- MaxElementArea")
+
+maxElementArea = 500
+
+mefisto2D = mesh.Triangle()
+hypArea = mefisto2D.MaxElementArea(maxElementArea)
+print(hypArea.GetName())
+print(hypArea.GetId())
+print(hypArea.GetMaxElementArea())
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+print("-------------------------- MaxElementVolume")
+
+maxElementVolume = 500
+
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
+
+print("-------------------------- compute shell")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ log = mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the MeshBox2:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons: ", mesh.NbTetras())
+else:
+ print("probleme when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Tetrahedrization of the geometry union of 3 boxes aligned where the middle
+# one has a race in common with the two others.
+# Hypothesis and algorithms for the mesh generation are global
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---- define 3 boxes box1, box2 and box3
+
+box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+
+idbox1 = geompy.addToStudy(box1, "box1")
+
+print("Analysis of the geometry box1 :")
+subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
+
+print("number of Shells in box1 : ", len(subShellList))
+print("number of Faces in box1 : ", len(subFaceList))
+print("number of Edges in box1 : ", len(subEdgeList))
+
+box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
+
+idbox2 = geompy.addToStudy(box2, "box2")
+
+print("Analysis of the geometry box2 :")
+subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
+
+print("number of Shells in box2 : ", len(subShellList))
+print("number of Faces in box2 : ", len(subFaceList))
+print("number of Edges in box2 : ", len(subEdgeList))
+
+box3 = geompy.MakeBox(0., 0., 300., 200., 200., 500.)
+
+idbox3 = geompy.addToStudy(box3, "box3")
+
+print("Analysis of the geometry box3 :")
+subShellList = geompy.SubShapeAll(box3, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box3, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box3, geompy.ShapeType["EDGE"])
+
+print("number of Shells in box3 : ", len(subShellList))
+print("number of Faces in box3 : ", len(subFaceList))
+print("number of Edges in box3 : ", len(subEdgeList))
+
+shell = geompy.MakePartition([box1, box2, box3])
+idshell = geompy.addToStudy(shell,"shell")
+
+print("Analysis of the geometry shell (union of box1, box2 and box3) :")
+subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
+
+print("number of Shells in shell : ", len(subShellList))
+print("number of Faces in shell : ", len(subFaceList))
+print("number of Edges in shell : ", len(subEdgeList))
+
+
+### ---------------------------- SMESH --------------------------------------
+
+# ---- init a Mesh with the shell
+
+mesh = smesh.Mesh(shell, "MeshBox3")
+
+
+# ---- set Hypothesis and Algorithm
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegments = 10
+
+regular1D = mesh.Segment()
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
+
+print("-------------------------- MaxElementArea")
+
+maxElementArea = 500
+
+mefisto2D = mesh.Triangle()
+hypArea = mefisto2D.MaxElementArea(maxElementArea)
+print(hypArea.GetName())
+print(hypArea.GetId())
+print(hypArea.GetMaxElementArea())
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+print("-------------------------- MaxElementVolume")
+
+maxElementVolume = 500
+
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
+
+print("-------------------------- compute shell")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ log = mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the MeshBox3:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons: ", mesh.NbTetras())
+else:
+ print("probleme when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Tetrahedrization of a simple box. Hypothesis and algorithms for
+# the mesh generation are global
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+
+idbox = geompy.addToStudy(box, "box")
+
+print("Analysis of the geometry box :")
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
+
+print("number of Shells in box : ", len(subShellList))
+print("number of Faces in box : ", len(subFaceList))
+print("number of Edges in box : ", len(subEdgeList))
+
+
+### ---------------------------- SMESH --------------------------------------
+
+# ---- init a Mesh with the box
+
+mesh = smesh.Mesh(box, "MeshBox")
+
+# ---- set Hypothesis and Algorithm
+
+print("-------------------------- NumberOfSegments")
+numberOfSegments = 10
+
+regular1D = mesh.Segment()
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
+
+print("-------------------------- MaxElementArea")
+
+maxElementArea = 500
+
+mefisto2D = mesh.Triangle()
+hypArea = mefisto2D.MaxElementArea(maxElementArea)
+print(hypArea.GetName())
+print(hypArea.GetId())
+print(hypArea.GetMaxElementArea())
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+print("-------------------------- MaxElementVolume")
+
+maxElementVolume = 500
+
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
+
+print("-------------------------- compute the mesh of the box")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ log = mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the MeshBox:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons: ", mesh.NbTetras())
+else:
+ print("probleme when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_control.py
+# Author : Sergey LITONIN
+# Module : SMESH
+#
+import salome
+import SMESH_mechanic
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+mesh = SMESH_mechanic.mesh
+
+# ---- Criterion : AREA > 100
+
+# create group
+aGroup = mesh.MakeGroup("Area > 100", SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100)
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Area > 100 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# ---- Criterion : Taper > 3e-15
+
+# create group
+aGroup = mesh.MakeGroup("Taper > 3e-15", SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, 3e-15)
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Taper > 3e-15 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# ---- Criterion : ASPECT RATIO > 1.3
+
+# create group
+aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.3)
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# ---- Criterion : MINIMUM ANGLE < 30
+
+# create group
+aGroup = mesh.MakeGroup("Minimum Angle < 30", SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, 30)
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Minimum Angle < 30 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# ---- Criterion : Warp > 2e-13
+
+# create group
+aGroup = mesh.MakeGroup("Warp > 2e-13", SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, 2e-13 )
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Warp > 2e-13 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# ---- Criterion : Skew > 18
+
+# create group
+aGroup = mesh.MakeGroup("Skew > 18", SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 18 )
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Skew > 18 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# Criterion : Length > 10
+
+# create group
+aGroup = mesh.MakeGroup("Length > 10", SMESH.FACE, SMESH.FT_Length, SMESH.FT_MoreThan, 10 )
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Length > 10 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# Criterion : Borders at multi-connections = 2
+
+# create group
+aGroup = mesh.MakeGroup("Borders at multi-connections = 2", SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, 2)
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Borders at multi-connections = 2 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+# Criterion : Element Diameter 2D > 10
+
+# create group
+aGroup = mesh.MakeGroup("Element Diameter 2D > 10", SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10 )
+
+# print result
+anIds = aGroup.GetIDs()
+print("Criterion: Element Diameter 2D > 10 Nb = ", len( anIds ))
+#for i in range( len( anIds ) ):
+ #print anIds[ i ]
+
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+#==============================================================================
+# Info.
+# Bug (from script, bug) : SMESH_demo_hexa2_upd.py, PAL6781
+# Modified : 25/11/2004
+# Author : Kovaltchuk Alexey
+# Project : PAL/SALOME
+#==============================================================================
+# Tetrahedrization of a geometry (box minus a inner cylinder).
+# Hypothesis and algorithms for the mesh generation are not global:
+# the mesh of some edges is thinner
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+
+# -----------------------------------------------------------------------------
+
+ShapeTypeShell = 3
+ShapeTypeFace = 4
+ShapeTypeEdge = 6
+
+a = math.sqrt(2.)/4.
+ma = - a
+zero = 0.
+un = 1.
+mun= - un
+demi = 1./2.
+
+Orig = geompy.MakeVertex(zero,zero,zero)
+P0 = geompy.MakeVertex(a,a,zero)
+P1 = geompy.MakeVertex(zero,demi,zero)
+P2 = geompy.MakeVertex(ma,a,zero)
+P3 = geompy.MakeVertex(mun,un,zero)
+P4 = geompy.MakeVertex(un,un,zero)
+P5 = geompy.MakeVertex(zero,zero,un)
+
+arc = geompy.MakeArc(P0,P1,P2)
+e1 = geompy.MakeEdge(P2,P3)
+e2 = geompy.MakeEdge(P3,P4)
+e3 = geompy.MakeEdge(P4,P0)
+
+list = []
+list.append(arc)
+list.append(e1)
+list.append(e2)
+list.append(e3)
+
+wire = geompy.MakeWire(list)
+face = geompy.MakeFace(wire,1)
+
+dir = geompy.MakeVector(Orig,P5)
+vol1 = geompy.MakePipe(face,dir)
+
+angle = math.pi/2.
+#dir = geom.MakeVector(Orig,P5)
+vol2 = geompy.MakeRotation(vol1,dir,angle)
+
+vol3 = geompy.MakeRotation(vol2,dir,angle)
+
+vol4 = geompy.MakeRotation(vol3,dir,angle)
+
+list = []
+list.append(vol1)
+list.append(vol2)
+list.append(vol3)
+list.append(vol4)
+
+volComp = geompy.MakeCompound(list)
+
+tol3d = 1.e-3
+vol = geompy.MakeGlueFaces(volComp,tol3d)
+idVol = geompy.addToStudy(vol,"volume")
+
+print("Analysis of the final volume:")
+subShellList = geompy.SubShapeAllSorted(vol,ShapeTypeShell)
+subFaceList = geompy.SubShapeAllSorted(vol,ShapeTypeFace)
+subEdgeList = geompy.SubShapeAllSorted(vol,ShapeTypeEdge)
+
+print("number of Shells in the volume : ",len(subShellList))
+print("number of Faces in the volume : ",len(subFaceList))
+print("number of Edges in the volume : ",len(subEdgeList))
+
+idSubEdge = []
+for k in range(len(subEdgeList)):
+ idSubEdge.append(geompy.addToStudyInFather(vol,subEdgeList[k],"SubEdge"+str(k)))
+
+edgeZ = []
+edgeZ.append(subEdgeList[0])
+edgeZ.append(subEdgeList[3])
+edgeZ.append(subEdgeList[10])
+edgeZ.append(subEdgeList[11])
+edgeZ.append(subEdgeList[20])
+edgeZ.append(subEdgeList[21])
+edgeZ.append(subEdgeList[28])
+edgeZ.append(subEdgeList[31])
+
+idEdgeZ = []
+for i in range(8):
+ idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1)))
+
+### ---------------------------- SMESH --------------------------------------
+smesh.UpdateStudy()
+
+# ---- init a Mesh with the volume
+
+mesh = smesh.Mesh(vol, "meshVolume")
+
+# ---- set Hypothesis and Algorithm to main shape
+
+print("-------------------------- NumberOfSegments the global one")
+
+numberOfSegments = 10
+
+regular1D = mesh.Segment()
+regular1D.SetName("Wire Discretisation")
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments")
+
+
+print("-------------------------- Quadrangle_2D")
+
+quad2D=mesh.Quadrangle()
+quad2D.SetName("Quadrangle_2D")
+
+print("-------------------------- Hexa_3D")
+
+hexa3D=mesh.Hexahedron()
+hexa3D.SetName("Hexa_3D")
+
+
+print("-------------------------- NumberOfSegments in the Z direction")
+
+numberOfSegmentsZ = 40
+
+for i in range(8):
+ print("-------------------------- add hypothesis to edge in the Z directions", (i+1))
+
+ algo = mesh.Segment(edgeZ[i])
+ hyp = algo.NumberOfSegments(numberOfSegmentsZ)
+ smesh.SetName(hyp, "NumberOfSegmentsZ")
+ smesh.SetName(algo.GetSubMesh(), "SubMeshEdgeZ_"+str(i+1))
+
+
+salome.sg.updateObjBrowser()
+
+print("-------------------------- compute the mesh of the volume")
+
+ret=mesh.Compute()
+
+print(ret)
+if ret != 0:
+## log=mesh.GetLog(0) # no erase trace
+## for linelog in log:
+## print linelog
+ print("Information about the MeshBox :")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons: ", mesh.NbTetras())
+else:
+ print("problem when Computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_fix_volute.py
+# Author : Paul RASCLE, EDF
+# Module : SMESH
+# $Header$
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import math
+
+# -----------------------------------------------------------------------------
+
+def MakeFace(lstEdges) :
+ """
+ Create a planar face from 4 edges
+ """
+ wire = geompy.MakeWire(lstEdges)
+ face = geompy.MakeFace(wire, 1)
+ return face
+
+# -----------------------------------------------------------------------------
+
+# ---- dimensions
+
+##longueurPlq = 0.686
+##largeurPlq = 0.573
+##epaisseurPlq = 0.150
+
+##hauteurFlanc = 0.380
+##epaisseurFlanc = 0.112
+##rayonConge = 0.150 - epaisseurFlanc
+
+##epaisseurFond = 0.162
+##rayonTrou = 0.075
+##posAxeTrou = hauteurFlanc -(0.180 + rayonTrou)
+##marge = 0.01
+##tol3d = 1.e-5
+
+longueurPlq = 686
+largeurPlq = 573
+epaisseurPlq = 150
+
+hauteurFlanc = 380
+epaisseurFlanc = 112
+rayonConge = 150 - epaisseurFlanc
+
+epaisseurFond = 162
+rayonTrou = 75
+posAxeTrou = hauteurFlanc - (180 + rayonTrou)
+marge = 10
+tol3d = 1.e-3
+
+# ---- points, directions de base
+
+p0 = geompy.MakeVertex(0., 0., 0.)
+
+vx = geompy.MakeVectorDXDYDZ(100., 0., 0.)
+vy = geompy.MakeVectorDXDYDZ(0., 100., 0.)
+vz = geompy.MakeVectorDXDYDZ(0., 0., 100.)
+
+# ---- ellipse du flanc
+
+he = hauteurFlanc - 2*rayonConge
+re = 0.5*(largeurPlq - epaisseurFond) - rayonConge
+sine = re/he
+cose = math.sqrt(1. - sine*sine)
+
+ve = geompy.MakeVectorDXDYDZ(sine, 0., cose)
+cyl0 = geompy.MakeCylinder(p0, ve, re, 2*he)
+cyl1 = geompy.MakeRotation(cyl0, ve, 0.5)
+cyle = geompy.MakeTranslation(cyl1, -marge*sine, 0., -marge*cose)
+
+pbe = geompy.MakeVertex(3*he, -2*re, 3*he)
+boxe = geompy.MakeBoxTwoPnt(p0, pbe)
+
+cylcoup = geompy.MakeBoolean(cyle, boxe, 2)
+
+aretes = []
+aretes = geompy.SubShapeAllSorted(cylcoup, geompy.ShapeType["EDGE"])
+
+shape = geompy.MakeCopy(aretes[0])
+aShape = geompy.MakeTranslation(shape, 0., rayonConge + re, epaisseurPlq + 2*rayonConge)
+
+
+# -----------------------------------------------------------------------------
+# ---- decoupage de la piece en volumes a 6 faces de 4 cotes
+# -----------------------------------------------------------------------------
+
+# ---- cotes x
+
+x0 = 0.
+x0h = rayonConge
+x1 = rayonConge + epaisseurFlanc
+xc = longueurPlq/2
+x2 = longueurPlq - rayonConge - epaisseurFlanc
+x3h = longueurPlq - rayonConge
+x3 = longueurPlq
+
+# ---- cotes y
+
+y0 = 0.
+y0h = rayonConge
+y1 = largeurPlq - epaisseurFond
+y1m = y1 - marge
+y2 = largeurPlq
+y2p = largeurPlq + marge
+
+# ---- cotes z
+
+z0 = 0.
+z1m = epaisseurPlq - marge
+z1 = epaisseurPlq
+z2 = epaisseurPlq + rayonConge
+z3 = epaisseurPlq + 2*rayonConge
+z4 = epaisseurPlq + hauteurFlanc
+z4p = epaisseurPlq + hauteurFlanc + marge
+
+zc = epaisseurPlq + posAxeTrou
+zc2 = epaisseurPlq + (posAxeTrou - rayonTrou)/3
+zc3 = epaisseurPlq + 2*(posAxeTrou - rayonTrou)/3
+
+# ---- decoupe du fond
+
+p11 = geompy.MakeVertex(x1, y1m, z1)
+p12 = geompy.MakeVertex(x1, y1m, z2)
+p13 = geompy.MakeVertex(x1, y1m, z3)
+p14 = geompy.MakeVertex(x1, y1m, z4)
+pc1 = geompy.MakeVertex(xc, y1m, z1)
+pc2 = geompy.MakeVertex(xc, y1m, zc2)
+pc3 = geompy.MakeVertex(xc, y1m, zc3)
+pcc = geompy.MakeVertex(xc, y1m, zc)
+pc4 = geompy.MakeVertex(xc, y1m, z4)
+p21 = geompy.MakeVertex(x2, y1m, z1)
+p22 = geompy.MakeVertex(x2, y1m, z2)
+p23 = geompy.MakeVertex(x2, y1m, z3)
+p24 = geompy.MakeVertex(x2, y1m, z4)
+pcf = geompy.MakeVertex(xc, y2p, zc)
+
+arc2 = geompy.MakeArc(p12,pc2,p22)
+arc3 = geompy.MakeArc(p13,pc3,p23)
+
+segz1 = geompy.MakeVector(p11,p21)
+segz41 = geompy.MakeVector(p14,pc4)
+segz42 = geompy.MakeVector(pc4,p24)
+segx11 = geompy.MakeVector(p11,p12)
+segx12 = geompy.MakeVector(p12,p13)
+segx13 = geompy.MakeVector(p13,p14)
+segxc2 = geompy.MakeVector(pc1,pc2)
+segxc3 = geompy.MakeVector(pc2,pc3)
+segxc4 = geompy.MakeVector(pcc,pc4)
+segx21 = geompy.MakeVector(p21,p22)
+segx22 = geompy.MakeVector(p22,p23)
+segx23 = geompy.MakeVector(p23,p24)
+segx1c1 = geompy.MakeVector(p13,pcc)
+segx1c2 = geompy.MakeVector(p14,pcc)
+segx2c1 = geompy.MakeVector(p23,pcc)
+segx2c2 = geompy.MakeVector(p24,pcc)
+
+facef = []
+facef.append(MakeFace([segx13,segx1c2,segx1c1]))
+facef.append(MakeFace([segx23,segx2c2,segx2c1]))
+facef.append(MakeFace([segx2c2,segxc4,segz42]))
+facef.append(MakeFace([segx1c2,segz41,segxc4]))
+facef.append(MakeFace([segx1c1,arc3,segx2c1]))
+facef.append(MakeFace([segx12,arc2,segx22,arc3]))
+facef.append(MakeFace([segx11,segz1,segx21,arc2]))
+
+vcccf = geompy.MakeVector(pcc, pcf)
+hcccf = y2p - y1m
+decf = []
+for face in facef:
+ decf.append(geompy.MakePrismVecH(face,vcccf,hcccf))
+
+pc = geompy.MakeVertex(xc, 0., zc)
+py2 = geompy.MakeVertex(xc, y2, zc)
+axeCyl = geompy.MakeVector(pc, py2)
+
+cylFond = geompy.MakeCylinder(pc, vy, rayonTrou, 1.1*largeurPlq)
+cylFond2 = geompy.MakeRotation(cylFond, axeCyl, math.pi)
+
+fondec = []
+for id in (0,1,2,3):
+ fondec.append(geompy.MakeBoolean(decf[id], cylFond2, 2))
+fondec.append(geompy.MakeBoolean(decf[4], cylFond, 2))
+for id in (5,6):
+ fondec.append(decf[id])
+
+p_xcy2pz4p = geompy.MakeVertex(xc,y2p,z4p)
+p_x3y2pz4p = geompy.MakeVertex(x3,y2p,z4p)
+pxc = geompy.MakeVertex(xc,y0,z0)
+bcut1 = geompy.MakeBoxTwoPnt(p0, p_xcy2pz4p)
+bcut2 = geompy.MakeBoxTwoPnt(pxc, p_x3y2pz4p)
+
+fondec2 = []
+for id in (0,1,2,3):
+ fondec2.append(fondec[id])
+for id in (4,5,6):
+ fondec2.append(geompy.MakeBoolean(fondec[id], bcut1, 1))
+ fondec2.append(geompy.MakeBoolean(fondec[id], bcut2, 1))
+
+# ----- autres blocs de decoupe
+
+bcong1 = geompy.MakeBox(x0,y0,z1, x1,y1,z2)
+bcong2 = geompy.MakeBox(x0,y1,z1, x1,y2,z2)
+bcong3 = geompy.MakeBox(x2,y0,z1, x3,y1,z2)
+bcong4 = geompy.MakeBox(x2,y1,z1, x3,y2,z2)
+
+pcylx0 = geompy.MakeVertex(0., -marge, z2)
+pcylx3 = geompy.MakeVertex(longueurPlq, -marge, z2)
+pcyly0 = geompy.MakeVertex(-marge, 0., z2)
+
+cylcongx0 = geompy.MakeCylinder(pcylx0, vy, rayonConge, largeurPlq + 2*marge)
+cylcongx3 = geompy.MakeCylinder(pcylx3, vy, rayonConge, largeurPlq + 2*marge)
+cylcongy0 = geompy.MakeCylinder(pcyly0, vx, rayonConge, longueurPlq + 2*marge)
+
+bcong1 = geompy.MakeBoolean(bcong1,cylcongx0,2)
+bcong2 = geompy.MakeBoolean(bcong2,cylcongx0,2)
+bcong1 = geompy.MakeBoolean(bcong1,cylcongy0,2)
+#NRI : inverse order of BOP
+bcong3 = geompy.MakeBoolean(bcong3,cylcongy0,2)
+bcong3 = geompy.MakeBoolean(bcong3,cylcongx3,2)
+bcong4 = geompy.MakeBoolean(bcong4,cylcongx3,2)
+
+pf1 = geompy.MakeVertex(0., y0h, z3)
+pf2 = geompy.MakeVertex(0., y1, z3)
+pf3 = geompy.MakeVertex(0., y1, z4)
+pf4 = geompy.MakeVertex(0., 0.5*(largeurPlq - epaisseurFond) , z4)
+
+vf1 = geompy.MakeEdge(pf1, pf2)
+vf2 = geompy.MakeEdge(pf2, pf3)
+vf3 = geompy.MakeEdge(pf3, pf4)
+
+faceFlanc = MakeFace([vf1,vf2,vf3,aShape])
+
+flanc1 = geompy.MakePrismVecH(faceFlanc, vx, epaisseurFlanc)
+flanc2 = geompy.MakeCopy(flanc1)
+flanc1 = geompy.MakeTranslation(flanc1, rayonConge, 0., 0.)
+flanc2 = geompy.MakeTranslation(flanc2, longueurPlq - rayonConge - epaisseurFlanc, 0., 0.)
+
+# ---- constitution et decoupe des blocs
+boxfond2 = geompy.MakeBox(x0, y1, z0, x3, y2, z4p)
+
+blocs = []
+for dec in fondec2:
+ blocs.append(geompy.MakeBoolean(boxfond2, dec, 1))
+
+blocs.append(geompy.MakeBox(x0,y1,z0, x1,y2,z1))
+blocs.append(geompy.MakeBox(x1,y1,z0, xc,y2,z1))
+blocs.append(geompy.MakeBox(xc,y1,z0, x2,y2,z1))
+blocs.append(geompy.MakeBox(x2,y1,z0, x3,y2,z1))
+blocs.append(geompy.MakeBox(x0,y0,z0, x1,y1,z1))
+blocs.append(geompy.MakeBox(x1,y0,z0, xc,y1,z1))
+blocs.append(geompy.MakeBox(xc,y0,z0, x2,y1,z1))
+blocs.append(geompy.MakeBox(x2,y0,z0, x3,y1,z1))
+blocs.append(bcong2)
+blocs.append(bcong4)
+blocs.append(bcong1)
+blocs.append(bcong3)
+blocs.append(geompy.MakeBox(x0h,y1, z2, x1, y2, z3))
+blocs.append(geompy.MakeBox(x2, y1, z2, x3h,y2, z3))
+blocs.append(geompy.MakeBox(x0h,y0h,z2, x1, y1, z3))
+blocs.append(geompy.MakeBox(x2, y0h,z2, x3h,y1, z3))
+blocs.append(geompy.MakeBox(x0h,y1, z3, x1, y2, z4))
+blocs.append(geompy.MakeBox(x2, y1, z3, x3h,y2, z4))
+blocs.append(flanc1)
+blocs.append(flanc2)
+
+compbloc = geompy.MakeCompound(blocs)
+idcomp = geompy.addToStudy(compbloc, "compbloc")
+
+# ---- eliminer les faces en double, solid-->shell
+
+compshell = geompy.MakeGlueFaces(compbloc,tol3d)
+idcomp = geompy.addToStudy(compshell, "compshell")
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Hexahedrization of the geometry generated by the Python script
+# SMESH_fixation.py
+# Hypothesis and algorithms for the mesh generation are global
+#
+import salome
+import SMESH_fixation
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+compshell = SMESH_fixation.compshell
+idcomp = SMESH_fixation.idcomp
+geompy = SMESH_fixation.geompy
+salome = SMESH_fixation.salome
+
+print("Analysis of the geometry to be meshed :")
+subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
+
+print("number of Shells in compshell : ", len(subShellList))
+print("number of Faces in compshell : ", len(subFaceList))
+print("number of Edges in compshell : ", len(subEdgeList))
+
+status = geompy.CheckShape(compshell)
+print(" check status ", status)
+
+### ---------------------------- SMESH --------------------------------------
+smesh.UpdateStudy()
+
+# ---- init a Mesh with the compshell
+shape_mesh = salome.IDToObject( idcomp )
+
+mesh = smesh.Mesh(shape_mesh, "MeshCompShell")
+
+
+# ---- set Hypothesis and Algorithm
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegments = 5
+
+regular1D = mesh.Segment()
+regular1D.SetName("Wire Discretisation")
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
+
+print("-------------------------- Quadrangle_2D")
+
+quad2D = mesh.Quadrangle()
+quad2D.SetName("Quadrangle_2D")
+
+print("-------------------------- Hexa_3D")
+
+hexa3D = mesh.Hexahedron()
+hexa3D.SetName("Hexa_3D")
+
+print("-------------------------- compute compshell")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ log = mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the MeshcompShel:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of quadrangles : ", mesh.NbQuadrangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of hexahedrons : ", mesh.NbHexas())
+else:
+ print("problem when Computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Tetrahedrization of the geometry generated by the Python script
+# SMESH_fixation.py
+# The new Netgen algorithm is used that discretizes baoundaries itself
+#
+import salome
+import SMESH_fixation
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+compshell = SMESH_fixation.compshell
+idcomp = SMESH_fixation.idcomp
+geompy = SMESH_fixation.geompy
+salome = SMESH_fixation.salome
+
+print("Analysis of the geometry to be meshed :")
+subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
+
+print("number of Shells in compshell : ", len(subShellList))
+print("number of Faces in compshell : ", len(subFaceList))
+print("number of Edges in compshell : ", len(subEdgeList))
+
+status = geompy.CheckShape(compshell)
+print(" check status ", status)
+
+### ---------------------------- SMESH --------------------------------------
+smesh.UpdateStudy()
+
+print("-------------------------- create Mesh, algorithm, hypothesis")
+
+mesh = smesh.Mesh(compshell, "MeshcompShel");
+netgen = mesh.Tetrahedron(smeshBuilder.FULL_NETGEN)
+netgen.SetMaxSize( 50 )
+#netgen.SetSecondOrder( 0 )
+netgen.SetFineness( smeshBuilder.Fine )
+#netgen.SetOptimize( 1 )
+
+print("-------------------------- compute mesh")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ print("Information about the MeshcompShel:")
+ print("Number of nodes : ", mesh.GetMesh().NbNodes())
+ print("Number of edges : ", mesh.GetMesh().NbEdges())
+ print("Number of faces : ", mesh.GetMesh().NbFaces())
+ print("Number of triangles : ", mesh.GetMesh().NbTriangles())
+ print("Number of volumes : ", mesh.GetMesh().NbVolumes())
+ print("Number of tetrahedrons : ", mesh.GetMesh().NbTetras())
+
+else:
+ print("problem when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Tetrahedrization of the geometry generated by the Python script
+# SMESH_fixation.py
+# Hypothesis and algorithms for the mesh generation are global
+#
+import salome
+import SMESH_fixation
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+compshell = SMESH_fixation.compshell
+idcomp = SMESH_fixation.idcomp
+geompy = SMESH_fixation.geompy
+salome = SMESH_fixation.salome
+
+print("Analysis of the geometry to be meshed :")
+subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
+
+print("number of Shells in compshell : ", len(subShellList))
+print("number of Faces in compshell : ", len(subFaceList))
+print("number of Edges in compshell : ", len(subEdgeList))
+
+status = geompy.CheckShape(compshell)
+print(" check status ", status)
+
+### ---------------------------- SMESH --------------------------------------
+smesh.UpdateStudy()
+
+# ---- init a Mesh with the compshell
+
+mesh = smesh.Mesh(compshell, "MeshcompShell")
+
+
+# ---- set Hypothesis and Algorithm
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegments = 5
+
+regular1D = mesh.Segment()
+regular1D.SetName("Wire Discretisation")
+hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
+
+## print "-------------------------- MaxElementArea"
+
+## maxElementArea = 80
+
+## mefisto2D = mesh.Triangle()
+## mefisto2D.SetName("MEFISTO_2D")
+## hypArea = mefisto2D.MaxElementArea(maxElementArea)
+## print hypArea.GetName()
+## print hypArea.GetId()
+## print hypArea.GetMaxElementArea()
+## smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+print("-------------------------- LengthFromEdges")
+
+mefisto2D = mesh.Triangle()
+mefisto2D.SetName("MEFISTO_2D")
+hypLengthFromEdges = mefisto2D.LengthFromEdges()
+print(hypLengthFromEdges.GetName())
+print(hypLengthFromEdges.GetId())
+smesh.SetName(hypLengthFromEdges, "LengthFromEdges")
+
+
+print("-------------------------- MaxElementVolume")
+
+maxElementVolume = 1000
+
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
+netgen3D.SetName("NETGEN_3D")
+hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
+
+print("-------------------------- compute compshell")
+ret = mesh.Compute(mesh)
+print(ret)
+if ret != 0:
+ log = mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the MeshcompShel:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons : ", mesh.NbTetras())
+
+else:
+ print("problem when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Triangulation of the skin of the geometry from a Brep representing a plane
+# Hypothesis and algorithms for the mesh generation are global
+#
+import os
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+# ---------------------------- GEOM --------------------------------------
+
+# import a BRep
+#before running this script, please be sure about
+#the path the file fileName
+
+filePath = os.environ["DATA_DIR"]
+filePath = filePath + "/Shapes/Brep/"
+
+filename = "flight_solid.brep"
+filename = filePath + filename
+
+shape = geompy.Import(filename, "BREP")
+idShape = geompy.addToStudy(shape, "flight")
+
+print("Analysis of the geometry flight :")
+subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"])
+
+print("number of Shells in flight : ", len(subShellList))
+print("number of Faces in flight : ", len(subFaceList))
+print("number of Edges in flight : ", len(subEdgeList))
+
+
+### ---------------------------- SMESH --------------------------------------
+smesh.UpdateStudy()
+
+# ---- init a Mesh with the shell
+shape_mesh = salome.IDToObject( idShape )
+
+mesh = smesh.Mesh(shape_mesh, "MeshFlight")
+
+
+# ---- set Hypothesis and Algorithm
+
+print("-------------------------- LocalLength")
+
+lengthOfSegments = 0.3
+
+regular1D = mesh.Segment()
+hypLength = regular1D.LocalLength(lengthOfSegments)
+print(hypLength.GetName())
+print(hypLength.GetId())
+print(hypLength.GetLength())
+smesh.SetName(hypLength, "LocalLength_" + str(lengthOfSegments))
+
+print("-------------------------- LengthFromEdges")
+
+mefisto2D = mesh.Triangle()
+hypLengthFromEdge = mefisto2D.LengthFromEdges()
+print(hypLengthFromEdge.GetName())
+print(hypLengthFromEdge.GetId())
+smesh.SetName(hypLengthFromEdge,"LengthFromEdge")
+
+print("-------------------------- compute the skin flight")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ log = mesh.GetLog(0) # no erase trace
+ # for linelog in log:
+ # print(linelog)
+ print("Information about the Mesh_mechanic_tetra:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+else:
+ print("probleme when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+# Create box without one plane
+
+box = geompy.MakeBox(0., 0., 0., 10., 20., 30.)
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+
+FaceList = []
+for i in range( 5 ):
+ FaceList.append( subShapeList[ i ] )
+
+aComp = geompy.MakeCompound( FaceList )
+aBox = geompy.Sew( aComp, 1. )
+idbox = geompy.addToStudy( aBox, "box" )
+
+aBox = salome.IDToObject( idbox )
+
+# Create mesh
+smesh.UpdateStudy()
+
+mesh = smesh.Mesh(aBox, "Mesh_freebord")
+
+algoReg = mesh.Segment()
+hypNbSeg = algoReg.NumberOfSegments(5)
+
+algoMef = mesh.Triangle()
+hypArea = algoMef.MaxElementArea(20)
+
+
+mesh.Compute()
+
+
+# Criterion : Free edges. Create group.
+
+aCriterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_FreeEdges)
+
+aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion)
+
+anIds = aGroup.GetIDs()
+
+# print result
+print("Criterion: Free edges Nb = ", len( anIds ))
+for i in range( len( anIds ) ):
+ print(anIds[ i ])
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# -----------------------------------------------------------------------------
+
+p0 = geompy.MakeVertex(0., 0., 0.)
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex(0., 100., 0.)
+pz = geompy.MakeVertex(0., 0., 100.)
+vx = geompy.MakeVector(p0, px)
+vy = geompy.MakeVector(p0, py)
+vz = geompy.MakeVector(p0, pz)
+
+sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
+sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
+sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
+sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
+ptcyle = geompy.MakeVertex(0., -300., -450.)
+cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
+
+vol1=geompy.MakeCut(sphereExt,sphereA)
+vol2=geompy.MakeCut(vol1,sphereB)
+vol3=geompy.MakeCut(vol2,cylindre)
+blob=geompy.MakeCut(vol3,sphereInt)
+blob=geompy.RemoveExtraEdges(blob)
+
+idblob = geompy.addToStudy(blob,"blob")
+
+edgeGroups = geompy.Propagate( blob )
+assert len( edgeGroups ) == 3
+
+salome.sg.updateObjBrowser()
+
+# -----------------------------------------------------------------------------
+
+print("-------------------------- mesh")
+smesh.UpdateStudy()
+
+# ---- define a mesh on the geom shape 'blob'
+mesh=smesh.Mesh(blob, "MeshBlob")
+
+# ---- assign global hypothesis and algorithms to mesh
+print("-------------------------- add hypothesis to mesh")
+algo1 = mesh.Segment()
+algo2 = mesh.Quadrangle()
+algo3 = mesh.Hexahedron()
+
+# ---- assign local hypothesis and algorithms to mesh
+for edges in edgeGroups: # loop on groups of logically parallel edges
+ length = geompy.BasicProperties( edges )[0]
+ if length < 500: nbSeg = 4
+ elif length < 2000: nbSeg = 10
+ else: nbSeg = 15
+ algo = mesh.Segment( edges )
+ algo.NumberOfSegments( nbSeg )
+ pass
+
+# ---- compute mesh
+print("-------------------------- compute mesh")
+ok = mesh.Compute()
+if ok:
+ print("Information about the Mesh:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of quadrangles : ", mesh.NbQuadrangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of hexahedrons : ", mesh.NbHexas())
+else:
+ print("problem when Computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_withHole.py
+# Author : Lucien PIGNOLONI
+# Module : SMESH
+# $Header$
+#-------------------------------------------------------------------------
+#
+import salome
+salome.salome_init_without_session()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+from salome.StdMeshers import StdMeshersBuilder
+
+# ---------------------------- GEOM --------------------------------------
+
+# ---- define contiguous arcs and segment to define a closed wire
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
+
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
+
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
+
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
+
+# ---- define a closed wire with arcs and segment
+List1 = []
+List1.append( arc1 )
+List1.append( seg1 )
+List1.append( arc2 )
+List1.append( arc3 )
+
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
+
+# ---- define a planar face with wire
+WantPlanarFace = 1 #True
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
+
+# ---- create a shape by extrusion
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
+
+prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1" )
+
+# ---- create two cylinders
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
+
+radius = 20.0
+height = 180.0
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
+
+Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
+Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
+
+# ---- cut with cyl1
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
+
+# ---- fuse with cyl2 to obtain the final mechanic piece :)
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
+
+# ---- explode on faces
+SubFaceL = geompy.SubShapeAllSorted(mechanic, geompy.ShapeType["FACE"])
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face1 = SubFaceL[0]
+name = geompy.SubShapeName( sub_face1, mechanic )
+
+Id_SubFace1 = geompy.addToStudyInFather( mechanic, sub_face1, name )
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face2 = SubFaceL[4]
+name = geompy.SubShapeName( sub_face2, mechanic )
+
+Id_SubFace2 = geompy.addToStudyInFather( mechanic, sub_face2, name )
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face3 = SubFaceL[5]
+name = geompy.SubShapeName( sub_face3, mechanic )
+
+Id_SubFace3 = geompy.addToStudyInFather( mechanic, sub_face3, name )
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face4 = SubFaceL[10]
+name = geompy.SubShapeName( sub_face4, mechanic )
+
+Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
+
+# ---------------------------- SMESH --------------------------------------
+smesh.UpdateStudy()
+
+# -- Init --
+shape_mesh = salome.IDToObject( Id_mechanic )
+
+mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic")
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegment = 10
+
+algo = mesh.Segment()
+hypNbSeg = algo.NumberOfSegments(numberOfSegment)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_10")
+
+print("-------------------------- MaxElementArea")
+
+maxElementArea = 25
+
+algo = mesh.Triangle()
+hypArea25 = algo.MaxElementArea(maxElementArea)
+print(hypArea25.GetName())
+print(hypArea25.GetId())
+print(hypArea25.GetMaxElementArea())
+smesh.SetName(hypArea25, "MaxElementArea_25")
+
+# Create submesh on sub_face1 - sub_face4
+# ---------------------------------------
+
+# Set 2D algorithm to submesh on sub_face1
+algo = mesh.Quadrangle(sub_face1)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace1")
+
+# Set 2D algorithm to submesh on sub_face2
+algo = mesh.Quadrangle(sub_face2)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace2")
+
+# Set 2D algorithm to submesh on sub_face3
+algo = mesh.Quadrangle(sub_face3)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace3")
+
+# Set 2D algorithm to submesh on sub_face4
+algo = mesh.Quadrangle(sub_face4)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace4")
+
+print("-------------------------- compute the mesh of the mechanic piece")
+
+mesh.Compute()
+
+print("Information about the Mesh_mechanic:")
+print("Number of nodes : ", mesh.NbNodes())
+print("Number of edges : ", mesh.NbEdges())
+print("Number of faces : ", mesh.NbFaces())
+print("Number of triangles : ", mesh.NbTriangles())
+print("Number of quadrangles : ", mesh.NbQuadrangles())
+print("Number of volumes : ", mesh.NbVolumes())
+print("Number of tetrahedrons: ", mesh.NbTetras())
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_withHole.py
+# Author : Lucien PIGNOLONI
+# Module : SMESH
+# $Header$
+#-------------------------------------------------------------------------
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---------------------------- GEOM --------------------------------------
+
+# ---- define contiguous arcs and segment to define a closed wire
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
+
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
+
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
+
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
+
+# ---- define a closed wire with arcs and segment
+List1 = []
+List1.append( arc1 )
+List1.append( seg1 )
+List1.append( arc2 )
+List1.append( arc3 )
+
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
+
+# ---- define a planar face with wire
+WantPlanarFace = 1 #True
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
+
+# ---- create a shape by extrusion
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
+
+prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1" )
+
+# ---- create two cylinders
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
+
+radius = 20.0
+height = 180.0
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
+
+Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
+Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
+
+# ---- cut with cyl1
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
+
+# ---- fuse with cyl2 to obtain the final mechanic piece :)
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
+
+# ---- explode on faces
+SubFaceL = geompy.SubShapeAllSorted(mechanic, geompy.ShapeType["FACE"])
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face1 = SubFaceL[0]
+name = geompy.SubShapeName( sub_face1, mechanic )
+
+Id_SubFace1 = geompy.addToStudyInFather( mechanic, sub_face1, name )
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face2 = SubFaceL[4]
+name = geompy.SubShapeName( sub_face2, mechanic )
+
+Id_SubFace2 = geompy.addToStudyInFather( mechanic, sub_face2, name )
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face3 = SubFaceL[5]
+name = geompy.SubShapeName( sub_face3, mechanic )
+
+Id_SubFace3 = geompy.addToStudyInFather( mechanic, sub_face3, name )
+
+# ---- add a face sub-shape in study to be meshed different
+sub_face4 = SubFaceL[10]
+name = geompy.SubShapeName( sub_face4, mechanic )
+
+Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
+
+# ---------------------------- SMESH --------------------------------------
+
+# -- Init --
+shape_mesh = salome.IDToObject( Id_mechanic )
+
+mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic")
+
+print("-------------------------- NumberOfSegments")
+
+numberOfSegment = 10
+
+algo = mesh.Segment()
+hypNbSeg = algo.NumberOfSegments(numberOfSegment)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment))
+
+
+print("-------------------------- MaxElementArea")
+
+maxElementArea = 25
+
+algo = mesh.Triangle()
+hypArea25 = algo.MaxElementArea(maxElementArea)
+print(hypArea25.GetName())
+print(hypArea25.GetId())
+print(hypArea25.GetMaxElementArea())
+smesh.SetName(hypArea25, "MaxElementArea_" + str(maxElementArea))
+
+
+# Create submesh on sub_face1 - sub_face4
+# ---------------------------------------
+
+# Set 2D algorithm to submesh on sub_face1
+algo = mesh.Quadrangle(sub_face1)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace1")
+submesh1 = algo.GetSubMesh()
+
+# Set 2D algorithm to submesh on sub_face2
+algo = mesh.Quadrangle(sub_face2)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace2")
+submesh2 = algo.GetSubMesh()
+
+# Set 2D algorithm to submesh on sub_face3
+algo = mesh.Quadrangle(sub_face3)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace3")
+submesh3 = algo.GetSubMesh()
+
+# Set 2D algorithm to submesh on sub_face4
+algo = mesh.Quadrangle(sub_face4)
+smesh.SetName(algo.GetSubMesh(), "SubMeshFace4")
+submesh4 = algo.GetSubMesh()
+
+
+print("-------------------------- compute the mesh of the mechanic piece")
+
+mesh.Compute()
+
+print("Information about the Mesh_mechanic:")
+print("Number of nodes : ", mesh.NbNodes())
+print("Number of edges : ", mesh.NbEdges())
+print("Number of faces : ", mesh.NbFaces())
+print("Number of triangles : ", mesh.NbTriangles())
+print("Number of quadrangles : ", mesh.NbQuadrangles())
+print("Number of volumes : ", mesh.NbVolumes())
+print("Number of tetrahedrons: ", mesh.NbTetras())
+
+
+#1 cutting of quadrangles of the 'SubMeshFace2' submesh
+mesh.SplitQuadObject(submesh2, 1)
+
+#2 cutting of triangles of the group
+FacesTriToQuad = [ 2391, 2824, 2825, 2826, 2827, 2828, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2841, 2844, 2845, 2847, 2854, 2861, 2863, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2940, 2941, 2946, 2951, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985 ]
+GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", SMESH.FACE, FacesTriToQuad)
+mesh.TriToQuadObject(GroupTriToQuad, SMESH.FT_AspectRatio , 1.57)
+
+#3 extrusion of the group
+point = SMESH.PointStruct(0, 0, 5)
+vector = SMESH.DirStruct(point)
+mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5)
+
+#4 mirror object
+mesh.Mirror([], SMESH.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0)
+
+#5 mesh translation
+point = SMESH.PointStruct(10, 10, 10)
+vector = SMESH.DirStruct(point)
+mesh.Translate([], vector, 0)
+
+#6 mesh rotation
+axisXYZ = SMESH.AxisStruct(0, 0, 0, 10, 10, 10)
+angle180 = 180*3.141/180
+mesh.Rotate([], axisXYZ, angle180, 0)
+
+#7 group smoothing
+FacesSmooth = [864, 933, 941, 950, 1005, 1013]
+GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", SMESH.FACE, FacesSmooth)
+mesh.SmoothObject(GroupSmooth, [], 20, 2, smesh.CENTROIDAL_SMOOTH)
+
+#8 rotation sweep object
+FacesRotate = [492, 493, 502, 503]
+GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", SMESH.FACE, FacesRotate)
+angle45 = 45*3.141/180
+axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632)
+mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5)
+
+#9 reorientation of the submesh1
+mesh.ReorientObject(submesh1)
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# Quadrangulation of the geometry generated by the Python script
+# SMESH_mechanic.py
+# The new Netgen algorithm is used that discretizes baoundaries itself
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---------------------------- GEOM --------------------------------------
+
+# ---- define contiguous arcs and segment to define a closed wire
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
+
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
+
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
+
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
+
+# ---- define a closed wire with arcs and segment
+List1 = []
+List1.append( arc1 )
+List1.append( seg1 )
+List1.append( arc2 )
+List1.append( arc3 )
+
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
+
+# ---- define a planar face with wire
+WantPlanarFace = 1 #True
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
+
+# ---- create a shape by extrusion
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
+
+prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1")
+
+# ---- create two cylinders
+
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
+radius = 20.0
+height = 180.0
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
+
+Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
+Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
+
+# ---- cut with cyl1
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
+
+# ---- fuse with cyl2 to obtain the final mechanic piece :)
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
+
+# ---- Analysis of the geometry
+
+print("Analysis of the geometry mechanic :")
+
+subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"])
+
+print("number of Shells in mechanic : ",len(subShellList))
+print("number of Faces in mechanic : ",len(subFaceList))
+print("number of Edges in mechanic : ",len(subEdgeList))
+
+### ---------------------------- SMESH --------------------------------------
+
+print("-------------------------- create Mesh, algorithm, hypothesis")
+
+mesh = smesh.Mesh(mechanic, "Mesh_mechanic");
+netgen = mesh.Triangle(smeshBuilder.NETGEN)
+netgen.SetMaxSize( 50 )
+#netgen.SetSecondOrder( 0 )
+netgen.SetFineness( smeshBuilder.Fine )
+netgen.SetQuadAllowed( 1 )
+#netgen.SetOptimize( 1 )
+
+print("-------------------------- compute mesh")
+ret = mesh.Compute()
+print(ret)
+if ret != 0:
+ print("Information about the MeshcompShel:")
+ print("Number of nodes : ", mesh.NbNodes())
+ print("Number of edges : ", mesh.NbEdges())
+ print("Number of faces : ", mesh.NbFaces())
+ print("Number of triangles : ", mesh.NbTriangles())
+ print("Number of quadrangles : ", mesh.NbQuadrangles())
+ print("Number of volumes : ", mesh.NbVolumes())
+ print("Number of tetrahedrons : ", mesh.NbTetras())
+
+else:
+ print("problem when computing the mesh")
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_withHole.py
+# Author : Lucien PIGNOLONI
+# Module : SMESH
+# $Header$
+#
+import salome
+salome.salome_init_without_session()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---------------------------- GEOM --------------------------------------
+
+# ---- define contiguous arcs and segment to define a closed wire
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
+
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
+
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
+
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
+
+# ---- define a closed wire with arcs and segment
+List1 = []
+List1.append( arc1 )
+List1.append( seg1 )
+List1.append( arc2 )
+List1.append( arc3 )
+
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
+
+# ---- define a planar face with wire
+WantPlanarFace = 1 #True
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
+
+# ---- create a shape by extrusion
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
+
+prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1")
+
+# ---- create two cylinders
+
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
+radius = 20.0
+height = 180.0
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
+
+Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
+Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
+
+# ---- cut with cyl1
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
+
+# ---- fuse with cyl2 to obtain the final mechanic piece :)
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
+
+# ---- Analysis of the geometry
+
+print("Analysis of the geometry mechanic :")
+
+subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"])
+
+print("number of Shells in mechanic : ",len(subShellList))
+print("number of Faces in mechanic : ",len(subFaceList))
+print("number of Edges in mechanic : ",len(subEdgeList))
+
+### ---------------------------- SMESH --------------------------------------
+
+shape_mesh = salome.IDToObject( Id_mechanic )
+
+mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic_tetra")
+
+print("-------------------------- add hypothesis to main mechanic")
+
+numberOfSegment = 10
+
+algo1 = mesh.Segment()
+hypNbSeg = algo1.NumberOfSegments(numberOfSegment)
+print(hypNbSeg.GetName())
+print(hypNbSeg.GetId())
+print(hypNbSeg.GetNumberOfSegments())
+smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment))
+
+
+maxElementArea = 20
+
+algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
+hypArea = algo2.MaxElementArea(maxElementArea)
+print(hypArea.GetName())
+print(hypArea.GetId())
+print(hypArea.GetMaxElementArea())
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
+
+
+maxElementVolume = 20
+
+algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN)
+hypVolume = algo3.MaxElementVolume(maxElementVolume)
+print(hypVolume.GetName())
+print(hypVolume.GetId())
+print(hypVolume.GetMaxElementVolume())
+smesh.SetName(hypVolume, "maxElementVolume_" + str(maxElementVolume))
+
+
+print("-------------------------- compute the mesh of the mechanic piece")
+mesh.Compute()
+
+print("Information about the Mesh_mechanic_tetra:")
+print("Number of nodes : ", mesh.NbNodes())
+print("Number of edges : ", mesh.NbEdges())
+print("Number of faces : ", mesh.NbFaces())
+print("Number of triangles : ", mesh.NbTriangles())
+print("Number of quadrangles: ", mesh.NbQuadrangles())
+print("Number of volumes : ", mesh.NbVolumes())
+print("Number of tetrahedrons: ", mesh.NbTetras())
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_reg.py
+# Module : SMESH
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+from salome.StdMeshers import StdMeshersBuilder
+
+
+# ---- define a box
+print("Define box")
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# ---- add faces of box to study
+print("Add faces to study")
+idface = []
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+for f in subShapeList:
+ name = geompy.SubShapeName(f, box)
+ print(name)
+ idface.append( geompy.addToStudyInFather(box, f, name) )
+
+# ---- add edges of box to study
+print("Add edges to study")
+idedge = []
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
+for f in subShapeList:
+ name = geompy.SubShapeName(f, box)
+ print(name)
+ idedge.append( geompy.addToStudyInFather(box, f, name) )
+
+salome.sg.updateObjBrowser()
+
+# ---- launch SMESH
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init()
+smesh.UpdateStudy()
+
+# ---- Creating meshes
+
+box = salome.IDToObject(idbox)
+names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ]
+
+
+print("-------------------------- Create ", names[0], " mesh")
+mesh = smesh.Mesh(box, names[0])
+algo = mesh.Segment()
+hyp = algo.NumberOfSegments(7)
+hyp.SetDistrType(0)
+smesh.SetName(hyp, "NumberOfSegmentsReg")
+algo = mesh.Triangle()
+algo.MaxElementArea(2500)
+
+print("-------------------------- Create ", names[1], " mesh")
+mesh = smesh.Mesh(box, names[1])
+algo = mesh.Segment()
+hyp = algo.NumberOfSegments(7)
+hyp.SetDistrType(1)
+hyp.SetScaleFactor(2)
+smesh.SetName(hyp, "NumberOfSegmentsScale")
+algo = mesh.Triangle()
+algo.MaxElementArea(2500)
+
+print("-------------------------- Create ", names[2], " mesh")
+mesh = smesh.Mesh(box,names[2])
+algo = mesh.Segment()
+hyp = algo.NumberOfSegments(7)
+hyp.SetDistrType(2)
+hyp.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] )
+hyp.SetConversionMode(0)
+smesh.SetName(hyp, "NumberOfSegmentsTable")
+algo = mesh.Triangle()
+algo.MaxElementArea(2500)
+
+print("-------------------------- Create ", names[3], " mesh")
+mesh = smesh.Mesh(box, names[3])
+algo = mesh.Segment()
+hyp = algo.NumberOfSegments(10)
+hyp.SetDistrType(3)
+hyp.SetExpressionFunction("sin(3*t)")
+hyp.SetConversionMode(1)
+smesh.SetName(hyp, "NumberOfSegmentsExpr")
+algo = mesh.Triangle()
+algo.MaxElementArea(2500)
+
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
+# File : SMESH_test.py
+# Module : SMESH
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idb = geompy.addToStudy(box, "box")
+
+# ---- add first face of box in study
+
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+idf = geompy.addToStudyInFather(box, face, name)
+
+# ---- add shell from box in study
+
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+shell = subShellList[0]
+name = geompy.SubShapeName(shell, box)
+ids = geompy.addToStudyInFather(box, shell, name)
+
+# ---- add first edge of face in study
+
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0];
+name = geompy.SubShapeName(edge, face)
+ide = geompy.addToStudyInFather(face, edge, name)
+
+# ---- SMESH
+
+smesh.UpdateStudy()
+box = salome.IDToObject(idb)
+mesh = smesh.Mesh(box, "Meshbox")
+
+print("-------------------------- add hypothesis to box")
+
+algo_1 = mesh.Segment(box)
+hyp = algo_1.LocalLength(100)
+print(hyp.GetName())
+print(hyp.GetId())
+print(hyp.GetLength())
+
+algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box)
+hyp = algo_2.MaxElementArea(5000)
+print(hyp.GetName())
+print(hyp.GetId())
+print(hyp.GetMaxElementArea())
+
+smesh.SetName(algo_2.GetSubMesh(), "SubMeshBox")
+
+
+print("-------------------------- add hypothesis to edge")
+
+edge = salome.IDToObject(ide)
+
+algo_3 = mesh.Segment(edge)
+hyp = algo_3.LocalLength(100)
+print(hyp.GetName())
+print(hyp.GetId())
+print(hyp.GetLength())
+
+smesh.SetName(algo_3.GetSubMesh(), "SubMeshEdge")
+
+
+print("-------------------------- compute face")
+
+face = salome.IDToObject(idf)
+
+ret = mesh.Compute(face)
+print(ret)
+log = [] #mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after
+for a in log:
+ print("-------")
+ ii = 0
+ ir = 0
+ comType = a.commandType
+ if comType == 0:
+ for i in range(a.number):
+ ind = a.indexes[ii]
+ ii = ii+1
+ r1 = a.coords[ir]
+ ir = ir+1
+ r2 = a.coords[ir]
+ ir = ir+1
+ r3 = a.coords[ir]
+ ir = ir+1
+ print("AddNode %i - %g %g %g" % (ind, r1, r2, r3))
+ elif comType == 1:
+ for i in range(a.number):
+ ind = a.indexes[ii]
+ ii = ii+1
+ i1 = a.indexes[ii]
+ ii = ii+1
+ i2 = a.indexes[ii]
+ ii = ii+1
+ print("AddEdge %i - %i %i" % (ind, i1, i2))
+ elif comType == 2:
+ for i in range(a.number):
+ ind = a.indexes[ii]
+ print(ind)
+ ii = ii+1
+ print(ii)
+ i1 = a.indexes[ii]
+ ii = ii+1
+ i2 = a.indexes[ii]
+ print(i2)
+ ii = ii+1
+ print("ii", ii)
+ i3 = a.indexes[ii]
+ print(i3)
+ #ii = ii+1
+ ii = ii+1
+ print("AddTriangle %i - %i %i %i" % (ind, i1, i2, i3))
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_test0.py
+# Module : SMESH
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# ---- add first face of box in study
+
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+print(name)
+idface = geompy.addToStudyInFather(box, face, name)
+
+# ---- add shell from box in study
+
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+shell = subShellList[0]
+name = geompy.SubShapeName(shell, box)
+print(name)
+idshell = geompy.addToStudyInFather(box, shell, name)
+
+# ---- add first edge of face in study
+
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0]
+name = geompy.SubShapeName(edge, face)
+print(name)
+idedge = geompy.addToStudyInFather(face, edge, name)
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_test1.py
+# Module : SMESH
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# ---- add first face of box in study
+
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+print(name)
+idface = geompy.addToStudyInFather(box, face, name)
+
+# ---- add shell from box in study
+
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+shell = subShellList[0]
+name = geompy.SubShapeName(shell, box)
+print(name)
+idshell = geompy.addToStudyInFather(box, shell, name)
+
+# ---- add first edge of face in study
+
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0]
+name = geompy.SubShapeName(edge, face)
+print(name)
+idedge = geompy.addToStudyInFather(face, edge, name)
+
+
+# ---- SMESH
+
+# ---- Init a Mesh with the box
+
+mesh = smesh.Mesh(box, "Meshbox")
+
+print("-------------------------- add hypothesis to box")
+algoReg1 = mesh.Segment()
+hypNbSeg1 = algoReg1.NumberOfSegments(7)
+print(hypNbSeg1.GetName())
+print(hypNbSeg1.GetId())
+print(hypNbSeg1.GetNumberOfSegments())
+smesh.SetName(hypNbSeg1, "NumberOfSegments_7")
+
+algoMef1 = mesh.Triangle()
+hypArea1 = algoMef1.MaxElementArea(2500)
+print(hypArea1.GetName())
+print(hypArea1.GetId())
+print(hypArea1.GetMaxElementArea())
+smesh.SetName(hypArea1, "MaxElementArea_2500")
+
+# ---- add hypothesis to edge
+print("-------------------------- add hypothesis to edge")
+edge = salome.IDToObject(idedge)
+
+algoReg2 = mesh.Segment(edge)
+hypLen1 = algoReg2.LocalLength(100)
+smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge")
+print(hypLen1.GetName())
+print(hypLen1.GetId())
+print(hypLen1.GetLength())
+smesh.SetName(hypLen1, "Local_Length_100")
+
+# ---- add hypothesis to face
+print("-------------------------- add hypothesis to face")
+face = salome.IDToObject(idface)
+
+algoMef2 = mesh.Triangle(face)
+hypArea2 = algoMef2.MaxElementArea(500)
+smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace")
+print(hypArea2.GetName())
+print(hypArea2.GetId())
+print(hypArea2.GetMaxElementArea())
+smesh.SetName(hypArea2, "MaxElementArea_500")
+
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_test1.py
+# Module : SMESH
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# ---- define a box
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+# ---- add first face of box in study
+
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+print(name)
+idface = geompy.addToStudyInFather(box, face, name)
+
+# ---- add shell from box in study
+
+subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
+shell = subShellList[0]
+name = geompy.SubShapeName(shell, box)
+print(name)
+idshell = geompy.addToStudyInFather(box, shell, name)
+
+# ---- add first edge of face in study
+
+edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
+edge = edgeList[0]
+name = geompy.SubShapeName(edge, face)
+print(name)
+idedge = geompy.addToStudyInFather(face, edge, name)
+
+
+# ---- SMESH
+
+# ---- Init a Mesh with the box
+
+mesh = smesh.Mesh(box, "Meshbox")
+
+print("-------------------------- add hypothesis to box")
+algoReg1 = mesh.Segment()
+hypNbSeg1 = algoReg1.NumberOfSegments(7)
+print(hypNbSeg1.GetName())
+print(hypNbSeg1.GetId())
+print(hypNbSeg1.GetNumberOfSegments())
+smesh.SetName(hypNbSeg1, "NumberOfSegments_7")
+
+algoMef1 = mesh.Triangle()
+hypArea1 = algoMef1.MaxElementArea(2500)
+print(hypArea1.GetName())
+print(hypArea1.GetId())
+print(hypArea1.GetMaxElementArea())
+smesh.SetName(hypArea1, "MaxElementArea_2500")
+
+# ---- add hypothesis to edge
+print("-------------------------- add hypothesis to edge")
+edge = salome.IDToObject(idedge)
+
+algoReg2 = mesh.Segment(edge)
+hypLen1 = algoReg2.LocalLength(100)
+smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge")
+print(hypLen1.GetName())
+print(hypLen1.GetId())
+print(hypLen1.GetLength())
+smesh.SetName(hypLen1, "Local_Length_100")
+
+# ---- add hypothesis to face
+print("-------------------------- add hypothesis to face")
+face = salome.IDToObject(idface)
+
+algoMef2 = mesh.Triangle(face)
+hypArea2 = algoMef2.MaxElementArea(500)
+smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace")
+print(hypArea2.GetName())
+print(hypArea2.GetId())
+print(hypArea2.GetMaxElementArea())
+smesh.SetName(hypArea2, "MaxElementArea_500")
+
+mesh.Compute()
+
+salome.sg.updateObjBrowser()
+
+sg = salome.ImportComponentGUI('SMESH')
+if not isinstance(sg, type(salome.salome_ComponentGUI)):
+ sg.CreateAndDisplayActor('0:1:2:3')
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_test2.py
+# Module : SMESH
+#
+from SMESH_test1 import *
+
+# ---- compute box
+
+print("-------------------------- compute box")
+ret = mesh.Compute()
+print(ret)
+log = mesh.GetLog(0); # no erase trace
+# for linelog in log:
+# print(linelog)
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_test3.py
+# Module : SMESH
+#import salome
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+import math
+
+pi = math.pi
+
+# ---------------------------------------------
+xa = math.sin(pi/12)
+ya = 0
+za = math.cos(pi/12)
+
+xb = 0
+yb = math.sin(pi/18)
+zb = math.cos(pi/18)
+
+xc = math.cos(-pi/18)
+yc = 0
+zc = math.sin(-pi/18)
+
+rc1 = 150
+rc2 = 150
+rc3 = 150
+rc4 = 300
+
+hc1 = 300
+hc2 = 2*hc1
+hc3 = 2*hc1
+hc4 = 2*hc1
+
+# ---------------------------------------------
+point_0 = geompy.MakeVertex(0, 0, 0)
+point_z = geompy.MakeVertex(0, 0, 1)
+
+point_a = geompy.MakeVertex(xa, ya, za)
+point_b = geompy.MakeVertex(xb, yb, zb)
+point_c = geompy.MakeVertex(xc, yc, zc)
+
+dir_z = geompy.MakeVector(point_0, point_z)
+dir_a = geompy.MakeVector(point_0, point_a)
+dir_b = geompy.MakeVector(point_0, point_b)
+dir_c = geompy.MakeVector(point_0, point_c)
+
+axe_z = dir_z
+axe_a = dir_a
+axe_b = dir_b
+axe_c = dir_c
+
+cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1)
+
+cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2)
+cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1)
+
+cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3)
+cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1)
+
+cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4)
+cyl_t = geompy.MakeRotation(cyl_t, axe_c, pi/2)
+cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0)
+cyl_d = geompy.MakeTranslation(cyl_t, -hc1, 0, 1.3*rc4)
+
+inter_t = geompy.MakeBoolean(cyl_c,cyl_d, 1) # common
+
+blob_t = geompy.MakeBoolean(cyl_1, cyl_a, 2) # cut
+blob_t = geompy.MakeBoolean(blob_t, cyl_b, 2)
+
+blob = geompy.MakeBoolean(blob_t, inter_t, 1) # common
+
+idblob = geompy.addToStudy(blob,"blob")
+#idc = geompy.addToStudy(cyl_c,"cyl_c")
+#idd = geompy.addToStudy(cyl_d,"cyl_d")
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+
+# ---- GEOM
+
+box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
+idbox = geompy.addToStudy(box, "box")
+
+subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+face = subShapeList[0]
+name = geompy.SubShapeName(face, box)
+idface = geompy.addToStudyInFather(box, face, name)
+
+box = salome.IDToObject(idbox)
+face = salome.IDToObject(idface)
+
+# ---- SMESH
+
+smesh.UpdateStudy()
+mesh = smesh.Mesh(box, "Meshbox")
+
+# Set 1D algorithm/hypotheses to mesh
+algo1 = mesh.Segment()
+algo1.NumberOfSegments(10)
+
+# Set 2D algorithm/hypotheses to mesh
+algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
+algo2.MaxElementArea(10)
+
+# Create submesh on face
+algo3 = mesh.Segment(face)
+algo3.NumberOfSegments(10)
+algo4 = mesh.Triangle(smeshBuilder.MEFISTO, face)
+algo4.MaxElementArea(100)
+submesh = algo4.GetSubMesh()
+smesh.SetName(submesh, "SubMeshFace")
+
+
+mesh.Compute()
+
+faces = submesh.GetElementsByType(SMESH.FACE)
+if len(faces) > 1:
+ print(len(faces), len(faces)/2)
+ group1 = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces")
+ group2 = mesh.CreateEmptyGroup(SMESH.FACE,"Another group of faces")
+ group1.Add(faces[:int(len(faces)/2)])
+ group2.Add(faces[int(len(faces)/2):])
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# File : SMESH_test5.py
+# Module : SMESH
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import CORBA
+import os
+import os.path
+
+def SetSObjName(theSObj,theName) :
+ ok, anAttr = theSObj.FindAttribute("AttributeName")
+ if ok:
+ aName = anAttr._narrow(SALOMEDS.AttributeName)
+ #print aName.__dict__
+ aName.SetValue(theName)
+
+def ConvertMED2UNV(thePath,theFile) :
+ anInitFileName = thePath + theFile
+ aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName)
+ print(aResult, aMeshes)
+
+ for iMesh in range(len(aMeshes)) :
+ aMesh = aMeshes[iMesh]
+ print(aMesh.GetName(), end=' ')
+ aFileName = anInitFileName
+ aFileName = os.path.basename(aFileName)
+ aMesh.SetName(aFileName)
+ print(aMesh.GetName())
+
+ aOutPath = '/tmp/'
+ aFileName = aOutPath + theFile + "." + str(iMesh) + ".unv"
+ aMesh.ExportUNV(aFileName)
+ aMesh = smesh.CreateMeshesFromUNV(aFileName)
+ print(aMesh.GetName(), end=' ')
+ os.remove(aFileName)
+ aFileName = os.path.basename(aFileName)
+ aMesh.SetName(aFileName)
+ print(aMesh.GetName())
+
+aPath = os.getenv('DATA_DIR') + '/MedFiles/'
+aListDir = os.listdir(aPath)
+print(aListDir)
+
+for iFile in range(len(aListDir)) :
+ aFileName = aListDir[iFile]
+ aName,anExt = os.path.splitext(aFileName)
+ if anExt == ".med" :
+ aFileName = os.path.basename(aFileName)
+ print(aFileName)
+ ConvertMED2UNV(aPath,aFileName)
+ #break
+
+salome.sg.updateObjBrowser()
--- /dev/null
+#!/usr/bin/env python3
+# Copyright (C) 2018-2021 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
+#
+
+# test used in YACS, ForEachLoop
+
+def geomesh(l0, r0, h0, d0, d1, my_container, direc):
+ print("Géometrie et maillage barre : (l0, r0, h0, d0, d1)=", (l0, r0, h0, d0, d1))
+
+ import sys
+ import salome
+ salome.salome_init()
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import os
+ import SALOMEDS
+ import SMESH
+ from salome.smesh import smeshBuilder
+
+ my_container.load_component_Library("GEOM")
+ #engineGeom = my_container.create_component_instance("GEOM")
+ engineGeom = my_container.load_impl("GEOM","")
+ geompy = geomBuilder.New(engineGeom)
+ my_container.load_component_Library("SMESH")
+ #engineSmesh = my_container.create_component_instance("SMESH")
+ engineSmesh = my_container.load_impl("SMESH","")
+ smesh = smeshBuilder.New(engineSmesh,engineGeom)
+ print("instances Names:", engineGeom.instanceName, engineSmesh.instanceName)
+ print("instances:", engineGeom, engineSmesh)
+ print("builders:", geompy, smesh)
+
+ volume = (2.*l0*r0 + 0.75*math.pi*r0*r0)*h0
+ 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(-l0, -r0, 0)
+ Vertex_2 = geompy.MakeVertex(-l0-r0, 0, 0)
+ Vertex_3 = geompy.MakeVertex(-l0, r0, 0)
+ Vertex_4 = geompy.MakeVertex(l0, r0, 0)
+ Vertex_5 = geompy.MakeVertex(l0+r0, 0, 0)
+ Vertex_6 = geompy.MakeVertex(l0, -r0, 0)
+ Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
+ Arc_2 = geompy.MakeArc(Vertex_4, Vertex_5, Vertex_6)
+ Line_1 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
+ Line_2 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_1)
+ Face_1 = geompy.MakeFaceWires([Arc_1, Arc_2, Line_1, Line_2], 1)
+ barre0 = geompy.MakePrismVecH(Face_1, OZ, h0)
+ Vertex_1a = geompy.MakeVertex(-l0, -r0/2, 0)
+ Vertex_2a = geompy.MakeVertex(-l0-r0/2, 0, 0)
+ Vertex_3a = geompy.MakeVertex(-l0, r0/2, 0)
+ Vertex_4a = geompy.MakeVertex(l0, r0/2, 0)
+ Vertex_5a = geompy.MakeVertex(l0+r0/2, 0, 0)
+ Vertex_6a = geompy.MakeVertex(l0, -r0/2, 0)
+ Arc_1a = geompy.MakeArc(Vertex_1a, Vertex_2a, Vertex_3a)
+ Arc_2a = geompy.MakeArc(Vertex_4a, Vertex_5a, Vertex_6a)
+ Line_1a = geompy.MakeLineTwoPnt(Vertex_3a, Vertex_4a)
+ Line_2a = geompy.MakeLineTwoPnt(Vertex_6a, Vertex_1a)
+ Face_1a = geompy.MakeFaceWires([Arc_1a, Arc_2a, Line_1a, Line_2a], 1)
+ barrea = geompy.MakePrismVecH(Face_1a, OZ, h0)
+ barreb = geompy.MakeCut(barre0, barrea)
+ Plane_1 = geompy.MakePlane(Vertex_1, OX, 2000)
+ Plane_2 = geompy.MakePlane(Vertex_6, OX, 2000)
+ barre = geompy.MakePartition([barreb], [Plane_1, Plane_2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+ v1 = geompy.MakeVertex(-l0-r0, 0, h0/2.)
+ v2 = geompy.MakeVertex(l0+r0, 0, h0/2.)
+ f1 = geompy.GetShapesNearPoint(barre, v1, geompy.ShapeType["FACE"])
+ f2 = geompy.GetShapesNearPoint(barre, v2, geompy.ShapeType["FACE"])
+ #f1 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
+ #geompy.UnionIDs(f1, [3])
+ #f2 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
+ #geompy.UnionIDs(f2, [20])
+
+ Auto_group_for_Sub_mesh_1 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
+ geompy.UnionList(Auto_group_for_Sub_mesh_1, [f1, f2])
+ nom = r'barre_l_{:03d}__r_{:05.2f}__h_{:05.2f}__d0_{:05.2f}__d1_{:05.2f}'.format(int(l0), r0, h0, d0, d1)
+ nombrep = nom + ".brep"
+ geompy.ExportBREP(barre, direc + os.sep + nombrep )
+ props = geompy.BasicProperties(barre)
+ geomvol = props[2]
+
+ #geompy.addToStudy( barre, 'barre' )
+ #geompy.addToStudyInFather( barre, f1, 'f1' )
+ #geompy.addToStudyInFather( barre, f2, 'f2' )
+
+ smesh.SetEnablePublish( False )
+
+ isTetra = False
+ barre_1 = smesh.Mesh(barre)
+ # SO = salome.myStudy.FindObjectIOR(salome.myStudy.ConvertObjectToIOR(barre_1.GetMesh()))
+ # if SO:
+ # print ("_______",SO.GetID(),SO.GetName())
+ # else:
+ # print ("_______NO_SO!!!")
+ if (isTetra):
+ NETGEN_1D_2D_3D = barre_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
+ NETGEN_3D_Parameters_1 = NETGEN_1D_2D_3D.Parameters()
+ NETGEN_3D_Parameters_1.SetMaxSize( d0 )
+ NETGEN_3D_Parameters_1.SetSecondOrder( 0 )
+ NETGEN_3D_Parameters_1.SetOptimize( 1 )
+ NETGEN_3D_Parameters_1.SetFineness( 3 )
+ NETGEN_3D_Parameters_1.SetChordalError( 0.1 )
+ NETGEN_3D_Parameters_1.SetChordalErrorEnabled( 0 )
+ NETGEN_3D_Parameters_1.SetMinSize( d0 )
+ NETGEN_3D_Parameters_1.SetUseSurfaceCurvature( 1 )
+ NETGEN_3D_Parameters_1.SetFuseEdges( 1 )
+ NETGEN_3D_Parameters_1.SetQuadAllowed( 0 )
+ NETGEN_1D_2D = barre_1.Triangle(algo=smeshBuilder.NETGEN_1D2D,geom=Auto_group_for_Sub_mesh_1)
+ NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
+ NETGEN_2D_Parameters_1.SetMaxSize( d1 )
+ NETGEN_2D_Parameters_1.SetSecondOrder( 0 )
+ NETGEN_2D_Parameters_1.SetOptimize( 1 )
+ NETGEN_2D_Parameters_1.SetFineness( 3 )
+ NETGEN_2D_Parameters_1.SetChordalError( 0.1 )
+ NETGEN_2D_Parameters_1.SetChordalErrorEnabled( 0 )
+ NETGEN_2D_Parameters_1.SetMinSize( d1 )
+ NETGEN_2D_Parameters_1.SetUseSurfaceCurvature( 1 )
+ NETGEN_2D_Parameters_1.SetFuseEdges( 1 )
+ NETGEN_2D_Parameters_1.SetQuadAllowed( 0 )
+ else:
+ Regular_1D = barre_1.Segment()
+ Number_of_Segments_1 = Regular_1D.NumberOfSegments(15)
+ Quadrangle_2D = barre_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+ Hexa_3D = barre_1.Hexahedron(algo=smeshBuilder.Hexa)
+ isDone = barre_1.Compute()
+
+ f1_1 = barre_1.GroupOnGeom(f1,'f1',SMESH.FACE)
+ f2_1 = barre_1.GroupOnGeom(f2,'f2',SMESH.FACE)
+ smesh.SetName(barre_1, nom)
+ nommed = nom + ".med"
+ barre_1.ExportMED( direc + os.sep + nommed, auto_groups=0, minor=0, overwrite=1, meshPart=None, autoDimension=1 )
+ measure = smesh.CreateMeasurements()
+ meshvol = measure.Volume(barre_1.mesh)
+ print("Maillage publié : ", direc + os.sep + nommed)
+ clearMesh(barre_1, salome.myStudy, nom)
+ deltag = abs(geomvol - volume)/volume
+ deltam = abs(meshvol - geomvol)/geomvol
+ delta = abs(meshvol - volume)/volume
+ print("volumes:", volume, geomvol, meshvol, deltag, deltam)
+ assert(deltag < 1.e-5)
+ assert(deltam < 2.e-3)
+ #import time
+ #time.sleep(30)
+ return delta
+
+
+def clearMesh(theMesh, theStudy, aName):
+ theMesh.Clear()
+ aMesh = theMesh.GetMesh()
+ aMesh.UnRegister()
+ # aStudyBuilder = theStudy.NewBuilder()
+ # SO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(aMesh))
+ # objects_to_unpublish = [SO]
+ # refs = theStudy.FindDependances(SO)
+ # objects_to_unpublish += refs
+ # for o in objects_to_unpublish:
+ # if o is not None:
+ # aStudyBuilder.RemoveObjectWithChildren(o)
+ print("clearMesh done:", aName)
+
+def genere(r0, h0, my_container, direc):
+ l0 = 50.0
+ d0 = min(r0/2., h0/6.)
+ d1 = d0/2.
+ res = geomesh(l0, r0, h0, d0, d1, my_container, direc)
+ return res
+
+def genere2(r0h0, my_container, direc):
+ l0 = 50.0
+ r0 = r0h0[0]
+ h0 = r0h0[1]
+ d0 = min(r0/2., h0/6.)
+ d1 = d0/2.
+ res = geomesh(l0, r0, h0, d0, d1, my_container, direc)
+ return res
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# A small cube centered and put on a great cube build by points, edges, faces and solids
+
+# Points
+# ------
+
+greatPoint111 = geompy.MakeVertex( 0, 0, 0)
+greatPoint211 = geompy.MakeVertex(10, 0, 0)
+greatPoint311 = geompy.MakeVertex(20, 0, 0)
+greatPoint411 = geompy.MakeVertex(30, 0, 0)
+
+greatPoint121 = geompy.MakeVertex( 0, 10, 0)
+greatPoint221 = geompy.MakeVertex(10, 10, 0)
+greatPoint321 = geompy.MakeVertex(20, 10, 0)
+greatPoint421 = geompy.MakeVertex(30, 10, 0)
+
+greatPoint112 = geompy.MakeVertex( 0, 0, 10)
+greatPoint212 = geompy.MakeVertex(10, 0, 10)
+greatPoint312 = geompy.MakeVertex(20, 0, 10)
+greatPoint412 = geompy.MakeVertex(30, 0, 10)
+
+greatPoint122 = geompy.MakeVertex( 0, 10, 10)
+greatPoint222 = geompy.MakeVertex(10, 10, 10)
+greatPoint322 = geompy.MakeVertex(20, 10, 10)
+greatPoint422 = geompy.MakeVertex(30, 10, 10)
+
+greatPoint113 = geompy.MakeVertex( 0, 0, 20)
+greatPoint213 = geompy.MakeVertex(10, 0, 20)
+greatPoint313 = geompy.MakeVertex(20, 0, 20)
+greatPoint413 = geompy.MakeVertex(30, 0, 20)
+
+greatPoint123 = geompy.MakeVertex( 0, 10, 20)
+greatPoint223 = geompy.MakeVertex(10, 10, 20)
+greatPoint323 = geompy.MakeVertex(20, 10, 20)
+greatPoint423 = geompy.MakeVertex(30, 10, 20)
+
+greatPoint114 = geompy.MakeVertex( 0, 0, 30)
+greatPoint214 = geompy.MakeVertex(10, 0, 30)
+greatPoint314 = geompy.MakeVertex(20, 0, 30)
+greatPoint414 = geompy.MakeVertex(30, 0, 30)
+
+greatPoint124 = geompy.MakeVertex( 0, 10, 30)
+greatPoint224 = geompy.MakeVertex(10, 10, 30)
+greatPoint324 = geompy.MakeVertex(20, 10, 30)
+greatPoint424 = geompy.MakeVertex(30, 10, 30)
+
+
+smallPoint111 = greatPoint222
+smallPoint211 = greatPoint322
+smallPoint121 = geompy.MakeVertex(10, 20, 10)
+smallPoint221 = geompy.MakeVertex(20, 20, 10)
+
+smallPoint112 = greatPoint223
+smallPoint212 = greatPoint323
+smallPoint122 = geompy.MakeVertex(10, 20, 20)
+smallPoint222 = geompy.MakeVertex(20, 20, 20)
+
+# Edges
+# -----
+
+smallEdgeX11 = geompy.MakeEdge(smallPoint111, smallPoint211)
+smallEdgeX21 = geompy.MakeEdge(smallPoint121, smallPoint221)
+smallEdgeX12 = geompy.MakeEdge(smallPoint112, smallPoint212)
+smallEdgeX22 = geompy.MakeEdge(smallPoint122, smallPoint222)
+
+smallEdgeY11 = geompy.MakeEdge(smallPoint111, smallPoint121)
+smallEdgeY21 = geompy.MakeEdge(smallPoint211, smallPoint221)
+smallEdgeY12 = geompy.MakeEdge(smallPoint112, smallPoint122)
+smallEdgeY22 = geompy.MakeEdge(smallPoint212, smallPoint222)
+
+smallEdgeZ11 = geompy.MakeEdge(smallPoint111, smallPoint112)
+smallEdgeZ21 = geompy.MakeEdge(smallPoint211, smallPoint212)
+smallEdgeZ12 = geompy.MakeEdge(smallPoint121, smallPoint122)
+smallEdgeZ22 = geompy.MakeEdge(smallPoint221, smallPoint222)
+
+
+greatEdgeX111 = geompy.MakeEdge(greatPoint111, greatPoint211)
+greatEdgeX211 = geompy.MakeEdge(greatPoint211, greatPoint311)
+greatEdgeX311 = geompy.MakeEdge(greatPoint311, greatPoint411)
+greatEdgeX121 = geompy.MakeEdge(greatPoint121, greatPoint221)
+greatEdgeX221 = geompy.MakeEdge(greatPoint221, greatPoint321)
+greatEdgeX321 = geompy.MakeEdge(greatPoint321, greatPoint421)
+
+greatEdgeX112 = geompy.MakeEdge(greatPoint112, greatPoint212)
+greatEdgeX212 = geompy.MakeEdge(greatPoint212, greatPoint312)
+greatEdgeX312 = geompy.MakeEdge(greatPoint312, greatPoint412)
+greatEdgeX122 = geompy.MakeEdge(greatPoint122, greatPoint222)
+greatEdgeX222 = smallEdgeX11
+greatEdgeX322 = geompy.MakeEdge(greatPoint322, greatPoint422)
+
+greatEdgeX113 = geompy.MakeEdge(greatPoint113, greatPoint213)
+greatEdgeX213 = geompy.MakeEdge(greatPoint213, greatPoint313)
+greatEdgeX313 = geompy.MakeEdge(greatPoint313, greatPoint413)
+greatEdgeX123 = geompy.MakeEdge(greatPoint123, greatPoint223)
+greatEdgeX223 = smallEdgeX12
+greatEdgeX323 = geompy.MakeEdge(greatPoint323, greatPoint423)
+
+greatEdgeX114 = geompy.MakeEdge(greatPoint114, greatPoint214)
+greatEdgeX214 = geompy.MakeEdge(greatPoint214, greatPoint314)
+greatEdgeX314 = geompy.MakeEdge(greatPoint314, greatPoint414)
+greatEdgeX124 = geompy.MakeEdge(greatPoint124, greatPoint224)
+greatEdgeX224 = geompy.MakeEdge(greatPoint224, greatPoint324)
+greatEdgeX324 = geompy.MakeEdge(greatPoint324, greatPoint424)
+
+greatEdgeY11 = geompy.MakeEdge(greatPoint111, greatPoint121)
+greatEdgeY21 = geompy.MakeEdge(greatPoint211, greatPoint221)
+greatEdgeY31 = geompy.MakeEdge(greatPoint311, greatPoint321)
+greatEdgeY41 = geompy.MakeEdge(greatPoint411, greatPoint421)
+
+greatEdgeY12 = geompy.MakeEdge(greatPoint112, greatPoint122)
+greatEdgeY22 = geompy.MakeEdge(greatPoint212, greatPoint222)
+greatEdgeY32 = geompy.MakeEdge(greatPoint312, greatPoint322)
+greatEdgeY42 = geompy.MakeEdge(greatPoint412, greatPoint422)
+
+greatEdgeY13 = geompy.MakeEdge(greatPoint113, greatPoint123)
+greatEdgeY23 = geompy.MakeEdge(greatPoint213, greatPoint223)
+greatEdgeY33 = geompy.MakeEdge(greatPoint313, greatPoint323)
+greatEdgeY43 = geompy.MakeEdge(greatPoint413, greatPoint423)
+
+greatEdgeY14 = geompy.MakeEdge(greatPoint114, greatPoint124)
+greatEdgeY24 = geompy.MakeEdge(greatPoint214, greatPoint224)
+greatEdgeY34 = geompy.MakeEdge(greatPoint314, greatPoint324)
+greatEdgeY44 = geompy.MakeEdge(greatPoint414, greatPoint424)
+
+greatEdgeZ111 = geompy.MakeEdge(greatPoint111, greatPoint112)
+greatEdgeZ211 = geompy.MakeEdge(greatPoint211, greatPoint212)
+greatEdgeZ311 = geompy.MakeEdge(greatPoint311, greatPoint312)
+greatEdgeZ411 = geompy.MakeEdge(greatPoint411, greatPoint412)
+
+greatEdgeZ121 = geompy.MakeEdge(greatPoint121, greatPoint122)
+greatEdgeZ221 = geompy.MakeEdge(greatPoint221, greatPoint222)
+greatEdgeZ321 = geompy.MakeEdge(greatPoint321, greatPoint322)
+greatEdgeZ421 = geompy.MakeEdge(greatPoint421, greatPoint422)
+
+greatEdgeZ112 = geompy.MakeEdge(greatPoint112, greatPoint113)
+greatEdgeZ212 = geompy.MakeEdge(greatPoint212, greatPoint213)
+greatEdgeZ312 = geompy.MakeEdge(greatPoint312, greatPoint313)
+greatEdgeZ412 = geompy.MakeEdge(greatPoint412, greatPoint413)
+
+greatEdgeZ122 = geompy.MakeEdge(greatPoint122, greatPoint123)
+greatEdgeZ222 = smallEdgeZ11
+greatEdgeZ322 = smallEdgeZ21
+greatEdgeZ422 = geompy.MakeEdge(greatPoint422, greatPoint423)
+
+greatEdgeZ113 = geompy.MakeEdge(greatPoint113, greatPoint114)
+greatEdgeZ213 = geompy.MakeEdge(greatPoint213, greatPoint214)
+greatEdgeZ313 = geompy.MakeEdge(greatPoint313, greatPoint314)
+greatEdgeZ413 = geompy.MakeEdge(greatPoint413, greatPoint414)
+
+greatEdgeZ123 = geompy.MakeEdge(greatPoint123, greatPoint124)
+greatEdgeZ223 = geompy.MakeEdge(greatPoint223, greatPoint224)
+greatEdgeZ323 = geompy.MakeEdge(greatPoint323, greatPoint324)
+greatEdgeZ423 = geompy.MakeEdge(greatPoint423, greatPoint424)
+
+# Faces
+# -----
+
+smallFaceX1 = geompy.MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12)
+smallFaceX2 = geompy.MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22)
+smallFaceY1 = geompy.MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21)
+smallFaceY2 = geompy.MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22)
+smallFaceZ1 = geompy.MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21)
+smallFaceZ2 = geompy.MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22)
+
+
+greatFaceX11 = geompy.MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121)
+greatFaceX21 = geompy.MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221)
+greatFaceX31 = geompy.MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321)
+greatFaceX41 = geompy.MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421)
+
+greatFaceX12 = geompy.MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122)
+greatFaceX22 = geompy.MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222)
+greatFaceX32 = geompy.MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322)
+greatFaceX42 = geompy.MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422)
+
+greatFaceX13 = geompy.MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123)
+greatFaceX23 = geompy.MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223)
+greatFaceX33 = geompy.MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323)
+greatFaceX43 = geompy.MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423)
+
+greatFaceY111 = geompy.MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211)
+greatFaceY211 = geompy.MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311)
+greatFaceY311 = geompy.MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411)
+greatFaceY121 = geompy.MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221)
+greatFaceY221 = geompy.MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321)
+greatFaceY321 = geompy.MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421)
+
+greatFaceY112 = geompy.MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212)
+greatFaceY212 = geompy.MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312)
+greatFaceY312 = geompy.MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412)
+greatFaceY122 = geompy.MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222)
+greatFaceY222 = smallFaceY1
+greatFaceY322 = geompy.MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422)
+
+greatFaceY113 = geompy.MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213)
+greatFaceY213 = geompy.MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313)
+greatFaceY313 = geompy.MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413)
+greatFaceY123 = geompy.MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223)
+greatFaceY223 = geompy.MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323)
+greatFaceY323 = geompy.MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423)
+
+greatFaceZ11 = geompy.MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21)
+greatFaceZ21 = geompy.MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31)
+greatFaceZ31 = geompy.MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41)
+
+greatFaceZ12 = geompy.MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22)
+greatFaceZ22 = geompy.MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32)
+greatFaceZ32 = geompy.MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42)
+
+greatFaceZ13 = geompy.MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23)
+greatFaceZ23 = geompy.MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33)
+greatFaceZ33 = geompy.MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43)
+
+greatFaceZ14 = geompy.MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24)
+greatFaceZ24 = geompy.MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34)
+greatFaceZ34 = geompy.MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44)
+
+# Solids
+# ------
+
+smallBlock = geompy.MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2)
+
+greatBlock11 = geompy.MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12)
+greatBlock21 = geompy.MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22)
+greatBlock31 = geompy.MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32)
+
+greatBlock12 = geompy.MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13)
+greatBlock22 = geompy.MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23)
+greatBlock32 = geompy.MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33)
+
+greatBlock13 = geompy.MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14)
+greatBlock23 = geompy.MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24)
+greatBlock33 = geompy.MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34)
+
+# Compound
+# --------
+
+c_l = []
+c_l.append(smallBlock)
+c_l.append(greatBlock11)
+c_l.append(greatBlock21)
+c_l.append(greatBlock31)
+c_l.append(greatBlock12)
+c_l.append(greatBlock22)
+c_l.append(greatBlock32)
+c_l.append(greatBlock13)
+c_l.append(greatBlock23)
+c_l.append(greatBlock33)
+
+piece = geompy.MakeCompound(c_l)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex01_cube2build")
+
+# Meshing
+# =======
+
+# Create hexahedrical mesh on piece
+# ---------------------------------
+
+hexa = smesh.Mesh(piece, "ex01_cube2build:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(4)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Create local hypothesis
+# -----------------------
+
+algo = hexa.Segment(greatEdgeX111)
+
+algo.Arithmetic1D(1, 4)
+
+algo.Propagation()
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# A small cube centered and put on a great cube build by primitive geometric functionalities
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+arete = 10
+
+# Points
+# ------
+
+blockPoint111 = geompy.MakeVertex(ox , oy, oz)
+blockPoint211 = geompy.MakeVertex(ox+arete, oy, oz)
+blockPoint112 = geompy.MakeVertex(ox , oy, oz+arete)
+blockPoint212 = geompy.MakeVertex(ox+arete, oy, oz+arete)
+
+# Face and solid
+# --------------
+
+blockFace1 = geompy.MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112)
+
+blockSolid11 = geompy.MakePrismVecH(blockFace1, geompy.MakeVectorDXDYDZ(0, 1, 0), arete)
+
+# Translations
+# ------------
+
+blockSolid21 = geompy.MakeTranslation(blockSolid11, arete, 0, 0)
+blockSolid31 = geompy.MakeTranslation(blockSolid21, arete, 0, 0)
+
+blockSolid12 = geompy.MakeTranslation(blockSolid11, 0, 0, arete)
+blockSolid22 = geompy.MakeTranslation(blockSolid12, arete, 0, 0)
+blockSolid32 = geompy.MakeTranslation(blockSolid22, arete, 0, 0)
+
+blockSolid13 = geompy.MakeTranslation(blockSolid12, 0, 0, arete)
+blockSolid23 = geompy.MakeTranslation(blockSolid13, arete, 0, 0)
+blockSolid33 = geompy.MakeTranslation(blockSolid23, arete, 0, 0)
+
+blockSolid111 = geompy.MakeTranslation(blockSolid22, 0, arete, 0)
+
+# Compound and glue
+# -----------------
+
+c_l = []
+c_l.append(blockSolid11)
+c_l.append(blockSolid21)
+c_l.append(blockSolid31)
+c_l.append(blockSolid12)
+c_l.append(blockSolid22)
+c_l.append(blockSolid32)
+c_l.append(blockSolid13)
+c_l.append(blockSolid23)
+c_l.append(blockSolid33)
+c_l.append(blockSolid111)
+
+c_cpd = geompy.MakeCompound(c_l)
+
+piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex02_cube2primitive")
+
+# Meshing
+# =======
+
+# Create hexahedrical mesh on piece
+# ---------------------------------
+
+hexa = smesh.Mesh(piece, "ex02_cube2primitive:hexa")
+
+algo = hexa.Segment()
+algo.LocalLength(1)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# A small cube centered and put on a great cube build with partition
+
+# Values
+# ------
+
+g_ox = 0
+g_oy = 0
+g_oz = 0
+
+g_arete = 10
+
+g_trim = 1000
+
+# Points
+# ------
+
+v_arete2 = g_arete*2
+v_arete3 = g_arete*3
+
+v_1 = geompy.MakeVertex(g_ox , g_oy , g_oz )
+v_2 = geompy.MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
+
+v_3 = geompy.MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
+v_4 = geompy.MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
+
+# Solids
+# ------
+
+s_base = geompy.MakeBoxTwoPnt(v_1, v_2)
+s_haut = geompy.MakeBoxTwoPnt(v_3, v_4)
+
+# Partition
+# ---------
+
+p_dir1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+p_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+p_dir3 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+p_tools = []
+
+p_tools.append(geompy.MakePlane(v_3, p_dir1, g_trim))
+p_tools.append(geompy.MakePlane(v_4, p_dir1, g_trim))
+p_tools.append(geompy.MakePlane(v_3, p_dir2, g_trim))
+p_tools.append(geompy.MakePlane(v_4, p_dir2, g_trim))
+p_tools.append(geompy.MakePlane(v_3, p_dir3, g_trim))
+
+piece = geompy.MakePartition([s_base, s_haut], p_tools, [], [], geompy.ShapeType["SOLID"])
+
+# Study
+# -----
+
+piece_id = geompy.addToStudy(piece, "ex03_cube2partition")
+
+# Meshing
+# =======
+
+# Create hexahedrical mesh on piece
+# ---------------------------------
+
+hexa = smesh.Mesh(piece, "ex03_cube2partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(5)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# 5 box with a hexahedral mesh and with 2 box in tetrahedral mesh
+
+# Values
+# ------
+
+arete = 100
+
+arete0 = 0
+arete1 = arete
+arete2 = arete*2
+arete3 = arete*3
+
+# Solids
+# ------
+
+box_tetra1 = geompy.MakeBox(arete0, arete0, 0, arete1, arete1, arete)
+
+box_ijk1 = geompy.MakeBox(arete1, arete0, 0, arete2, arete1, arete)
+
+box_hexa = geompy.MakeBox(arete1, arete1, 0, arete2, arete2, arete)
+
+box_ijk2 = geompy.MakeBox(arete2, arete1, 0, arete3, arete2, arete)
+
+box_tetra2 = geompy.MakeBox(arete2, arete2, 0, arete3 ,arete3, arete)
+
+# Piece
+# -----
+
+piece_cpd = geompy.MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2])
+
+piece = geompy.MakeGlueFaces(piece_cpd, 1e-4)
+
+piece_id = geompy.addToStudy(piece, "ex04_cube5tetraHexa")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+mixed = smesh.Mesh(piece, "ex04_cube5tetraHexa:mixed")
+
+algo = mixed.Segment()
+
+algo.StartEndLength(3, 25)
+
+mixed.Quadrangle()
+
+mixed.Hexahedron()
+
+# Tetrahedral local mesh
+# ----------------------
+
+def localMesh(b, hyp):
+ box = geompy.GetInPlace(piece, b)
+ faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
+
+ i = 0
+ n = len(faces)
+ while i<n:
+ algo = mixed.Triangle(faces[i])
+ if hyp:
+ algo.MaxElementArea(80)
+ else:
+ algo.LengthFromEdges()
+ i = i + 1
+
+ algo = mixed.Tetrahedron(smeshBuilder.NETGEN, box)
+ algo.MaxElementVolume(400)
+
+localMesh(box_tetra1, 1)
+localMesh(box_tetra2, 0)
+
+# Mesh calculus
+# -------------
+
+mixed.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+# Geometry
+# ========
+
+# A centered holed cube build by build by points, edges, faces and solids
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+longueur = 100
+largeur = 80
+hauteur = 50
+
+rayon = 10
+
+# Points
+# ------
+
+basePoint111 = geompy.MakeVertex(ox , oy, oz)
+basePoint211 = geompy.MakeVertex(ox+longueur, oy, oz)
+basePoint112 = geompy.MakeVertex(ox , oy, oz+largeur)
+basePoint212 = geompy.MakeVertex(ox+longueur, oy, oz+largeur)
+
+cx = ox+longueur/2
+cy = oy
+cz = oz+largeur/2
+
+ll = longueur/largeur
+ll = ll*ll
+dx = rayon/math.sqrt(1+ll)
+dz = rayon/math.sqrt(1+1/ll)
+
+circlePoint1 = geompy.MakeVertex(cx-dx, cy, cz-dz)
+circlePoint2 = geompy.MakeVertex(cx+dx, cy, cz-dz)
+circlePoint3 = geompy.MakeVertex(cx+dx, cy, cz+dz)
+circlePoint4 = geompy.MakeVertex(cx-dx, cy, cz+dz)
+
+# Edges
+# -----
+
+squareEdge1 = geompy.MakeEdge(basePoint111, basePoint211)
+squareEdge2 = geompy.MakeEdge(basePoint211, basePoint212)
+squareEdge3 = geompy.MakeEdge(basePoint212, basePoint112)
+squareEdge4 = geompy.MakeEdge(basePoint112, basePoint111)
+
+diagEdge1 = geompy.MakeEdge(basePoint111, circlePoint1)
+diagEdge2 = geompy.MakeEdge(basePoint211, circlePoint2)
+diagEdge3 = geompy.MakeEdge(basePoint212, circlePoint3)
+diagEdge4 = geompy.MakeEdge(basePoint112, circlePoint4)
+
+arcEdge1 = geompy.MakeArc(circlePoint1, geompy.MakeVertex(cx , cy, cz-rayon), circlePoint2)
+arcEdge2 = geompy.MakeArc(circlePoint2, geompy.MakeVertex(cx+rayon, cy, cz ), circlePoint3)
+arcEdge3 = geompy.MakeArc(circlePoint3, geompy.MakeVertex(cx , cy, cz+rayon), circlePoint4)
+arcEdge4 = geompy.MakeArc(circlePoint4, geompy.MakeVertex(cx-rayon, cy, cz ), circlePoint1)
+
+# Faces
+# -----
+
+baseFace1 = geompy.MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1)
+baseFace2 = geompy.MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2)
+baseFace3 = geompy.MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3)
+baseFace4 = geompy.MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4)
+
+# Solids
+# ------
+
+baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur)
+baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur)
+baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur)
+baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur)
+
+# Compound
+# --------
+
+c_l = []
+c_l.append(baseSolid1)
+c_l.append(baseSolid2)
+c_l.append(baseSolid3)
+c_l.append(baseSolid4)
+
+c_cpd = geompy.MakeCompound(c_l)
+piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex05_hole1build")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex05_hole1build:hexa")
+
+algo = hexa.Segment()
+
+algo.NumberOfSegments(6, 3)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# A not centered holed cube build by boolean geometric operations
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+longueur1 = 30
+longueur2 = 70
+
+largeur1 = 30
+largeur2 = 50
+
+hauteur = 50
+
+rayon = 10
+
+# Triangular face
+# ---------------
+
+def triangle(p1, p2, p3):
+ l = []
+ l.append(geompy.MakeEdge(p1, p2))
+ l.append(geompy.MakeEdge(p2, p3))
+ l.append(geompy.MakeEdge(p3, p1))
+ w = geompy.MakeWire(l)
+ return geompy.MakeFace(w, 1)
+
+# Points
+# ------
+
+basePoint111 = geompy.MakeVertex(ox-longueur1, oy, oz-largeur1)
+basePoint211 = geompy.MakeVertex(ox+longueur2, oy, oz-largeur1)
+basePoint112 = geompy.MakeVertex(ox-longueur1, oy, oz+largeur2)
+basePoint212 = geompy.MakeVertex(ox+longueur2, oy, oz+largeur2)
+
+holePoint = geompy.MakeVertex(ox, oy, oz)
+
+# Faces
+# -----
+
+baseFace1 = triangle(basePoint111, basePoint211, holePoint)
+baseFace2 = triangle(basePoint211, basePoint212, holePoint)
+baseFace3 = triangle(basePoint212, basePoint112, holePoint)
+baseFace4 = triangle(basePoint112, basePoint111, holePoint)
+
+# Solids
+# ------
+
+baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur)
+baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur)
+baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur)
+baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur)
+
+holeSolid = geompy.MakeCylinder(holePoint, baseVector, rayon, hauteur)
+
+# Boolean operations
+# ------------------
+
+baseHexa1 = geompy.MakeCut(baseSolid1, holeSolid)
+baseHexa2 = geompy.MakeCut(baseSolid2, holeSolid)
+baseHexa3 = geompy.MakeCut(baseSolid3, holeSolid)
+baseHexa4 = geompy.MakeCut(baseSolid4, holeSolid)
+
+# Compound, glue and repair
+# -------------------------
+
+c_l = []
+c_l.append(baseHexa1)
+c_l.append(baseHexa2)
+c_l.append(baseHexa3)
+c_l.append(baseHexa4)
+
+c_cpd = geompy.MakeCompound(c_l)
+c_glu = geompy.MakeGlueFaces(c_cpd, 1.e-5)
+piece = geompy.RemoveExtraEdges(c_glu, doUnionFaces=True)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex06_hole1boolean")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex06_hole1boolean:hexa")
+
+algo = hexa.Segment()
+
+algo.NumberOfSegments(11)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Create local hypothesis
+# -----------------------
+
+edge1 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz-largeur1))
+algo1 = hexa.Segment(edge1)
+algo1.NumberOfSegments(3)
+algo1.Propagation()
+
+edge2 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox-longueur1, oy, oz))
+algo2 = hexa.Segment(edge2)
+algo2.NumberOfSegments(5)
+algo2.Propagation()
+
+edge3 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz+largeur2))
+algo3 = hexa.Segment(edge3)
+algo3.NumberOfSegments(7)
+algo3.Propagation()
+
+edge4 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox+longueur2, oy, oz))
+algo4 = hexa.Segment(edge4)
+algo4.NumberOfSegments(9)
+algo4.Propagation()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# A holed cube build by partitioning geometric operations
+
+# Values
+# ------
+
+g_x = 0
+g_y = 0
+g_z = 0
+
+g_longueur = 50.0
+g_largeur = 40.0
+g_hauteur = 25.0
+
+g_rayon = 10
+
+g_trim = 1000
+
+# Box
+# ---
+
+b_boite = geompy.MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur, g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur)
+
+# Cylinder
+# --------
+
+c_axe = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+c_cyl = geompy.MakeCylinder(geompy.MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2)
+
+c_piece = geompy.MakeCut(b_boite, c_cyl)
+
+# Partition and reperation
+# ------------------------
+
+p_centre = geompy.MakeVertex(g_x, g_y, g_z)
+
+p_tools = []
+p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim))
+p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim))
+
+p_part = geompy.MakePartition([c_piece], p_tools, [], [], geompy.ShapeType["SOLID"])
+
+p_blocs = geompy.RemoveExtraEdges(p_part, doUnionFaces=True)
+piece = geompy.MakeGlueFaces(p_blocs, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex07_hole1partition")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex07_hole1partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(20)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# A twice holed cube build by points, edges, faces and solids
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+longueur = 200
+largeur = 100
+hauteur = 80
+
+cylindre = 50
+
+rayon = 20
+
+# Points
+# ------
+
+piecePoint1 = geompy.MakeVertex(ox , oy, oz)
+piecePoint2 = geompy.MakeVertex(ox+longueur, oy, oz)
+piecePoint3 = geompy.MakeVertex(ox+longueur, oy, oz+largeur)
+piecePoint4 = geompy.MakeVertex(ox , oy, oz+largeur)
+
+cz = oz+largeur/2
+
+cylPoint1 = geompy.MakeVertex(ox+cylindre , oy, cz-rayon)
+cylPoint2 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz-rayon)
+cylPoint3 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz+rayon)
+cylPoint4 = geompy.MakeVertex(ox+cylindre , oy, cz+rayon)
+
+# Edges
+# -----
+
+pieceEdge1 = geompy.MakeEdge(piecePoint1, piecePoint4)
+pieceEdge2 = geompy.MakeEdge(piecePoint1, cylPoint1)
+pieceEdge3 = geompy.MakeEdge(piecePoint4, cylPoint4)
+
+pieceEdge4 = geompy.MakeEdge(piecePoint2, piecePoint3)
+pieceEdge5 = geompy.MakeEdge(piecePoint2, cylPoint2)
+pieceEdge6 = geompy.MakeEdge(piecePoint3, cylPoint3)
+
+pieceEdge7 = geompy.MakeEdge(cylPoint1, cylPoint2)
+pieceEdge8 = geompy.MakeEdge(cylPoint3, cylPoint4)
+
+cylEdge1 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4)
+cylEdge2 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4)
+cylEdge3 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3)
+cylEdge4 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3)
+
+# Faces
+# -----
+
+pieceFace1 = geompy.MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 )
+pieceFace2 = geompy.MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3)
+pieceFace3 = geompy.MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 )
+pieceFace4 = geompy.MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6)
+pieceFace5 = geompy.MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 )
+
+# Solids
+# ------
+
+pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur)
+pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur)
+pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur)
+pieceSolid4 = geompy.MakePrismVecH(pieceFace4, pieceVector, hauteur)
+pieceSolid5 = geompy.MakePrismVecH(pieceFace5, pieceVector, hauteur)
+
+# Compound and glue
+# -----------------
+
+c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5])
+
+piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex08_hole2build")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex08_hole2build:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(7)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+# Geometry
+# ========
+
+# Element of a grid compound by a square with a cylinder on each vertex build by points, edges, faces and solids
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+arete = 50
+hauteur = 100
+
+rayon = 10
+
+demi = rayon/2
+r3 = demi*math.sqrt(3)
+
+# Points
+# ------
+
+piecePoint111 = geompy.MakeVertex(ox+rayon , oy, oz)
+piecePoint211 = geompy.MakeVertex(ox+arete-rayon, oy, oz)
+piecePoint112 = geompy.MakeVertex(ox , oy, oz+rayon)
+piecePoint212 = geompy.MakeVertex(ox+arete , oy, oz+rayon)
+piecePoint113 = geompy.MakeVertex(ox , oy, oz+arete-rayon)
+piecePoint213 = geompy.MakeVertex(ox+arete , oy, oz+arete-rayon)
+piecePoint114 = geompy.MakeVertex(ox+rayon , oy, oz+arete)
+piecePoint214 = geompy.MakeVertex(ox+arete-rayon, oy, oz+arete)
+
+pieceCenter1 = geompy.MakeVertex(ox , oy, oz)
+pieceCenter2 = geompy.MakeVertex(ox+arete , oy, oz)
+pieceCenter3 = geompy.MakeVertex(ox , oy, oz+arete)
+pieceCenter4 = geompy.MakeVertex(ox+arete , oy, oz+arete)
+
+piecePass1 = geompy.MakeVertex(ox+demi , oy, oz+r3)
+piecePass2 = geompy.MakeVertex(ox+arete-demi , oy, oz+r3)
+piecePass3 = geompy.MakeVertex(ox+arete-demi , oy, oz+arete-r3)
+piecePass4 = geompy.MakeVertex(ox+demi , oy, oz+arete-r3)
+
+# Edges
+# -----
+
+pieceEdgeSquare1 = geompy.MakeEdge(piecePoint111, piecePoint211)
+pieceEdgeSquare2 = geompy.MakeEdge(piecePoint114, piecePoint214)
+pieceEdgeSquare3 = geompy.MakeEdge(piecePoint112, piecePoint113)
+pieceEdgeSquare4 = geompy.MakeEdge(piecePoint212, piecePoint213)
+
+pieceEdgeDiagonal1 = geompy.MakeEdge(piecePoint111, piecePoint213)
+pieceEdgeDiagonal2 = geompy.MakeEdge(piecePoint112, piecePoint214)
+
+pieceEdgeArc1 = geompy.MakeArc(piecePoint111, piecePass1, piecePoint112)
+pieceEdgeArc2 = geompy.MakeArc(piecePoint211, piecePass2, piecePoint212)
+pieceEdgeArc3 = geompy.MakeArc(piecePoint213, piecePass3, piecePoint214)
+pieceEdgeArc4 = geompy.MakeArc(piecePoint113, piecePass4, piecePoint114)
+
+# Faces
+# -----
+
+pieceFace1 = geompy.MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1)
+pieceFace2 = geompy.MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2)
+
+pieceFace3 = geompy.MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2)
+
+# Solids
+# ------
+
+pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur)
+pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur)
+pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur)
+
+# Compound and glue
+# -----------------
+
+c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3])
+
+piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex09_grid4build")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex09_grid4build:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(6)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# Element of a grid compound by a square with a cylinder on each vertex build by using partition
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+arete = 50
+hauteur = 100
+rayon = 10
+
+g_trim = 1000
+
+# Box
+# ---
+
+piecePoint = geompy.MakeVertex(ox, oy, oz)
+
+pieceBox = geompy.MakeBoxTwoPnt(piecePoint, geompy.MakeVertex(ox+arete, oy+hauteur, oz+arete))
+
+# Cut by cylinders
+# ----------------
+
+dirUp = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+pieceCut1 = geompy.MakeCut(pieceBox , geompy.MakeCylinder(piecePoint , dirUp, rayon, hauteur))
+pieceCut2 = geompy.MakeCut(pieceCut1, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur))
+pieceCut3 = geompy.MakeCut(pieceCut2, geompy.MakeCylinder(geompy.MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur))
+pieceCut4 = geompy.MakeCut(pieceCut3, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur))
+
+# Compound by make a partition of a solid
+# ---------------------------------------
+
+dir = geompy.MakeVectorDXDYDZ(-1, 0, 1)
+
+tools = []
+tools.append(geompy.MakePlane(geompy.MakeVertex(ox+rayon, oy, oz ), dir, g_trim))
+tools.append(geompy.MakePlane(geompy.MakeVertex(ox , oy, oz+rayon), dir, g_trim))
+
+piece = geompy.MakePartition([pieceCut4], tools, [], [], geompy.ShapeType["SOLID"])
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex10_grid4geometry")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex10_grid4geometry:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(10)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# grid compound of 3 x 3 elements
+# an element is compound of 3 cylinders concentriques
+# an element is centered in a square of the grid
+# the smaller cylinder is a hole
+
+# prism the grid, and mesh it in hexahedral way
+
+# Values
+# ------
+
+g_x = 0
+g_y = 0
+g_z = 0
+
+g_arete = 50
+g_hauteur = 30
+
+g_rayon1 = 20
+g_rayon2 = 30
+g_rayon3 = 40
+
+g_grid = 3
+
+g_trim = 1000
+
+# Element
+# -------
+
+e_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
+
+e_hauteur = 2*g_hauteur
+e_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z)
+e_dir = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+e_cyl1 = geompy.MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur)
+
+e_blo1 = geompy.MakeCut(e_boite, e_cyl1)
+
+e_cyl2 = geompy.MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur)
+
+e_blo2 = geompy.MakeCut(e_cyl1, e_cyl2)
+
+e_cyl3 = geompy.MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur)
+
+e_blo3 = geompy.MakeCut(e_cyl2, e_cyl3)
+
+# Partition and repair
+# --------------------
+
+p_tools = []
+p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim))
+p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim))
+
+p_part = geompy.MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], geompy.ShapeType["SOLID"])
+
+p_element = geompy.RemoveExtraEdges(p_part, doUnionFaces=True)
+
+# Grid and glue
+# -------------
+
+grid = geompy.MakeMultiTranslation2D(p_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
+
+piece = geompy.MakeGlueFaces(grid, 1e-5)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex11_grid3partition")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex11_grid3partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(3)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import time
+t1= time.time()
+
+# Geometry
+# ========
+
+# grid compound of 3 x 3 elements
+# an element is compound of 3 concentric cylinders
+# an element is centered in a square of the grid
+
+# prism the grid, and mesh it in hexahedral way
+
+# Values
+# ------
+
+g_x = 0
+g_y = 0
+g_z = 0
+
+g_arete = 50
+g_hauteur = 30
+
+g_rayon1 = 20
+g_rayon2 = 30
+g_rayon3 = 40
+
+g_grid = 3
+
+g_trim = 1000
+
+# Solids and rotation to prevent repair
+# -------------------------------------
+
+s_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
+
+s_pi4 = 3.141592653/4
+s_hauteur = 2*g_hauteur
+s_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z)
+s_dir = geompy.MakeVectorDXDYDZ(0, 1, 0)
+
+s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon3, s_hauteur)
+s_cyl1 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4)
+
+s_blo1 = geompy.MakeCut(s_boite, s_cyl1)
+
+s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon2, s_hauteur)
+s_cyl2 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4)
+
+s_blo2 = geompy.MakeCut(s_cyl1, s_cyl2)
+
+s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon1, s_hauteur)
+s_cyl3 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4)
+
+s_blo3 = geompy.MakeCut(s_cyl2, s_cyl3)
+
+s_arete = g_rayon1/2
+
+s_blo4 = geompy.MakeBox(g_x-s_arete, g_y-g_hauteur, g_z-s_arete, g_x+s_arete, g_y+g_hauteur, g_z+s_arete)
+
+s_blo5 = geompy.MakeCut(s_cyl3, s_blo4)
+
+# Partition
+# ---------
+
+p_tools = []
+p_tools.append(geompy.MakePlane(s_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim))
+p_tools.append(geompy.MakePlane(s_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim))
+
+p_partie = geompy.MakePartition([s_blo1, s_blo2, s_blo3, s_blo5], p_tools, [], [], geompy.ShapeType["SOLID"])
+
+# Compound and glue
+# -----------------
+
+c_blocs = geompy.SubShapeAll(p_partie, geompy.ShapeType["SOLID"])
+c_blocs.append(s_blo4)
+
+c_cpd = geompy.MakeCompound(c_blocs)
+
+c_element = geompy.MakeGlueFaces(c_cpd, 1e-4)
+
+# Grid
+# ----
+
+piece = geompy.MakeMultiTranslation2D(c_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
+
+# Add in study
+# ------------
+
+piece_id = geompy.addToStudy(piece, "ex12_grid17partition")
+
+t2= time.time()
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex12_grid17partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(2)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+t3= time.time()
+
+print ("time geom",t2-t1)
+print ("time mesh",t3-t2 )
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# With hexahedral, build a box partially holed by a not centered cylinder with a thickness
+
+# Values
+# ------
+
+box_dx = 1000
+box_dy = 900
+box_dz = 800
+
+cyl_x = 500
+cyl_y = 300
+cyl_dz = 600
+cyl_radius = 150
+cyl_thick = 30
+
+# Triangular face
+# ---------------
+
+def triangle(p1, p2, p3):
+ l = []
+ l.append(geompy.MakeEdge(p1, p2))
+ l.append(geompy.MakeEdge(p2, p3))
+ l.append(geompy.MakeEdge(p3, p1))
+ w = geompy.MakeWire(l)
+ return geompy.MakeFace(w, 1)
+
+# The holed part
+# ==============
+
+# Vertex of the holed part
+# ------------------------
+
+hole_point_11 = geompy.MakeVertex(0 , 0 , 0)
+hole_point_21 = geompy.MakeVertex(box_dx, 0 , 0)
+hole_point_12 = geompy.MakeVertex(0 , box_dy, 0)
+hole_point_22 = geompy.MakeVertex(box_dx, box_dy, 0)
+
+hole_center = geompy.MakeVertex(cyl_x, cyl_y, 0)
+
+# Faces of the holed part
+# -----------------------
+
+hole_face_1 = triangle(hole_point_11, hole_point_21, hole_center)
+hole_face_2 = triangle(hole_point_21, hole_point_22, hole_center)
+hole_face_3 = triangle(hole_point_12, hole_point_22, hole_center)
+hole_face_4 = triangle(hole_point_11, hole_point_12, hole_center)
+
+# Solids of the holed part
+# ------------------------
+
+cyl_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+hole_solid_1 = geompy.MakePrismVecH(hole_face_1, cyl_dir, cyl_dz)
+hole_solid_2 = geompy.MakePrismVecH(hole_face_2, cyl_dir, cyl_dz)
+hole_solid_3 = geompy.MakePrismVecH(hole_face_3, cyl_dir, cyl_dz)
+hole_solid_4 = geompy.MakePrismVecH(hole_face_4, cyl_dir, cyl_dz)
+
+hole_internal = geompy.MakeCylinder(hole_center, cyl_dir, cyl_radius , cyl_dz)
+hole_external = geompy.MakeCylinder(hole_center, cyl_dir, cyl_radius+cyl_thick, cyl_dz)
+hole_median = geompy.MakeCut(hole_external, hole_internal)
+
+# Boolean operations
+# ------------------
+
+blocks = []
+
+blocks.append( geompy.MakeCut(hole_solid_1, hole_external))
+blocks.append(geompy.MakeCommon(hole_solid_1, hole_median ))
+
+blocks.append( geompy.MakeCut(hole_solid_2, hole_external))
+blocks.append(geompy.MakeCommon(hole_solid_2, hole_median ))
+
+blocks.append( geompy.MakeCut(hole_solid_3, hole_external))
+blocks.append(geompy.MakeCommon(hole_solid_3, hole_median ))
+
+blocks.append( geompy.MakeCut(hole_solid_4, hole_external))
+blocks.append(geompy.MakeCommon(hole_solid_4, hole_median ))
+
+# The full part
+# =============
+
+# Vertex of the full part
+# -----------------------
+
+full_point_11 = geompy.MakeVertex(0 , 0 , cyl_dz)
+full_point_21 = geompy.MakeVertex(box_dx, 0 , cyl_dz)
+full_point_12 = geompy.MakeVertex(0 , box_dy, cyl_dz)
+full_point_22 = geompy.MakeVertex(box_dx, box_dy, cyl_dz)
+
+full_center = geompy.MakeVertex(cyl_x, cyl_y, cyl_dz)
+
+# Faces of the full part
+# ----------------------
+
+full_face_1 = triangle(full_point_11, full_point_21, full_center)
+full_face_2 = triangle(full_point_21, full_point_22, full_center)
+full_face_3 = triangle(full_point_12, full_point_22, full_center)
+full_face_4 = triangle(full_point_11, full_point_12, full_center)
+
+# Solids of the full part
+# ------------------------
+
+full_dz = box_dz - cyl_dz
+
+full_solid_1 = geompy.MakePrismVecH(full_face_1, cyl_dir, full_dz)
+full_solid_2 = geompy.MakePrismVecH(full_face_2, cyl_dir, full_dz)
+full_solid_3 = geompy.MakePrismVecH(full_face_3, cyl_dir, full_dz)
+full_solid_4 = geompy.MakePrismVecH(full_face_4, cyl_dir, full_dz)
+
+full_internal = geompy.MakeCylinder(full_center, cyl_dir, cyl_radius , full_dz)
+full_external = geompy.MakeCylinder(full_center, cyl_dir, cyl_radius+cyl_thick, full_dz)
+full_median = geompy.MakeCut(full_external, full_internal)
+
+# Boolean operations
+# ------------------
+
+full = []
+
+full.append( geompy.MakeCut(full_solid_1, full_external))
+full.append(geompy.MakeCommon(full_solid_1, full_median))
+
+full.append( geompy.MakeCut(full_solid_2, full_external))
+full.append(geompy.MakeCommon(full_solid_2, full_median ))
+
+full.append( geompy.MakeCut(full_solid_3, full_external))
+full.append(geompy.MakeCommon(full_solid_3, full_median))
+
+full.append( geompy.MakeCut(full_solid_4, full_external))
+full.append(geompy.MakeCommon(full_solid_4, full_median))
+
+# Filling the hole
+# ----------------
+
+box_d = cyl_radius/3
+
+x = cyl_x-box_d
+y = x * cyl_y / cyl_x
+box_point_11 = geompy.MakeVertex(x, y, cyl_dz)
+
+x = cyl_x+box_d
+y = (box_dx - x) * cyl_y / (box_dx - cyl_x)
+box_point_12 = geompy.MakeVertex(x, y, cyl_dz)
+
+x = cyl_x-box_d
+y = box_dy - x * (box_dy - cyl_y) / cyl_x
+box_point_21 = geompy.MakeVertex(x, y, cyl_dz)
+
+x = cyl_x+box_d
+y = box_dy - (box_dx - x) * (box_dy - cyl_y) / (box_dx - cyl_x)
+box_point_22 = geompy.MakeVertex(x, y, cyl_dz)
+
+box_face = geompy.MakeQuad4Vertices(box_point_11, box_point_12, box_point_21, box_point_22)
+
+box = geompy.MakePrismVecH(box_face, cyl_dir, full_dz)
+
+full.append(box)
+
+full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_1, full_internal), box))
+full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_2, full_internal), box))
+full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_3, full_internal), box))
+full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_4, full_internal), box))
+
+# Cut the cylinder thickness
+# -------------------------
+
+full_plan = geompy.MakePlane(geompy.MakeVertex(0, 0, cyl_dz+cyl_thick), cyl_dir, 5000)
+
+full_parts = geompy.MakePartition(full, [full_plan], [], [], geompy.ShapeType["SOLID"])
+
+# Geometry result
+# ---------------
+
+blocks.append(full_parts)
+
+piece_cpd = geompy.MakeCompound(blocks)
+
+piece_ok = geompy.RemoveExtraEdges(piece_cpd, doUnionFaces=True)
+
+piece = geompy.MakeGlueFaces(piece_ok, 1.e-3)
+
+piece_id = geompy.addToStudy(piece, "ex13_hole1partial")
+
+# Meshing
+# =======
+
+# Create a mesh
+# -------------
+
+hexa = smesh.Mesh(piece, "ex13_hole1partial:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(2)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Local hypothesis
+# ----------------
+
+def local(x, y, z, d):
+ edge = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(x, y, z))
+ algo = hexa.Segment(edge)
+ algo.NumberOfSegments(d)
+ algo.Propagation()
+
+local(0, 0, 100, 40)
+local(0, 0, 700, 15)
+
+local(100, 0, 0, 20)
+local(0, 100, 0, 20)
+
+local(100, 100, 0, 25)
+
+d = cyl_radius-3*cyl_thick
+local(cyl_x+d, cyl_y+d, box_dz, 10)
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometrie
+# =========
+
+# Creer un cylindre avec un trou cylindrique excentre, decoupage en hexahedre et mailler.
+
+# Donnees
+# -------
+
+# unite: millimetre
+
+g_ox = 0
+g_oy = 0
+g_oz = 0
+
+g_cyl_rayon = 1000
+g_cyl_demiHauteur = 3000
+
+g_trou_rayon = 5
+g_trou_centre = 300
+
+g_trim = 15000
+
+# Construire le cylindre
+# ----------------------
+
+c_point = geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur)
+c_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
+c_hauteur = 2*g_cyl_demiHauteur
+c_cylindre = geompy.MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur)
+
+# Trouer le cylindre par un minuscule cylindre excentre
+# -----------------------------------------------------
+
+t_hauteur = g_cyl_demiHauteur
+t_point = geompy.MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur)
+t_trou = geompy.MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur)
+
+t_piece = geompy.MakeCut(c_cylindre, t_trou)
+
+# Geometrie hexahedrique
+# ======================
+
+# Decouper
+# --------
+
+h_outils = []
+h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(1, 0, 0), g_trim))
+h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
+
+h_piece = geompy.MakePartition([t_piece], h_outils, [], [], geompy.ShapeType["SOLID"])
+
+# Decouper pour les conditions locales
+# ------------------------------------
+
+l_outils = []
+l_i = 1
+l_n = 12
+l_hauteur = c_hauteur/l_n
+
+while l_i<l_n:
+ l_outils.append(geompy.MakePlane(geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur+l_i*l_hauteur), c_dir, g_trim))
+ l_i = l_i+1
+
+piece = geompy.MakePartition([h_piece], l_outils, [], [], geompy.ShapeType["SOLID"])
+
+# Ajouter la piece dans l'etude
+# -----------------------------
+
+piece_id = geompy.addToStudy(piece, "ex14_cyl1holed")
+
+# Maillage
+# ========
+
+# Creer un maillage hexahedrique
+# ------------------------------
+
+hexa = smesh.Mesh(piece, "ex14_cyl1holed:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(4)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Poser les hypotheses locales
+# ----------------------------
+
+m_i = 0
+m_n = 12
+m_h = c_hauteur/m_n
+m_d = [4, 6, 8, 10, 10, 9, 8, 7, 6, 5, 4, 3]
+
+m_x = g_ox+g_cyl_rayon
+m_y = g_oy
+m_z = g_oz-g_cyl_demiHauteur+m_h/2
+
+while m_i<m_n:
+ m_p = geompy.MakeVertex(m_x, m_y, m_z + m_i*m_h)
+ m_e = geompy.GetEdgeNearPoint(piece, m_p)
+ m_a = hexa.Segment(m_e)
+ m_a.NumberOfSegments(m_d[m_i])
+ m_a.Propagation()
+ m_i = m_i + 1
+
+# Calculer le maillage
+# --------------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometrie
+# =========
+
+# Construire avec des hexahedres une piece faite de 2 cylindres de diametre different
+# et dont les axes se coupent orthogonalement, puis mailler.
+
+# Valeurs
+# -------
+
+cx = 0
+cy = 0
+cz = 0
+
+g_rayon = 100.0
+g_hauteur = 500
+
+p_rayon = 50.0
+p_hauteur = 500
+
+g_trim = 1000
+
+# Gros cylindre
+# -------------
+
+cpd = []
+
+g_base = geompy.MakeVertex(cx, cy, cz)
+g_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
+t_hauteur = p_rayon+10.0
+
+g_cyl = geompy.MakeCylinder(g_base, g_dir, g_rayon, g_hauteur)
+
+g_coupe = geompy.MakeVectorDXDYDZ(1, 0, 0)
+
+g_tools = []
+g_tools.append(geompy.MakePlane(geompy.MakeVertex(cx+t_hauteur, cy, cz), g_coupe, g_trim))
+g_tools.append(geompy.MakePlane(geompy.MakeVertex(cx-t_hauteur, cy, cz), g_coupe, g_trim))
+
+g_partie = geompy.MakePartition([g_cyl], g_tools, [], [], geompy.ShapeType["SOLID"])
+g_bas, g_centre, g_haut = geompy.SubShapeAllSorted(g_partie, geompy.ShapeType["SOLID"])
+
+# Partie basse du gros cylindre
+# -----------------------------
+
+b_hauteur = 10
+b_base = 20
+
+b_boite = geompy.MakeBox(cx-t_hauteur, cy-b_base, cz, cx-t_hauteur-b_hauteur, cy+b_base, cz+g_hauteur)
+cpd.append(b_boite)
+
+b_cyl = geompy.MakeCut(g_bas, b_boite)
+
+b_tools = []
+b_tools.append(geompy.MakePlane(geompy.MakeVertex(cx-t_hauteur-b_hauteur, cy+b_base, cz), geompy.MakeVectorDXDYDZ( 1, 1, 0), g_trim))
+b_tools.append(geompy.MakePlane(geompy.MakeVertex(cx-t_hauteur-b_hauteur, cy-b_base, cz), geompy.MakeVectorDXDYDZ(-1, 1, 0), g_trim))
+
+b_partie = geompy.MakePartition([b_cyl], b_tools, [], [], geompy.ShapeType["SOLID"])
+b_element = geompy.SubShapeAll(b_partie, geompy.ShapeType["SOLID"])
+cpd = cpd + b_element
+
+# Partie haute du gros cylindre
+# -----------------------------
+
+h_plan = geompy.MakePlane(g_base, g_coupe, g_trim)
+
+cpd.append(geompy.MakeMirrorByPlane(b_boite, h_plan))
+
+for h in b_element:
+ h_symetrie = geompy.MakeMirrorByPlane(h, h_plan)
+ cpd.append(h_symetrie)
+
+# Petit cylindre
+# --------------
+
+z_arete = p_rayon/2
+x_arete = z_arete*t_hauteur*2/g_hauteur
+
+px = cx-x_arete
+py = cy-1.5*g_rayon
+pz = cz+g_hauteur/2
+
+p_base = geompy.MakeVertex(cx, py, pz)
+p_dir = geompy.MakeVectorDXDYDZ(0, 1, 0)
+p_cyl = geompy.MakeCylinder(p_base, p_dir, p_rayon, p_hauteur)
+
+p_boite = geompy.MakeBox(px, py, pz-z_arete, cx+x_arete, py+p_hauteur, pz+z_arete)
+
+# Partie interieure du petit cylindre
+# -----------------------------------
+
+i_cyl = geompy.MakeCommon(p_cyl, g_cyl)
+i_tuyau = geompy.MakeCut(i_cyl, p_boite)
+i_boite = geompy.MakeCommon(p_boite, g_cyl)
+
+# Partie exterieure du petit cylindre
+# -----------------------------------
+
+e_cyl0 = geompy.MakeCut(p_cyl, g_cyl)
+e_cyl = geompy.SubShapeAllSorted(e_cyl0, geompy.ShapeType["SOLID"])
+
+e_tuyau = geompy.MakeCut(e_cyl[1], p_boite)
+
+e_boite0 = geompy.MakeCut(p_boite, g_cyl)
+e_boite = geompy.SubShapeAllSorted(e_boite0, geompy.ShapeType["SOLID"])
+
+cpd.append(e_boite[1])
+
+# Partie centrale du gros cylindre
+# --------------------------------
+
+c_cyl = geompy.MakeCut(g_centre, p_cyl)
+
+# Partitionner
+# ------------
+
+p_tools = []
+p_tools.append(geompy.MakePlane(geompy.MakeVertex(px, py, pz-z_arete), geompy.MakeVectorDXDYDZ(-z_arete, 0, x_arete), g_trim))
+p_tools.append(geompy.MakePlane(geompy.MakeVertex(px, py, pz+z_arete), geompy.MakeVectorDXDYDZ( z_arete, 0, x_arete), g_trim))
+
+p_partie = geompy.MakePartition([e_tuyau], p_tools, [], [], geompy.ShapeType["SOLID"])
+p_element = geompy.SubShapeAll(p_partie, geompy.ShapeType["SOLID"])
+cpd = cpd + p_element
+
+q_partie = geompy.MakePartition([i_tuyau, c_cyl], p_tools, [], [], geompy.ShapeType["SOLID"])
+q_element = geompy.SubShapeAll(q_partie, geompy.ShapeType["SOLID"])
+
+q_element = q_element + [i_boite]
+
+q_tools = []
+q_tools.append(geompy.MakePlane(geompy.MakeVertex(cx, cy-b_base, cz), geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
+q_tools.append(geompy.MakePlane(geompy.MakeVertex(cx, cy+b_base, cz), geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
+
+r_element = []
+for e in q_element:
+ r_partie = geompy.MakePartition([e], q_tools, [], [], geompy.ShapeType["SOLID"])
+ r_element = r_element + geompy.SubShapeAll(r_partie, geompy.ShapeType["SOLID"])
+
+cpd = cpd + r_element
+
+# Compound
+# --------
+
+piece = geompy.RemoveExtraEdges(geompy.MakeCompound(cpd), True)
+
+# Ajouter la piece dans l'etude
+# -----------------------------
+
+piece_id = geompy.addToStudy(piece, "ex15_cyl2geometry")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex15_cyl2geometry:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(12)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# Create the hexahedrical block geometry of a holed parallelepipede.
+# The hole has a T form composed by 2 cylinders with different radius, and their axis are normal.
+# This piece is meshed in hexahedrical.
+
+# Values
+# ------
+
+gx = 0
+gy = 0
+gz = 0
+
+g_dx = 250
+g_dy = 200
+g_dz = 150
+
+g_rayonGrand = 70
+g_rayonPetit = 50
+
+g_trim = 1000
+
+# The parallelepipede
+# -------------------
+
+p_boite = geompy.MakeBox(gx-g_dx, gy-g_dy, gz-g_dz, gx+g_dx, gy+g_dy, gz+g_dz)
+
+# The great cylinder
+# ------------------
+
+g_base = geompy.MakeVertex(gx-g_dx, gy, gz)
+g_dir = geompy.MakeVectorDXDYDZ(1, 0, 0)
+g_cyl = geompy.MakeCylinder(g_base, g_dir, g_rayonGrand, g_dx*2)
+
+# The first hole
+# --------------
+
+b_boite = geompy.MakeCut(p_boite , g_cyl)
+
+# Partitioning
+# ------------
+
+p_base = geompy.MakeVertex(gx, gy, gz)
+
+p_tools = []
+
+p_tools.append(geompy.MakePlane(p_base, geompy.MakeVectorDXDYDZ(0, 1 , 0 ), g_trim))
+p_tools.append(geompy.MakePlane(p_base, geompy.MakeVectorDXDYDZ(0, g_dz, g_dy), g_trim))
+p_tools.append(geompy.MakePlane(p_base, geompy.MakeVectorDXDYDZ(0, -g_dz, g_dy), g_trim))
+
+p_tools.append(geompy.MakePlane(geompy.MakeVertex(gx-g_rayonPetit, gy, gz), g_dir, g_trim))
+p_tools.append(geompy.MakePlane(geompy.MakeVertex(gx+g_rayonPetit, gy, gz), g_dir, g_trim))
+
+p_piece = geompy.MakePartition([b_boite], p_tools, [], [], geompy.ShapeType["SOLID"])
+
+# The small cylinder
+# ------------------
+
+c_cyl = geompy.MakeCylinder(p_base, geompy.MakeVectorDXDYDZ(0, 0, 1), g_rayonPetit, g_dz)
+
+# The second hole
+# ---------------
+
+d_element = geompy.SubShapeAllSorted(p_piece, geompy.ShapeType["SOLID"])
+
+d_element[ 8] = geompy.MakeCut(d_element[ 8], c_cyl)
+d_element[10] = geompy.MakeCut(d_element[10], c_cyl)
+
+# Compound
+# --------
+
+piece = geompy.RemoveExtraEdges(geompy.MakeCompound(d_element))
+piece = geompy.MakeGlueFaces(piece, 1e-07)
+
+# Add piece in study
+# ------------------
+
+piece_id = geompy.addToStudy(piece, "ex16_cyl2complementary")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex16_cyl2complementary:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(12)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Define local hypothesis
+# -----------------------
+
+def local(x, y, z, d):
+ edge = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(x, y, z))
+ algo = hexa.Segment(edge)
+ algo.NumberOfSegments(d)
+ algo.Propagation()
+
+local(gx , gy+g_dy, gz+g_dz, 7)
+local(gx+g_dx, gy+g_dy, gz , 21)
+local(gx+g_dx, gy-g_dy, gz , 21)
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometrie
+# =========
+
+# Creer un cylindre surplombe d'une demi-sphere le tout troue par un petit cylindre.
+# Decouper en hexahedre et mailler.
+
+# Donnees
+# -------
+
+cylindre_rayon = 100
+cylindre_hauteur = 400
+
+trou_rayon = 20
+trou_z = cylindre_rayon/2
+
+plan_trim = 2000
+
+# Cylindre
+# --------
+
+cylindre_base = geompy.MakeVertex(0, 0, 0)
+cylindre_dir = geompy.MakeVectorDXDYDZ(1, 0, 0)
+cylindre = geompy.MakeCylinder(cylindre_base, cylindre_dir, cylindre_rayon, cylindre_hauteur)
+
+# Dome
+# ----
+
+dome_sphere = geompy.MakeSpherePntR(cylindre_base, cylindre_rayon)
+dome = geompy.MakeFuse(dome_sphere, cylindre)
+
+# Cheminee
+# --------
+
+cheminee_base = geompy.MakeVertex(-cylindre_hauteur/2, 0, trou_z)
+cheminee_trou = geompy.MakeCylinder(cheminee_base, cylindre_dir, trou_rayon, 2*cylindre_hauteur)
+cheminee = geompy.MakeCut(dome, cheminee_trou)
+
+# Decoupage et reparation
+# -----------------------
+
+blocs_plan1 = geompy.MakePlane(cheminee_base, geompy.MakeVectorDXDYDZ(0, 1, 0), plan_trim)
+blocs_plan2 = geompy.MakePlane(cheminee_base, geompy.MakeVectorDXDYDZ(0, 0, 1), plan_trim)
+
+blocs_part = geompy.MakePartition([cheminee], [blocs_plan1, blocs_plan2], [], [], geompy.ShapeType["SOLID"])
+
+piece = geompy.RemoveExtraEdges(blocs_part)
+
+# Etude
+# -----
+
+piece_id = geompy.addToStudy(piece, "ex17_dome1")
+
+# Maillage
+# ========
+
+# Maillage hexahedrique
+# ---------------------
+
+hexa = smesh.Mesh(piece, "ex17_dome1:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(20)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Calcul du maillage
+# ------------------
+
+hexa.Compute()
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import math
+
+# Geometrie
+# =========
+
+# Creer un cylindre ayant a chaque bout un morceau de sphere et le tout troue par un petit cylindrique excentre.
+# Decouper en hexahedre et mailler.
+
+# Donnees
+# -------
+
+# unite: millimetre
+
+g_ox = 0
+g_oy = 0
+g_oz = 0
+
+g_cyl_rayon = 1000
+g_cyl_demiHauteur = 3000
+
+g_trou_rayon = 5
+g_trou_centre = 300
+
+g_sphere_rayon = 3500
+
+g_trim = 15000
+
+# Cylindre
+# --------
+
+c_point = geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur)
+c_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
+c_hauteur = 2*g_cyl_demiHauteur
+
+c_cylindre = geompy.MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur)
+
+# Sphere
+# ------
+
+s_hauteur = math.sqrt(g_sphere_rayon*g_sphere_rayon - g_cyl_rayon*g_cyl_rayon) - g_cyl_demiHauteur
+
+s_sphere = geompy.MakeSphere(g_ox, g_oy, g_oz-s_hauteur, g_sphere_rayon)
+
+# Calottes
+# --------
+
+c_outils = []
+c_outils.append(geompy.MakePlane(geompy.MakeVertex(g_ox, g_oy, g_oz+g_cyl_demiHauteur), geompy.MakeVectorDXDYDZ(0, 0, 1), g_trim))
+
+c_cpd = geompy.MakePartition([s_sphere], c_outils, [], [], geompy.ShapeType["SOLID"])
+c_calotte_haut, c_reste = geompy.SubShapeAllSorted(c_cpd, geompy.ShapeType["SOLID"])
+
+c_plan = geompy.MakePlane(geompy.MakeVertex(g_ox, g_oy, g_oz), geompy.MakeVectorDXDYDZ(0, 0, 1), g_trim)
+c_calotte_bas = geompy.MakeMirrorByPlane(c_calotte_haut, c_plan)
+
+# Fusionner
+# ---------
+
+f_piece1 = geompy.MakeFuse(c_cylindre, c_calotte_haut)
+f_piece = geompy.MakeFuse(f_piece1, c_calotte_bas)
+
+# Trouer
+# ------
+
+t_hauteur = g_sphere_rayon
+t_point = geompy.MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur)
+t_trou = geompy.MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur)
+
+t_piece = geompy.MakeCut(f_piece, t_trou)
+
+# Decouper
+# --------
+
+h_outils = []
+h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(1, 0, 0), g_trim))
+h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
+
+h_piece = geompy.MakePartition([t_piece], h_outils, [], [], geompy.ShapeType["SOLID"])
+
+# Reparer
+# -------
+
+piece = geompy.RemoveExtraEdges(h_piece)
+
+# Ajouter la piece dans l'etude
+# -----------------------------
+
+piece_id = geompy.addToStudy(piece, "ex18_dome2")
+
+# Maillage
+# ========
+
+# Maillage hexahedrique
+# ---------------------
+
+hexa = smesh.Mesh(piece, "ex18_dome2:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(2)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Calcul du maillage
+# ------------------
+
+hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometrie
+# =========
+
+# Mailler en hexahedre une sphere dans un cube.
+
+# Donnees
+# -------
+
+sphere_rayon = 100
+
+cube_cote = 200
+
+plan_trim = 1000
+
+# Sphere
+# ------
+
+sphere_centre = geompy.MakeVertex(0, 0, 0)
+
+sphere_pleine = geompy.MakeSpherePntR(sphere_centre, sphere_rayon)
+
+# Cube interieur
+# --------------
+
+boite_cote = sphere_rayon / 2
+
+boite = geompy.MakeBox(-boite_cote, -boite_cote, -boite_cote, +boite_cote, +boite_cote, +boite_cote)
+
+blocs = [boite]
+
+# Decoupage sphere
+# ----------------
+
+sphere_troue = geompy.MakeCut(sphere_pleine, boite)
+
+#sphere_outils = []
+#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, 1), plan_trim))
+#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, -1), plan_trim))
+#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 1, 0), plan_trim))
+#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ(-1, 1, 0), plan_trim))
+
+f1 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), plan_trim)
+f2 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ(-1, 1, 0), plan_trim)
+f3 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ( 1, 1, 0), plan_trim)
+f4 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ( 1, 0, -1), plan_trim)
+
+
+#sphere_decoupee = MakePartition(solids, sphere_outils, [], [], ShapeType["SOLID"])
+
+sphere_decoupee = geompy.MakePartition([sphere_troue], [f1], [], [], geompy.ShapeType["SOLID"])
+sphere_decoupee = geompy.MakePartition([sphere_decoupee], [f2], [], [], geompy.ShapeType["SOLID"])
+sphere_decoupee = geompy.MakePartition([sphere_decoupee], [f3], [], [], geompy.ShapeType["SOLID"])
+sphere_decoupee = geompy.MakePartition([sphere_decoupee], [f4], [], [], geompy.ShapeType["SOLID"])
+
+sphere_partie = geompy.MakeCompound([sphere_decoupee])
+
+sphere_partie = geompy.GetBlockNearPoint(sphere_decoupee, geompy.MakeVertex(-sphere_rayon, 0, 0))
+sphere_bloc = geompy.RemoveExtraEdges(sphere_partie)
+
+blocs.append(sphere_bloc)
+
+pi2 = 3.141592653/2
+
+sphere_dir1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+sphere_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir1, +pi2))
+blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir1, -pi2))
+
+blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir2, +pi2))
+blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir2, -pi2))
+
+blocs.append(geompy.MakeMirrorByPoint(sphere_bloc, sphere_centre))
+
+# Cube exterieur
+# --------------
+
+cube_plein = geompy.MakeBox(-cube_cote, -cube_cote, -cube_cote, +cube_cote, +cube_cote, +cube_cote)
+cube_trou = geompy.MakeCut(cube_plein, sphere_pleine)
+#cube_decoupe = MakePartition([cube_trou], sphere_outils, [], [], ShapeType["SOLID"])
+
+cube_decoupe = geompy.MakePartition([cube_trou], [f1], [], [], geompy.ShapeType["SOLID"])
+cube_decoupe = geompy.MakePartition([cube_decoupe], [f2], [], [], geompy.ShapeType["SOLID"])
+cube_decoupe = geompy.MakePartition([cube_decoupe], [f3], [], [], geompy.ShapeType["SOLID"])
+cube_decoupe = geompy.MakePartition([cube_decoupe], [f4], [], [], geompy.ShapeType["SOLID"])
+
+cube_decoupe = geompy.MakeCompound([cube_decoupe])
+
+
+cube_partie = geompy.GetBlockNearPoint(cube_decoupe, geompy.MakeVertex(-cube_cote, 0, 0))
+cube_bloc = geompy.RemoveExtraEdges(cube_partie)
+
+blocs.append(cube_bloc)
+
+blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir1, +pi2))
+blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir1, -pi2))
+
+blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir2, +pi2))
+blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir2, -pi2))
+
+blocs.append(geompy.MakeMirrorByPoint(cube_bloc, sphere_centre))
+
+# Piece
+# -----
+
+piece_cpd = geompy.MakeCompound(blocs)
+piece = geompy.MakeGlueFaces(piece_cpd, 1.e-3)
+
+piece_id = geompy.addToStudy(piece, "ex19_sphereINcube")
+
+# Groupe geometrique
+# ==================
+
+# Definition du groupe
+# --------------------
+
+groupe = geompy.CreateGroup(piece, geompy.ShapeType["SOLID"])
+
+groupe_nom = "ex19_sphereINcube_interieur"
+geompy.addToStudy(groupe, groupe_nom)
+groupe.SetName(groupe_nom)
+
+# Contenu du groupe
+# -----------------
+
+groupe_sphere = geompy.GetShapesOnSphere(piece, geompy.ShapeType["SOLID"], sphere_centre, sphere_rayon, GEOM.ST_ONIN)
+
+geompy.UnionList(groupe, groupe_sphere)
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex19_sphereINcube:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(10)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Le groupe de mailles
+# --------------------
+
+hexa_groupe = hexa.Group(groupe)
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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 salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Geometry
+# ========
+
+# an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral.
+
+# Define values
+# -------------
+
+name = "ex21_lamp"
+
+cote = 60
+
+section = 20
+size = 200
+
+radius_1 = 80
+radius_2 = 40
+height = 100
+
+# Build a box
+# -----------
+
+box = geompy.MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
+
+# Build a cylinder
+# ----------------
+
+pt1 = geompy.MakeVertex(0, 0, cote/3)
+di1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+cyl = geompy.MakeCylinder(pt1, di1, section, size)
+
+# Build a truncated cone
+# ----------------------
+
+pt2 = geompy.MakeVertex(0, 0, size)
+cone = geompy.MakeCone(pt2, di1, radius_1, radius_2, height)
+
+# Fuse
+# ----
+
+box_cyl = geompy.MakeFuse(box, cyl)
+piece = geompy.MakeFuse(box_cyl, cone)
+
+# Add in study
+# ------------
+
+geompy.addToStudy(piece, name)
+
+# Create a group of faces
+# -----------------------
+
+group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"])
+
+group_name = name + "_grp"
+geompy.addToStudy(group, group_name)
+group.SetName(group_name)
+
+# Add faces in the group
+# ----------------------
+
+faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"])
+
+geompy.UnionIDs(group, faces)
+
+# Create a mesh
+# =============
+
+# Define a mesh on a geometry
+# ---------------------------
+
+tetra = smesh.Mesh(piece, name)
+
+# Define 1D hypothesis
+# --------------------
+
+algo1d = tetra.Segment()
+algo1d.LocalLength(10)
+
+# Define 2D hypothesis
+# --------------------
+
+algo2d = tetra.Triangle()
+algo2d.LengthFromEdges()
+
+# Define 3D hypothesis
+# --------------------
+
+algo3d = tetra.Tetrahedron(smeshBuilder.NETGEN)
+algo3d.MaxElementVolume(100)
+
+# Compute the mesh
+# ----------------
+
+tetra.Compute()
+
+# Create a groupe of faces
+# ------------------------
+
+tetra.Group(group)
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
\ No newline at end of file
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# ==================================
+#
+import math
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+geo = geompy
+
+# Parameters
+# ----------
+
+radius = 50
+height = 200
+
+# Build a cylinder
+# ----------------
+
+base = geompy.MakeVertex(0, 0, 0)
+direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+cylinder = geompy.MakeCylinder(base, direction, radius, height)
+
+geompy.addToStudy(cylinder, "cylinder")
+
+# Build blocks
+# ------------
+
+size = radius/2.0
+
+box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height)
+box_axis = geompy.MakeLine(base, direction)
+box = geompy.MakeRotation(box_rot, box_axis, math.pi/4)
+
+hole = geompy.MakeCut(cylinder, box)
+
+plane_trim = 2000
+
+plane_a = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
+plane_b = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
+
+blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"])
+blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"])
+blocks_all = geompy.MakeCompound(blocks_list)
+blocks = geompy.MakeGlueFaces(blocks_all, 0.0001)
+
+geompy.addToStudy(blocks, "cylinder:blocks")
+
+# Build geometric groups
+# ----------------------
+
+def group(name, shape, type, base=None, direction=None):
+ t = geompy.ShapeType[type]
+ g = geompy.CreateGroup(shape, t)
+
+ geompy.addToStudy(g, name)
+ g.SetName(name)
+
+ if base!=None:
+ l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON)
+ geompy.UnionIDs(g, l)
+
+ return g
+
+group_a = group("baseA", blocks, "FACE", base, direction)
+
+base_b = geompy.MakeVertex(0, 0, height)
+group_b = group("baseB", blocks, "FACE", base_b, direction)
+
+group_1 = group("limit", blocks, "SOLID")
+group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"])
+geompy.UnionIDs(group_1, group_1_all)
+group_1_box = geompy.GetBlockNearPoint(blocks, base)
+geompy.DifferenceList(group_1, [group_1_box])
+
+# Mesh the blocks with hexahedral
+# -------------------------------
+
+smesh.UpdateStudy()
+
+def discretize(x, y, z, n, s=blocks):
+ p = geompy.MakeVertex(x, y, z)
+ e = geompy.GetEdgeNearPoint(s, p)
+ a = hexa.Segment(e)
+ a.NumberOfSegments(n)
+ a.Propagation()
+
+hexa = smesh.Mesh(blocks)
+
+hexa_1d = hexa.Segment()
+hexa_1d.NumberOfSegments(1)
+
+discretize(+radius , +radius, 0, 5)
+discretize(-radius , +radius, 0, 8)
+discretize((radius+size)/2, 0, 0, 10)
+discretize( +radius, 0, height/2, 20)
+
+hexa.Quadrangle()
+hexa.Hexahedron()
+
+hexa.Compute()
+
+hexa.Group(group_a)
+hexa.Group(group_b)
+hexa.Group(group_1)
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# =======================================
+# Procedure that take a triangulation and split all triangles in 4 others triangles
+#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import os
+
+# Values
+# ------
+
+tmpDir = os.getenv('SALOME_TMP_DIR', '/tmp')
+print("Output directory:", tmpDir)
+
+# Path for ".med" files
+path = os.path.join( tmpDir, "ex29_%s_" % os.getenv('USER','unknown'))
+
+# Name of the shape and the mesh
+name = "Carre"
+
+# Add a node and needed edges
+# ---------------------------
+
+def node(m, f, n1, n2, lnv):
+ x1, y1, z1 = m.GetNodeXYZ(n1)
+ x2, y2, z2 = m.GetNodeXYZ(n2)
+
+ x = (x1 + x2) / 2.0
+ y = (y1 + y2) / 2.0
+ z = (z1 + z2) / 2.0
+
+ i = m.AddNode(x, y, z)
+
+ in1 = m.GetShapeID(n1)
+ in2 = m.GetShapeID(n2)
+
+ if (in1==f) or (in2==f):
+ m.SetNodeOnFace(i, f, 0, 0)
+
+ else:
+ e1 = m.AddEdge([ n1, i ])
+ e2 = m.AddEdge([ i , n2 ])
+
+ if n1 in lnv:
+ e = in2
+ else:
+ e = in1
+
+ m.SetMeshElementOnShape(e1, e)
+ m.SetMeshElementOnShape(e2, e)
+ m.SetNodeOnEdge(i, e, 0)
+
+ return i
+
+# Add a triangle and associate to the CAD face
+# --------------------------------------------
+
+def triangle(m, f, n1, n2, n3):
+ i = m.AddFace([ n1, n2, n3 ])
+ m.SetMeshElementOnShape(i, f)
+
+# Split all triangles in 4 triangles
+# ----------------------------------
+
+def SplitTrianglesIn4(m):
+ # Get all triangles
+ triangles = m.GetElementsByType(SMESH.FACE)
+
+ # Remove all edges
+ m.RemoveElements(m.GetElementsByType(SMESH.EDGE))
+
+ # Get the list of nodes (ids) associated with the CAD vertices
+ shape = m.GetShape()
+ lnv = []
+ for v in geompy.SubShapeAll(shape, geompy.ShapeType["VERTEX"]):
+ lnv = lnv + m.GetSubMeshNodesId(v, True)
+
+ # Split every triangle
+ for t in triangles:
+ noeud_1, noeud_2, noeud_3 = m.GetElemNodes(t)
+
+ face = m.GetShapeIDForElem(t)
+
+ noeud_12 = node(m, face, noeud_1, noeud_2, lnv)
+ noeud_23 = node(m, face, noeud_2, noeud_3, lnv)
+ noeud_13 = node(m, face, noeud_1, noeud_3, lnv)
+
+ triangle(m, face, noeud_1 , noeud_12, noeud_13)
+ triangle(m, face, noeud_2 , noeud_23, noeud_12)
+ triangle(m, face, noeud_3 , noeud_13, noeud_23)
+ triangle(m, face, noeud_12, noeud_23, noeud_13)
+
+ # Remove all initial triangles
+ m.RemoveElements(triangles)
+
+ # Merge all identical nodes
+ m.MergeNodes(m.FindCoincidentNodes(0.0001))
+
+# Build a CAD square
+# ------------------
+
+x0 = 0.0 ; y0 = 0.0 ; z0 = 0.0
+x1 = 1.0 ; y1 = 0.0 ; z1 = 0.0
+x2 = 1.0 ; y2 = 1.0 ; z2 = 0.0
+x3 = 0.0 ; y3 = 1.0 ; z3 = 0.0
+
+P0 = geompy.MakeVertex(x0, y0, z0)
+P1 = geompy.MakeVertex(x1, y1, z1)
+P2 = geompy.MakeVertex(x2, y2, z2)
+P3 = geompy.MakeVertex(x3, y3, z3)
+
+square = geompy.MakeQuad4Vertices(P0, P1, P2, P3)
+geompy.addToStudy(square, name)
+
+# Refine edges and create group of mesh
+# -------------------------------------
+
+def refine(m, p1, p2, n, k, name):
+ s = m.GetShape()
+
+ g = geompy.CreateGroup(s, geompy.ShapeType["EDGE"])
+ e = geompy.GetEdge(s, p1, p2)
+ i = geompy.GetSubShapeID(s, e)
+ geompy.AddObject(g, i)
+ m.Group(g, name)
+
+ a = m.Segment(e)
+ a.NumberOfSegments(n, k)
+
+# Mesh the square
+# ---------------
+
+MyMesh = smesh.Mesh(square)
+
+refine(MyMesh, P1, P2, 8, 7, "Droite")
+refine(MyMesh, P3, P0, 9, 10, "Gauche")
+refine(MyMesh, P0, P1, 7, 9, "Bas" )
+refine(MyMesh, P2, P3, 12, 14, "Haut" )
+
+algo2D = MyMesh.Triangle()
+algo2D.MaxElementArea(0.07)
+
+MyMesh.Compute()
+
+MyMesh.ExportMED(path+"110_triangles.med", 0)
+
+# Disturb the mesh
+# ----------------
+
+MyMesh.MoveNode( 37, 0.05 , 0.368967 , 0 )
+MyMesh.MoveNode( 38, 0.34 , 0.0762294, 0 )
+MyMesh.MoveNode( 40, 0.8 , 0.42 , 0 )
+MyMesh.MoveNode( 42, 0.702662, 0.74 , 0 )
+MyMesh.MoveNode( 46, 0.4 , 0.374656 , 0 )
+MyMesh.MoveNode( 47, 0.13 , 0.63 , 0 )
+MyMesh.MoveNode( 49, 0.222187, 0.3 , 0 )
+MyMesh.MoveNode( 54, 0.557791, 0.05 , 0 )
+MyMesh.MoveNode( 55, 0.7 , 0.2 , 0 )
+MyMesh.MoveNode( 56, 0.73 , 0.52 , 0 )
+MyMesh.MoveNode( 58, 0.313071, 0.31 , 0 )
+MyMesh.MoveNode( 59, 0.8 , 0.56 , 0 )
+MyMesh.MoveNode( 62, 0.592703, 0.95 , 0 )
+MyMesh.MoveNode( 63, 0.28 , 0.5 , 0 )
+MyMesh.MoveNode( 65, 0.49 , 0.93 , 0 )
+MyMesh.MoveNode( 68, 0.501038, 0.65 , 0 )
+MyMesh.MoveNode( 69, 0.37 , 0.63 , 0 )
+MyMesh.MoveNode( 70, 0.597025, 0.52 , 0 )
+MyMesh.MoveNode( 72, 0.899 , 0.878589 , 0 )
+MyMesh.MoveNode( 73, 0.92 , 0.85 , 0 )
+MyMesh.MoveNode( 74, 0.820851, 0.75 , 0 )
+
+NbCells1 = 110
+MyMesh.ExportMED(path+"110_triangles_2.med", 0)
+
+# First mesh refining
+# -------------------
+
+SplitTrianglesIn4(MyMesh)
+
+NbCells2 = NbCells1*4
+print(("Mesh with "+str(NbCells2)+" cells computed."))
+
+MyMesh.ExportMED(path+str(NbCells2)+"_triangles.med", 0)
+
+# Second mesh refining
+# --------------------
+
+SplitTrianglesIn4(MyMesh)
+
+NbCells3 = NbCells2*4
+print(("Mesh with "+str(NbCells3)+" cells computed."))
+
+MyMesh.ExportMED(path+str(NbCells3)+"_triangles.med",0)
+
+# Third mesh refining
+# -------------------
+
+SplitTrianglesIn4(MyMesh)
+
+NbCells4 = NbCells3*4
+print(("Mesh with "+str(NbCells4)+" cells computed."))
+
+MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0)
+
+# Update the object browser
+# -------------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+import math
+
+global Face_1
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+geompy.addToStudy( Face_1, "Face_1" )
+
+smesh.UpdateStudy()
+from salome.StdMeshers import StdMeshersBuilder
+pattern = smesh.GetPattern()
+Mesh_1 = smesh.Mesh(Face_1)
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Mesh_1.Quadrangle()
+isDone = Mesh_1.Compute()
+
+# groups creation
+
+aListOfElems = [ 52, 53, 54, 55, 56, 57,
+ 62, 63, 64, 65, 66, 67,
+ 72, 73, 74, 75, 76, 77,
+ 82, 83, 84, 85, 86, 87 ]
+
+aRedGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Red" )
+aRedGroup.Add( aListOfElems );
+aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )
+
+aListOfElems = [ 55, 56, 57, 58, 59,
+ 65, 66, 67, 68, 69,
+ 75, 76, 77, 78, 79,
+ 85, 86, 87, 88, 89,
+ 95, 96, 97, 98, 99,
+ 105, 106, 107, 108, 109,
+ 115, 116, 117, 118, 119,
+ 125, 126, 127, 128, 129 ]
+
+aGreenGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Green" )
+aGreenGroup.Add( aListOfElems );
+aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )
+
+aListOfElems = [ 63, 64, 65, 66, 67, 68,
+ 73, 74, 75, 76, 77, 78,
+ 83, 84, 85, 86, 87, 88,
+ 93, 94, 95, 96, 97, 98,
+ 103, 104, 105, 106, 107, 108,
+ 113, 114, 115, 116, 117, 118 ]
+
+aBlueGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Blue" )
+aBlueGroup.Add( aListOfElems );
+aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )
+
+# UnionListOfGroups()
+aUnGrp = Mesh_1.UnionListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "UnionGrp" )
+
+# IntersectListOfGroups()
+aIntGrp=Mesh_1.IntersectListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "IntGrp" )
+
+# CutListOfGroups()
+aCutGrp=Mesh_1.CutListOfGroups([aRedGroup],[aGreenGroup,aBlueGroup],"CutGrp")
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+# ====================================================================
+#
+import os
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+# Parameters
+# ----------
+
+results = "/tmp/ZZ"
+
+radius = 50
+height = 200
+
+# Build a cylinder
+# ----------------
+
+base = geompy.MakeVertex(0, 0, 0)
+direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+cylinder = geompy.MakeCylinder(base, direction, radius, height)
+
+geompy.addToStudy(cylinder, "Cylinder")
+
+# Define a mesh on a geometry
+# ---------------------------
+
+smesh.UpdateStudy()
+
+m = smesh.Mesh(cylinder)
+
+# 2D mesh with BLSURF
+# -------------------
+
+algo2d = m.Triangle(smeshBuilder.BLSURF)
+
+algo2d.SetPhysicalMesh(1)
+algo2d.SetPhySize(5)
+
+algo2d.SetGeometricMesh(0)
+
+# 3D mesh with tepal
+# ------------------
+
+algo3d = m.Tetrahedron(smeshBuilder.GHS3DPRL)
+
+algo3d.SetMEDName(results)
+algo3d.SetNbPart(4)
+algo3d.SetBackground(False)
+algo3d.SetKeepFiles(False)
+
+# Launch meshers
+# --------------
+
+status = m.Compute()
+
+# Test if ok
+# ----------
+
+if os.access(results+".xml", os.F_OK):
+ print("Ok: tepal")
+else:
+ print("KO: tepal")
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser()
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021 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
+#
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+import math
+
+global Box_1
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+geompy.addToStudy( Box_1, "Box_1" )
+
+smesh.UpdateStudy()
+from salome.StdMeshers import StdMeshersBuilder
+Mesh_1 = smesh.Mesh(Box_1)
+Regular_1D = Mesh_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Mesh_1.Quadrangle()
+Hexa_3D = Mesh_1.Hexahedron()
+isDone = Mesh_1.Compute()
+
+### CreateDimGroup()
+
+aListOf3d_1=list(range(721,821))
+
+aGrp3D_1=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 1" )
+aGrp3D_1.Add( aListOf3d_1 )
+
+aListOf3d_2=list(range(821, 921))
+aGrp3D_2=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 2" )
+aGrp3D_2.Add( aListOf3d_2 )
+
+aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.FACE, "Faces" )
+
+aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.EDGE, "Edges" )
+
+aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.NODE, "Nodes" )
+
+salome.sg.updateObjBrowser()
+
--- /dev/null
+# Copyright (C) 2015-2021 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 : smesh_selection.py
+# Author : Roman NIKOLAEV, OPEN CASCADE ( roman.nikolaev@opencascade.com )
+# Module : SMESH
+
+import salome
+salome.salome_init()
+
+import libSMESH_Swig
+sm_gui = libSMESH_Swig.SMESH_Swig()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New()
+
+import GEOM
+
+# swig -> idl
+_converter = {
+ libSMESH_Swig.EdgeOfCell : None, # TODO: check how to process it
+ libSMESH_Swig.Node : SMESH.NODE,
+ libSMESH_Swig.Edge : SMESH.EDGE,
+ libSMESH_Swig.Face : SMESH.FACE,
+ libSMESH_Swig.Volume : SMESH.VOLUME,
+ libSMESH_Swig.Elem0D : SMESH.ELEM0D,
+ libSMESH_Swig.Ball : SMESH.BALL,
+ libSMESH_Swig.Cell : SMESH.ALL
+}
+
+# Converts swig to idl enumeration
+def _swig2idl( type ):
+ if type in _converter :
+ return _converter[type]
+ return None
+
+def _getEntry(mesh):
+ if isinstance( mesh, smeshBuilder.Mesh ) :
+ return salome.ObjectToID( mesh.GetMesh() )
+ else :
+ if isinstance( mesh, str ) :
+ return mesh
+ return None
+
+def _getMesh(mesh):
+ if isinstance( mesh, smeshBuilder.Mesh ) :
+ return mesh.GetMesh()
+ else :
+ if isinstance( mesh, str ) :
+ return salome.IDToObject( mesh )
+ return None
+
+def _getGeom(geom):
+ if isinstance( geom, GEOM._objref_GEOM_Object ) :
+ return geom
+ else :
+ if isinstance( geom, str ) :
+ return salome.IDToObject( geom )
+ return None
+
+
+# Selects an elements lst on the mesh
+def select( mesh, lst, append = False ) :
+ # Check mesh parameter
+ entry = _getEntry(mesh)
+ if entry is None:
+ print("Wrong 'mesh' parameter")
+ return
+
+ # Check lst parameter
+ tmp = []
+ if isinstance( lst, int ) :
+ tmp.append( lst )
+ else :
+ if isinstance( lst,list ) :
+ tmp = lst
+ else :
+ print("Wrong 'lst' parameter")
+ return
+ sm_gui.select( entry, tmp, append )
+
+
+def _preProcess(mesh) :
+ m = _getMesh(mesh);
+ if m is None:
+ print("Wrong 'mesh' parameter")
+ return [None, None]
+
+ elemType = _swig2idl(sm_gui.getSelectionMode())
+ if elemType is None:
+ return [None, None]
+ return [m, elemType]
+
+
+
+# Selects an elements on the mesh inside the sphere with radius r and center (x, y, z)
+def selectInsideSphere( mesh, x, y, z, r, append = False ) :
+
+ [m, elemType] = _preProcess(mesh)
+ if m is None or elemType is None :
+ return
+
+ l = smesh.GetInsideSphere( m, elemType, x, y, z, r )
+ if len(l) > 0:
+ select(mesh, l, append)
+
+# Selects an elements on the mesh inside the box
+def selectInsideBox( mesh, x1, y1, z1, x2, y2, z2 , append = False ) :
+
+ [m, elemType] = _preProcess(mesh)
+ if m is None or elemType is None :
+ return
+
+ l = smesh.GetInsideBox( m, elemType, x1, y1, z1, x2, y2, z2 )
+ if len(l) > 0:
+ select(mesh, l, append)
+
+# Selects an elements on the mesh inside the cylinder
+def selectInsideCylinder( mesh, x, y, z, dx, dy, dz, h, r, append = False ) :
+
+ [m, elemType] = _preProcess(mesh)
+ if m is None or elemType is None :
+ return
+
+ l = smesh.GetInsideCylinder( m, elemType, x, y, z, dx, dy, dz, h, r )
+ if len(l) > 0:
+ select(mesh, l, append)
+
+# Selects an elements on the mesh inside the geometrical object
+def selectInside( mesh, geom, tolerance , append = False ):
+
+ [m, elemType] = _preProcess(mesh)
+ if m is None or elemType is None :
+ return
+
+ g = _getGeom(geom)
+
+ l = smesh.GetInside( m, elemType, g ,tolerance )
+ if len(l) > 0:
+ select(mesh, l, append)
test_polyhedron_per_solid.py
)
+set(SWIG_TESTS
+ ex01_cube2build.py
+ ex02_cube2primitive.py
+ ex03_cube2partition.py
+ ex04_cube5tetraHexa.py
+ ex05_hole1build.py
+ ex06_hole1boolean.py
+ ex07_hole1partition.py
+ ex08_hole2build.py
+ ex09_grid4build.py
+ ex10_grid4geometry.py
+ ex11_grid3partition.py
+ ex12_grid17partition.py
+ ex13_hole1partial.py
+ ex14_cyl1holed.py
+ ex15_cyl2geometry.py
+ ex16_cyl2complementary.py
+ ex17_dome1.py
+ ex18_dome2.py
+ ex19_sphereINcube.py
+ ex21_lamp.py
+ ex24_cylinder.py
+ ex29_refine.py
+ ex30_tepal.py
+ ex30_groupsOp.py
+ ex31_dimGroup.py
+ SMESH_test.py
+ SMESH_test0.py
+ SMESH_test1.py
+ SMESH_test1_AndDisplay.py
+ SMESH_test2.py
+ SMESH_test3.py
+ SMESH_test4.py
+ SMESH_test5.py
+ SMESH_mechanic.py
+ SMESH_mechanic_tetra.py
+ SMESH_mechanic_editor.py
+ SMESH_mechanic_netgen.py
+ SMESH_fixation.py
+ SMESH_fixation_hexa.py
+ SMESH_fixation_tetra.py
+ SMESH_fixation_netgen.py
+ SMESH_box_tetra.py
+ SMESH_box2_tetra.py
+ SMESH_box3_tetra.py
+ SMESH_flight_skin.py
+ SMESH_Partition1_tetra.py
+ SMESH_controls.py
+ SMESH_freebord.py
+ SMESH_blocks.py
+ SMESH_BelongToGeom.py
+ SMESH_GroupFromGeom2.py
+ SMESH_box.py
+ SMESH_demo_hexa2_upd.py
+ SMESH_hexaedre.py
+ SMESH_Sphere.py
+ SMESH_GroupFromGeom.py
+ 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
+ SMESH_reg.py
+ smesh_selection.py
+ YACS_geomesh0.py
+)
+
set(SESSION_FREE_TESTS
basic_geom_smesh_without_session.py
basic_shaper_smesh_without_session.py
doublenodes_polyhedra.py
)
-SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} ${SESSION_FREE_TESTS} testme.py)
+SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} ${SESSION_FREE_TESTS} ${SWIG_TESTS} testme.py)
)
# scripts / static
-SET(_bin_SCRIPTS
- ex00_all.py
- ex01_cube2build.py
- ex02_cube2primitive.py
- ex03_cube2partition.py
- ex04_cube5tetraHexa.py
- ex05_hole1build.py
- ex06_hole1boolean.py
- ex07_hole1partition.py
- ex08_hole2build.py
- ex09_grid4build.py
- ex10_grid4geometry.py
- ex11_grid3partition.py
- ex12_grid17partition.py
- ex13_hole1partial.py
- ex14_cyl1holed.py
- ex15_cyl2geometry.py
- ex16_cyl2complementary.py
- ex17_dome1.py
- ex18_dome2.py
- ex19_sphereINcube.py
- ex21_lamp.py
- ex24_cylinder.py
- ex29_refine.py
- ex30_tepal.py
- ex30_groupsOp.py
- ex31_dimGroup.py
- SMESH_test.py
- SMESH_test0.py
- SMESH_test1.py
- SMESH_test1_AndDisplay.py
- SMESH_test2.py
- SMESH_test3.py
- SMESH_test4.py
- SMESH_test5.py
- SMESH_mechanic.py
- SMESH_mechanic_tetra.py
- SMESH_mechanic_editor.py
- SMESH_mechanic_netgen.py
- SMESH_fixation.py
- SMESH_fixation_hexa.py
- SMESH_fixation_tetra.py
- SMESH_fixation_netgen.py
- SMESH_box_tetra.py
- SMESH_box2_tetra.py
- SMESH_box3_tetra.py
- SMESH_flight_skin.py
- SMESH_Partition1_tetra.py
- SMESH_controls.py
- SMESH_freebord.py
- SMESH_blocks.py
- SMESH_BelongToGeom.py
- SMESH_GroupFromGeom2.py
- SMESH_box.py
- SMESH_demo_hexa2_upd.py
- SMESH_hexaedre.py
- SMESH_Sphere.py
- SMESH_GroupFromGeom.py
- 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
- SMESH_reg.py
- smesh_selection.py
- YACS_geomesh0.py
-)
SET(smesh_SCRIPTS
smeshBuilder.py
SET_SOURCE_FILES_PROPERTIES(SMeshHelper.i PROPERTIES SWIG_FLAGS "-py3")
SET_SOURCE_FILES_PROPERTIES(SMeshHelper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/SMeshHelper.py )
-IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(SMeshHelper python ${SMeshHelper_SOURCES})
ELSE()
SWIG_ADD_LIBRARY(SMeshHelper LANGUAGE python SOURCES ${SMeshHelper_SOURCES})
SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_SMeshHelper_REAL_NAME}")
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS)
SALOME_INSTALL_SCRIPTS("${smesh_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/smesh DEF_PERMS)
SALOME_INSTALL_SCRIPTS("${StdMeshers_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/StdMeshers DEF_PERMS)
SALOME_INSTALL_SCRIPTS(SMESH_shared_modules.py ${SALOME_INSTALL_PYTHON}/shared_modules DEF_PERMS)
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-#-----------------------------GEOM----------------------------------------
-
-#----------Vertexes------------
-p1 = geompy.MakeVertex(20.0,30.0,40.0)
-p2 = geompy.MakeVertex(90.0,80.0,0.0)
-p3 = geompy.MakeVertex(30.0,80.0,200.0)
-
-#----------Edges---------------
-e1 = geompy.MakeEdge(p1,p2)
-e2 = geompy.MakeEdge(p2,p3)
-e3 = geompy.MakeEdge(p3,p1)
-
-#----------Wire----------------
-ListOfEdges = []
-ListOfEdges.append(e3)
-ListOfEdges.append(e2)
-ListOfEdges.append(e1)
-wire1 = geompy.MakeWire(ListOfEdges)
-
-
-#----------Face----------------
-WantPlanarFace = 1
-face1 = geompy.MakeFace(wire1,WantPlanarFace)
-
-Id_face1 = geompy.addToStudy(face1,"Face1")
-
-
-
-#-----------------------------SMESH-------------------------------------------
-
-# -- Init mesh --
-plane_mesh = salome.IDToObject( Id_face1)
-
-mesh = smesh.Mesh(plane_mesh, "Mesh_1")
-
-print("---------------------Hypothesis and Algorithms")
-
-#---------------- NumberOfSegments
-
-numberOfSegment = 9
-
-algoWireDes = mesh.Segment()
-listHyp = algoWireDes.GetCompatibleHypothesis()
-print(algoWireDes.GetName())
-algoWireDes.SetName("Ware descritisation")
-
-hypNbSeg = algoWireDes.NumberOfSegments(numberOfSegment)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "Nb. Segments")
-
-
-#--------------------------Max. Element Area
-maxElementArea = 200
-
-algoMef = mesh.Triangle()
-listHyp = algoMef.GetCompatibleHypothesis()
-print(algoMef.GetName())
-algoMef.SetName("Triangle (Mefisto)")
-
-hypArea200 = algoMef.MaxElementArea(maxElementArea)
-print(hypArea200.GetName())
-print(hypArea200.GetMaxElementArea())
-smesh.SetName(hypArea200, "Max. Element Area")
-
-
-print("---------------------Compute the mesh")
-
-ret = mesh.Compute()
-print(ret)
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_testExtrusion2D.py
-# Module : SMESH
-# Description : Create meshes to test extrusion of mesh elements along path
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-#----------------------------------GEOM
-
-# create points
-p1 = geompy.MakeVertex(100, 0, 0)
-p2 = geompy.MakeVertex(100, 0, 100)
-p3 = geompy.MakeVertex(0, 0, 0)
-p4 = geompy.MakeVertex(0, 100, 0)
-
-
-# create two vectors
-vector1 = geompy.MakeVector(p1,p2)
-vector2 = geompy.MakeVector(p3,p4)
-
-# make two ellipses
-ellipse1 = geompy.MakeEllipse(p1,vector1,50,25)
-ellipse2 = geompy.MakeEllipse(p3,vector2,300,50)
-
-# publish circular face and second circle
-id_ellipse1 = geompy.addToStudy(ellipse1, "Ellips 1")
-id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
-
-
-#---------------------------------SMESH
-
-# create the path mesh
-mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
-
-algoReg1 = mesh1.Segment()
-algoReg1.SetName("Regular_1D")
-hypNbSeg1 = algoReg1.NumberOfSegments(18)
-smesh.SetName(hypNbSeg1, "NumberOfSegments 1")
-
-# create the tool mesh
-mesh2 = smesh.Mesh(ellipse2, "Tool Mesh")
-algoReg2 = mesh2.Segment()
-algoReg2.SetName("Regular_1D")
-hypNbSeg2 = algoReg2.NumberOfSegments(34)
-smesh.SetName(hypNbSeg2, "NumberOfSegments 2")
-
-# compute meshes
-mesh1.Compute()
-mesh2.Compute()
-
-
-# ---- udate object browser
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_testExtrusion3D.py
-# Module : SMESH
-# Description : Create meshes to test extrusion of mesh elements along path
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-# create points to build two circles
-p1 = geompy.MakeVertex(0, 100, 0)
-p2 = geompy.MakeVertex(100, 0, 0)
-p3 = geompy.MakeVertex(0, -100, 0)
-p4 = geompy.MakeVertex(0, 70, 0)
-p5 = geompy.MakeVertex(0, 100, 30)
-p6 = geompy.MakeVertex(0, 130, 0)
-
-# create two circles
-circle = geompy.MakeCircleThreePnt(p1, p2, p3)
-cf = geompy.MakeCircleThreePnt(p4, p5, p6)
-
-# make circular face
-wire = geompy.MakeWire([cf])
-face = geompy.MakeFace(wire, 1)
-
-# publish circular face and second circle
-idcircle = geompy.addToStudy(circle, "Circle")
-idface = geompy.addToStudy(face, "Circular face")
-
-
-# init a Mesh with the circular face
-mesh1 = smesh.Mesh(face, "Mesh on circular face")
-
-# set hypotheses and algos to the first mesh
-numberOfSegments1 = 12
-algoReg1 = mesh1.Segment()
-algoReg1.SetName("Regular_1D")
-hypNbSeg1 = algoReg1.NumberOfSegments(numberOfSegments1)
-smesh.SetName(hypNbSeg1, "NumberOfSegments_" + str(numberOfSegments1))
-
-maxElementArea = 30
-
-algoMef = mesh1.Triangle()
-algoMef.SetName("MEFISTO_2D")
-hypArea = algoMef.MaxElementArea(maxElementArea)
-smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-
-# init a Mesh with the second circle
-mesh2 = smesh.Mesh(circle, "Mesh on circular edge")
-
-numberOfSegments2 = 12
-algoReg2 = mesh2.Segment()
-algoReg2.SetName("Regular_1D")
-hypNbSeg2 = algoReg2.NumberOfSegments(numberOfSegments2)
-smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2))
-
-
-# compute meshes
-mesh1.Compute()
-mesh2.Compute()
-
-# ---- update object browser
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-def GetNewNodes(mesh,Elems,OldNodes):
- """
- Auxiliary function, which return list of nodes from
- given Elems avoided nodes from OldNodes
- """
- newnodes = []
- for i in Elems:
- nbn = mesh.GetElemNbNodes(i)
- for j in range(0,nbn):
- nn = mesh.GetElemNode(i,j)
- isold = 0
- for k in range(0,len(newnodes)):
- if nn==newnodes[k]:
- isold = 1
- break
- pass
- if isold: continue
- for k in range(0,len(OldNodes)):
- if nn==OldNodes[k]:
- isold = 1
- break
- pass
- if isold: continue
- newnodes.append(nn)
- pass
- pass
- return newnodes
-
-
-# create empty mesh
-mesh = smesh.Mesh()
-
-tol = 0.001
-
-# create a cross from quadrangle faces
-# 1. create first edge and make extrusion along 0x
-n1 = mesh.AddNode(55,-5,0)
-n2 = mesh.AddNode(55,5,0)
-e1 = mesh.AddEdge([n1,n2])
-dir1 = SMESH.DirStruct(SMESH.PointStruct(-10,0,0))
-mesh.ExtrusionSweep([e1],dir1,11)
-# 2. create second edge and make extrusion along 0y
-n3 = mesh.AddNode(-5,-55,0)
-n4 = mesh.AddNode(5,-55,0)
-e2 = mesh.AddEdge([n3,n4])
-dir2 = SMESH.DirStruct(SMESH.PointStruct(0,10,0))
-mesh.ExtrusionSweep([e2],dir2,11)
-
-# since result has coincident nodes and faces
-# we have to make merge
-nodes = mesh.FindCoincidentNodes(0.001)
-mesh.MergeNodes(nodes)
-mesh.MergeEqualElements()
-
-# make extrusion faces along 0z
-faces = mesh.GetElementsByType(SMESH.FACE)
-nbf = len(faces)
-maxang = 2.0
-zstep = 5
-nbzsteps = 50
-dir3 = SMESH.DirStruct(SMESH.PointStruct(0,0,zstep))
-newfaces = [] # list for keeping created top faces
- # during extrusion
-
-for i in range(0,nbzsteps):
- mesh.ExtrusionSweep(faces,dir3,1)
- # find top faces after each extrusion and keep them
- res = mesh.GetLastCreatedElems()
- nbr = len(res)
- nfaces = []
- for j in res:
- nbn = mesh.GetElemNbNodes(j)
- if nbn!=4: continue
- nn1 = mesh.GetElemNode(j,0)
- xyz1 = mesh.GetNodeXYZ(nn1)
- nn2 = mesh.GetElemNode(j,1)
- xyz2 = mesh.GetNodeXYZ(nn2)
- nn3 = mesh.GetElemNode(j,2)
- xyz3 = mesh.GetNodeXYZ(nn3)
- if abs(xyz1[2]-xyz2[2])<tol and abs(xyz1[2]-xyz3[2])<tol :
- # this face is a top face
- nfaces.append(j)
- pass
- pass
- if len(nfaces)!=nbf:
- print("len(nfaces)!=nbf")
- break
- newfaces.append(nfaces)
- # update faces for before next step of extrusion
- faces = nfaces
- pass
-
-# rotate faces from newfaces
-axisr1 = SMESH.AxisStruct(0,0,0,0,0,1)
-for i in range(0,nbzsteps):
- ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps))
- mesh.Rotate(newfaces[i],axisr1,ang,0)
-
-
-# create circles
-# create two edges and rotate them for creation
-# full circle
-n5 = mesh.AddNode(65,0,0)
-n6 = mesh.AddNode(67.5,0,0)
-n7 = mesh.AddNode(70,0,0)
-e56 = mesh.AddEdge([n5,n6])
-e67 = mesh.AddEdge([n6,n7])
-axisr2 = SMESH.AxisStruct(65,0,0,0,1,0)
-mesh.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol)
-res = mesh.GetLastCreatedElems()
-faces1 = []
-for i in res:
- nbn = mesh.GetElemNbNodes(i)
- if nbn>2: faces1.append(i)
- pass
-nbf1 = len(faces1)
-
-# create other two edges and rotate them for creation
-# other full circle
-n8 = mesh.AddNode(-65,0,0)
-n9 = mesh.AddNode(-67.5,0,0)
-n10 = mesh.AddNode(-70,0,0)
-e8 = mesh.AddEdge([n8,n9])
-e9 = mesh.AddEdge([n9,n10])
-axisr3 = SMESH.AxisStruct(-65,0,0,0,-1,0)
-mesh.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol)
-res = mesh.GetLastCreatedElems()
-faces2 = []
-for i in res:
- nbn = mesh.GetElemNbNodes(i)
- if nbn>2: faces2.append(i)
- pass
-nbf2 = len(faces2)
-
-# there are coincident nodes after rotation
-# therefore we have to merge nodes
-nodes = mesh.FindCoincidentNodes(0.001)
-mesh.MergeNodes(nodes)
-
-nbcircs = 2
-nbrsteps = 24
-nbrs = nbcircs*nbrsteps
-dz = nbzsteps*zstep/nbrs
-
-# create first spiral
-oldnodes = []
-newnodes = GetNewNodes(mesh,faces1,oldnodes)
-oldnodes = newnodes
-
-nodes = []
-mesh.RotationSweep(faces1,axisr1, math.pi*2/nbrsteps, nbrs, tol)
-res = mesh.GetLastCreatedElems()
-
-for i in range(0,nbrs):
- volumes = []
- for j in range(0,nbf1): volumes.append(res[i+j*nbrs])
- newnodes = GetNewNodes(mesh,volumes,oldnodes)
- for j in newnodes:
- xyz = mesh.GetNodeXYZ(j)
- mesh.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1))
- pass
- oldnodes = newnodes
- pass
-
-# create second spiral
-oldnodes = []
-newnodes = GetNewNodes(mesh,faces2,oldnodes)
-oldnodes = newnodes
-
-nodes = []
-mesh.RotationSweep(faces2,axisr1, math.pi*2/nbrsteps, nbrs, tol)
-res = mesh.GetLastCreatedElems()
-
-for i in range(0,nbrs):
- volumes = []
- for j in range(0,nbf2): volumes.append(res[i+j*nbrs])
- newnodes = GetNewNodes(mesh,volumes,oldnodes)
- for j in newnodes:
- xyz = mesh.GetNodeXYZ(j)
- mesh.MoveNode(j,xyz[0],xyz[1],xyz[2]+dz*(i+1))
- pass
- oldnodes = newnodes
- pass
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-from SMESH_test1 import *
-
-## Old style
-def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType):
- if theShape != theSubShape:
- aName = str(theSubShape)
- geompy.addToStudyInFather(theShape,theSubShape,aName)
-
- theMeshGen.Compute(theMesh,theShape)
-
- aFilterMgr = theMeshGen.CreateFilterManager()
- aFilter = aFilterMgr.CreateFilter()
-
- aBelongToGeom = aFilterMgr.CreateBelongToGeom()
- aBelongToGeom.SetGeom(theSubShape)
- aBelongToGeom.SetElementType(theElemType)
-
- aFilter.SetPredicate(aBelongToGeom)
- aFilterMgr.UnRegister()
- return aFilter.GetElementsId(theMesh)
-
-## Current style
-def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType):
- if theShape != theSubShape:
- aName = str(theSubShape)
- geompy.addToStudyInFather(theShape,theSubShape,aName)
-
- theMesh.Compute()
- aFilter = smesh.GetFilter(theElemType, SMESH.FT_BelongToGeom, theSubShape)
- return aFilter.GetElementsId(theMesh.GetMesh())
-
-
-anElemType = SMESH.FACE;
-print("anElemType =", anElemType)
-#anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType)
-anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType)
-print("Number of ids = ", len(anIds))
-print("anIds = ", anIds)
-## Check old version
-#anIds = CheckBelongToGeomFilterOld(smesh,mesh.GetMesh(),box,box,anElemType)
-#print "anIds = ", anIds
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 : 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-## 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.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.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
-smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
-#end
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_GroupFromGeom.py
-# Module : SMESH
-#
-from SMESH_test1 import *
-
-# Compute the mesh created in SMESH_test1
-
-mesh.Compute()
-
-# Create geometry groups on plane:
-aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"])
-geompy.AddObject(aGeomGroup1, 1)
-
-aGeomGroup2 = geompy.CreateGroup(face , geompy.ShapeType["EDGE"])
-
-geompy.AddObject(aGeomGroup2, 3)
-geompy.AddObject(aGeomGroup2, 6)
-geompy.AddObject(aGeomGroup2, 8)
-geompy.AddObject(aGeomGroup2, 10)
-
-geompy.addToStudy(aGeomGroup1, "Group on Faces")
-geompy.addToStudy(aGeomGroup2, "Group on Edges")
-
-aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
-aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-#==============================================================================
-# Info.
-# Bug (from script, bug) : SMESH_GroupFromGeom.py, PAL6945
-# Modified : 25/11/2004
-# Author : Kovaltchuk Alexey
-# Project : PAL/SALOME
-#==============================================================================
-#
-from SMESH_test1 import *
-
-
-# Compute the mesh created in SMESH_test1
-
-mesh.Compute()
-
-# Create geometry groups on plane:
-aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"])
-geompy.AddObject(aGeomGroup1, 1)
-
-aGeomGroup2 = geompy.CreateGroup(face , geompy.ShapeType["EDGE"])
-
-geompy.AddObject(aGeomGroup2, 3)
-geompy.AddObject(aGeomGroup2, 6)
-geompy.AddObject(aGeomGroup2, 8)
-geompy.AddObject(aGeomGroup2, 10)
-
-geompy.addToStudy(aGeomGroup1, "Group on Faces")
-geompy.addToStudy(aGeomGroup2, "Group on Edges")
-
-aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
-aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
-
-print("Create aGroupOnShell - a group linked to a shell")
-aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", SMESH.EDGE)
-print("aGroupOnShell type =", aGroupOnShell.GetType())
-print("aGroupOnShell size =", aGroupOnShell.Size())
-print("aGroupOnShell ids :", aGroupOnShell.GetListOfID())
-
-print(" ")
-
-print("Modify <LocalLength> hypothesis: 100 -> 50")
-hypLen1.SetLength(50)
-print("Contents of aGroupOnShell changes:")
-print("aGroupOnShell size =", aGroupOnShell.Size())
-print("aGroupOnShell ids :", aGroupOnShell.GetListOfID())
-
-print(" ")
-
-print("Re-compute mesh, contents of aGroupOnShell changes again:")
-mesh.Compute()
-print("aGroupOnShell size =", aGroupOnShell.Size())
-print("aGroupOnShell ids :", aGroupOnShell.GetListOfID())
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
- aFilterMgr = smesh.CreateFilterManager()
- aFilter = aFilterMgr.CreateFilter()
-
- aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
- aLyingOnGeom.SetGeom(theShape)
- aLyingOnGeom.SetElementType(theElemType)
-
- aFilter.SetPredicate(aLyingOnGeom)
- anIds = aFilter.GetElementsId(theMesh)
- aFilterMgr.UnRegister()
-
- aGroup = theMesh.CreateGroup(theElemType, theName)
- aGroup.Add(anIds)
-
-#Example
-from SMESH_test1 import *
-
-mesh.Compute()
-
-# First way
-BuildGroupLyingOn(mesh.GetMesh(), SMESH.FACE, "Group of faces lying on edge #1", edge )
-
-# Second way
-mesh.MakeGroup("Group of faces lying on edge #2", SMESH.FACE, SMESH.FT_LyingOnGeom, edge)
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-#####################################################################
-#Created :17/02/2005
-#Author :MASLOV Eugeny, KOVALTCHUK Alexey
-#####################################################################
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import os
-import math
-
-#Sketcher_1 creation
-print("Sketcher creation...")
-Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW")
-geompy.addToStudy(Sketcher_1, "Sketcher_1")
-Face_1 = geompy.MakeFace(Sketcher_1, 1)
-geompy.addToStudy(Face_1, "Face_1")
-
-#Line creation
-print("Line creation...")
-Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100))
-geompy.addToStudy(Line_1, "Line_1")
-
-#Prism creation
-print("Prism creation...")
-Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100)
-geompy.addToStudy(Prism_1, "Prism_1")
-
-#Sketcher_2 creation
-print("Sketcher creation...")
-Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0])
-geompy.addToStudy(Sketcher_2, "Sketcher_2")
-Face_2 = geompy.MakeFace(Sketcher_2, 1)
-geompy.addToStudy(Face_2, "Face_2")
-
-#Revolution creation
-print("Revolution creation...")
-Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi)
-geompy.addToStudy(Revolution_1, "Revolution_1")
-
-#Common applying
-print("Common of Revolution and Prism...")
-Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1)
-geompy.addToStudy(Common_1, "Common_1")
-
-#Explode Common_1 on edges
-CommonExplodedListEdges = geompy.SubShapeAll(Common_1, geompy.ShapeType["EDGE"])
-for i in range(0, len(CommonExplodedListEdges)):
- name = "Edge_"+str(i+1)
- geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name)
-
-#Fillet applying
-print("Fillet creation...")
-Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [5])
-geompy.addToStudy(Fillet_1, "Fillet_1")
-
-#Chamfer applying
-print("Chamfer creation...")
-cyl_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 50, 0, 45 ), theName='cyl_face')
-cyl_face_id = geompy.GetSubShapeID( Fillet_1, cyl_face )
-top_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 60, 0, 90 ), theName='top_face')
-top_face_id = geompy.GetSubShapeID( Fillet_1, top_face )
-Chamfer_1 = geompy.MakeChamferEdge(Fillet_1, 10, 10, cyl_face_id, top_face_id, theName='Chamfer_1' )
-
-cyl_face = geompy.GetFaceNearPoint( Chamfer_1, geompy.MakeVertex( 80, 0, 85 ), theName='cyl_face')
-cyl_face_id = geompy.GetSubShapeID( Chamfer_1, cyl_face )
-top_face = geompy.GetFaceNearPoint( Chamfer_1, geompy.MakeVertex( 65, 0, 90 ), theName='top_face')
-top_face_id = geompy.GetSubShapeID( Chamfer_1, top_face )
-Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, cyl_face_id, top_face_id, theName='Chamfer_2' )
-
-#Import of the shape from "slots.brep"
-print("Import multi-rotation from the DATA_DIR/Shapes/Brep/slots.brep")
-thePath = os.getenv("DATA_DIR")
-theFileName = os.path.join( thePath,"Shapes","Brep","slots.brep")
-theShapeForCut = geompy.ImportBREP(theFileName)
-geompy.addToStudy(theShapeForCut, "slot.brep_1")
-
-#Cut applying
-print("Cut...")
-Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2)
-Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1")
-
-#Mesh creation
-
-# -- Init --
-shape_mesh = salome.IDToObject( Cut_1_ID )
-
-mesh = smesh.Mesh(shape_mesh, "Nut")
-
-#HYPOTHESIS CREATION
-print("-------------------------- Average length")
-theAverageLength = 5
-algoReg1D = mesh.Segment()
-hAvLength = algoReg1D.LocalLength(theAverageLength)
-print(hAvLength.GetName())
-print(hAvLength.GetId())
-print(hAvLength.GetLength())
-smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength))
-
-print("-------------------------- MaxElementArea")
-theMaxElementArea = 20
-algoMef = mesh.Triangle(smeshBuilder.MEFISTO)
-hArea = algoMef.MaxElementArea( theMaxElementArea )
-print(hArea.GetName())
-print(hArea.GetId())
-print(hArea.GetMaxElementArea())
-smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea))
-
-print("-------------------------- MaxElementVolume")
-theMaxElementVolume = 150
-algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN)
-hVolume = algoNg.MaxElementVolume( theMaxElementVolume )
-print(hVolume.GetName())
-print(hVolume.GetId())
-print(hVolume.GetMaxElementVolume())
-smesh.SetName(hVolume, "MaxElementVolume_"+str(theMaxElementVolume))
-
-
-print("-------------------------- compute the mesh of the mechanic piece")
-mesh.Compute()
-
-print("Information about the Nut:")
-print("Number of nodes : ", mesh.NbNodes())
-print("Number of edges : ", mesh.NbEdges())
-print("Number of faces : ", mesh.NbFaces())
-print("Number of triangles : ", mesh.NbTriangles())
-print("Number of quadrangles : ", mesh.NbQuadrangles())
-print("Number of volumes : ", mesh.NbVolumes())
-print("Number of tetrahedrons: ", mesh.NbTetras())
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Tetrahedrization of the geometry generated by the Python script GEOM_Partition1.py
-# Hypothesis and algorithms for the mesh generation are global
-# -- Rayon de la bariere
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-from math import sqrt
-
-
-#---------------------------------------------------------------
-
-barier_height = 7.0
-barier_radius = 5.6 / 2 # Rayon de la bariere
-colis_radius = 1.0 / 2 # Rayon du colis
-colis_step = 2.0 # Distance s�parant deux colis
-cc_width = 0.11 # Epaisseur du complement de colisage
-
-# --
-
-cc_radius = colis_radius + cc_width
-colis_center = sqrt(2.0)*colis_step/2
-
-# --
-
-boolean_common = 1
-boolean_cut = 2
-boolean_fuse = 3
-boolean_section = 4
-
-# --
-
-p0 = geompy.MakeVertex(0.,0.,0.)
-vz = geompy.MakeVectorDXDYDZ(0.,0.,1.)
-
-# --
-
-barier = geompy.MakeCylinder(p0, vz, barier_radius, barier_height)
-
-# --
-
-colis = geompy.MakeCylinder(p0, vz, colis_radius, barier_height)
-cc = geompy.MakeCylinder(p0, vz, cc_radius, barier_height)
-
-colis_cc = geompy.MakeCompound([colis, cc])
-colis_cc = geompy.MakeTranslation(colis_cc, colis_center, 0.0, 0.0)
-
-colis_cc_multi = geompy.MultiRotate1D(colis_cc, vz, 4)
-
-# --
-
-Compound1 = geompy.MakeCompound([colis_cc_multi, barier])
-SubShape_theShape = geompy.SubShapeAll(Compound1,geompy.ShapeType["SOLID"])
-alveole = geompy.MakePartition(SubShape_theShape)
-
-print("Analysis of the geometry to mesh (right after the Partition) :")
-
-subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"])
-
-print("number of Shells in alveole : ", len(subShellList))
-print("number of Faces in alveole : ", len(subFaceList))
-print("number of Edges in alveole : ", len(subEdgeList))
-
-subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"])
-
-## there are 9 sub-shapes
-
-comp1 = geompy.MakeCompound( [ subshapes[0], subshapes[1] ] )
-comp2 = geompy.MakeCompound( [ subshapes[2], subshapes[3] ] )
-comp3 = geompy.MakeCompound( [ subshapes[4], subshapes[5] ] )
-comp4 = geompy.MakeCompound( [ subshapes[6], subshapes[7] ] )
-
-compGOs = []
-compGOs.append( comp1 )
-compGOs.append( comp2 )
-compGOs.append( comp3 )
-compGOs.append( comp4 )
-comp = geompy.MakeCompound( compGOs )
-
-alveole = geompy.MakeCompound( [ comp, subshapes[8] ])
-
-idalveole = geompy.addToStudy(alveole, "alveole")
-
-print("Analysis of the geometry to mesh (right after the MakeCompound) :")
-
-subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"])
-
-print("number of Shells in alveole : ", len(subShellList))
-print("number of Faces in alveole : ", len(subFaceList))
-print("number of Edges in alveole : ", len(subEdgeList))
-
-status = geompy.CheckShape(alveole)
-print(" check status ", status)
-
-
-# ---- init a Mesh with the alveole
-shape_mesh = salome.IDToObject( idalveole )
-
-mesh = smesh.Mesh(shape_mesh, "MeshAlveole")
-
-print("-------------------------- create Hypothesis (In this case global hypothesis are used)")
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegments = 10
-
-regular1D = mesh.Segment()
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
-
-print("-------------------------- MaxElementArea")
-
-maxElementArea = 0.1
-
-mefisto2D = mesh.Triangle()
-hypArea = mefisto2D.MaxElementArea(maxElementArea)
-print(hypArea.GetName())
-print(hypArea.GetId())
-print(hypArea.GetMaxElementArea())
-smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-print("-------------------------- MaxElementVolume")
-
-maxElementVolume = 0.5
-
-netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
-hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
-print(hypVolume.GetName())
-print(hypVolume.GetId())
-print(hypVolume.GetMaxElementVolume())
-smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
-
-print("-------------------------- compute the mesh of alveole ")
-ret = mesh.Compute()
-
-if ret != 0:
- log=mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the Mesh_mechanic:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons: ", mesh.NbTetras())
-else:
- print("problem when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# GEOM GEOM_SWIG : binding of C++ implementation with Python
-# File : GEOM_Sphere.py
-# Author : Damien COQUERET, Open CASCADE
-# Module : GEOM
-# $Header:
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-# It is an example of creating a hexahedrical mesh on a sphere.
-#
-# Used approach allows to avoid problems with degenerated and
-# seam edges without special processing of geometrical shapes
-
-#-----------------------------------------------------------------------
-#Variables
-Radius = 100.
-Dist = Radius / 2.
-Factor = 2.5
-Angle90 = math.pi / 2.
-NbSeg = 10
-
-PointsList = []
-ShapesList = []
-
-#Basic Elements
-P0 = geompy.MakeVertex(0., 0., 0.)
-P1 = geompy.MakeVertex(-Dist, -Dist, -Dist)
-P2 = geompy.MakeVertex(-Dist, -Dist, Dist)
-P3 = geompy.MakeVertex(-Dist, Dist, Dist)
-P4 = geompy.MakeVertex(-Dist, Dist, -Dist)
-
-VZ = geompy.MakeVectorDXDYDZ(0., 0., 1.)
-
-#Construction Elements
-PointsList.append(P1)
-PointsList.append(P2)
-PointsList.append(P3)
-PointsList.append(P4)
-PointsList.append(P1)
-
-PolyLine = geompy.MakePolyline(PointsList)
-
-Face1 = geompy.MakeFace(PolyLine, 1)
-Face2 = geompy.MakeScaleTransform(Face1, P0, Factor)
-Face3 = geompy.MakeScaleTransform(Face1, P0, -1.)
-
-#Models
-Sphere = geompy.MakeSphereR(Radius)
-
-Block = geompy.MakeHexa2Faces(Face1, Face2)
-Cube = geompy.MakeHexa2Faces(Face1, Face3)
-
-Common1 = geompy.MakeBoolean(Sphere, Block, 1)
-Common2 = geompy.MakeRotation(Common1, VZ, Angle90)
-
-MultiBlock1 = geompy.MakeMultiTransformation1D(Common1, 20, -1, 3)
-MultiBlock2 = geompy.MakeMultiTransformation1D(Common2, 30, -1, 3)
-
-#Reconstruct sphere from several blocks
-ShapesList.append(Cube)
-ShapesList.append(MultiBlock1)
-ShapesList.append(MultiBlock2)
-Compound = geompy.MakeCompound(ShapesList)
-
-Result = geompy.MakeGlueFaces(Compound, 0.1)
-
-#addToStudy
-Id_Sphere = geompy.addToStudy(Sphere, "Sphere")
-Id_Cube = geompy.addToStudy(Cube, "Cube")
-
-Id_Common1 = geompy.addToStudy(Common1, "Common1")
-Id_Common2 = geompy.addToStudy(Common2, "Common2")
-
-Id_MultiBlock1 = geompy.addToStudy(MultiBlock1, "MultiBlock1")
-Id_MultiBlock2 = geompy.addToStudy(MultiBlock2, "MultiBlock2")
-
-Id_Result = geompy.addToStudy(Result, "Result")
-
-#-----------------------------------------------------------------------
-#Meshing
-my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
-algo = my_hexa.Segment()
-algo.NumberOfSegments(NbSeg)
-my_hexa.Quadrangle()
-my_hexa.Hexahedron()
-my_hexa.Compute()
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# SMESH SMESH_SWIG : binding of C++ implementation with Python
-# File : SMESH_blocks.py
-# Author : Julia DOROVSKIKH
-# Module : SMESH
-# $Header$
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-import GEOM_Spanner
-
-isBlocksTest = 0 # False
-isMeshTest = 1 # True
-
-GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh)
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-#==============================================================================
-# Info.
-# Bug (from script, bug) : box.py, PAL5223
-# Modified : 25/11/2004
-# Author : Kovaltchuk Alexey
-# Project : PAL/SALOME
-#==============================================================================
-# Salome geometry and meshing for a box
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-from salome import sg
-
-# Plate
-
-box = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
-boxId = geompy.addToStudy(box,"box")
-
-# ---- SMESH
-
-# ---- init a Mesh
-
-box_mesh=smesh.Mesh(box, "box_mesh")
-
-# set Hypothesis and Algorithm
-
-alg1D = box_mesh.Segment()
-alg1D.SetName("algo1D")
-hypL1 = alg1D.LocalLength(0.25)
-smesh.SetName(hypL1, "LocalLength")
-
-alg2D = box_mesh.Quadrangle()
-alg2D.SetName("algo2D")
-
-alg3D = box_mesh.Hexahedron()
-alg3D.SetName("algo3D")
-
-# compute mesh
-
-box_mesh.Compute()
-
-sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Tetrahedrization of the geometry union of 2 boxes having a face in common
-# Hypothesis and algorithms for the mesh generation are global
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-# ---- define 2 boxes box1 and box2
-
-box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-
-idbox1 = geompy.addToStudy(box1, "box1")
-
-print("Analysis of the geometry box1 :")
-subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
-
-print("number of Shells in box1 : ", len(subShellList))
-print("number of Faces in box1 : ", len(subFaceList))
-print("number of Edges in box1 : ", len(subEdgeList))
-
-box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
-
-idbox2 = geompy.addToStudy(box2, "box2")
-
-print("Analysis of the geometry box2 :")
-subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
-
-print("number of Shells in box2 : ", len(subShellList))
-print("number of Faces in box2 : ", len(subFaceList))
-print("number of Edges in box2 : ", len(subEdgeList))
-
-# append the tow boxes to make ine shel, referrencing only once
-# the internal interface
-
-shell = geompy.MakePartition([box1, box2])
-idshell = geompy.addToStudy(shell, "shell")
-
-print("Analysis of the geometry shell (union of box1 and box2) :")
-subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
-
-print("number of Shells in shell : ", len(subShellList))
-print("number of Faces in shell : ", len(subFaceList))
-print("number of Edges in shell : ", len(subEdgeList))
-
-
-### ---------------------------- SMESH --------------------------------------
-
-# ---- init a Mesh with the shell
-
-mesh = smesh.Mesh(shell, "MeshBox2")
-
-
-# ---- set Hypothesis and Algorithm
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegments = 10
-
-regular1D = mesh.Segment()
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
-
-print("-------------------------- MaxElementArea")
-
-maxElementArea = 500
-
-mefisto2D = mesh.Triangle()
-hypArea = mefisto2D.MaxElementArea(maxElementArea)
-print(hypArea.GetName())
-print(hypArea.GetId())
-print(hypArea.GetMaxElementArea())
-smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-print("-------------------------- MaxElementVolume")
-
-maxElementVolume = 500
-
-netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
-hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
-print(hypVolume.GetName())
-print(hypVolume.GetId())
-print(hypVolume.GetMaxElementVolume())
-smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
-
-print("-------------------------- compute shell")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- log = mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the MeshBox2:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons: ", mesh.NbTetras())
-else:
- print("probleme when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Tetrahedrization of the geometry union of 3 boxes aligned where the middle
-# one has a race in common with the two others.
-# Hypothesis and algorithms for the mesh generation are global
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---- define 3 boxes box1, box2 and box3
-
-box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-
-idbox1 = geompy.addToStudy(box1, "box1")
-
-print("Analysis of the geometry box1 :")
-subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
-
-print("number of Shells in box1 : ", len(subShellList))
-print("number of Faces in box1 : ", len(subFaceList))
-print("number of Edges in box1 : ", len(subEdgeList))
-
-box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
-
-idbox2 = geompy.addToStudy(box2, "box2")
-
-print("Analysis of the geometry box2 :")
-subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
-
-print("number of Shells in box2 : ", len(subShellList))
-print("number of Faces in box2 : ", len(subFaceList))
-print("number of Edges in box2 : ", len(subEdgeList))
-
-box3 = geompy.MakeBox(0., 0., 300., 200., 200., 500.)
-
-idbox3 = geompy.addToStudy(box3, "box3")
-
-print("Analysis of the geometry box3 :")
-subShellList = geompy.SubShapeAll(box3, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(box3, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(box3, geompy.ShapeType["EDGE"])
-
-print("number of Shells in box3 : ", len(subShellList))
-print("number of Faces in box3 : ", len(subFaceList))
-print("number of Edges in box3 : ", len(subEdgeList))
-
-shell = geompy.MakePartition([box1, box2, box3])
-idshell = geompy.addToStudy(shell,"shell")
-
-print("Analysis of the geometry shell (union of box1, box2 and box3) :")
-subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
-
-print("number of Shells in shell : ", len(subShellList))
-print("number of Faces in shell : ", len(subFaceList))
-print("number of Edges in shell : ", len(subEdgeList))
-
-
-### ---------------------------- SMESH --------------------------------------
-
-# ---- init a Mesh with the shell
-
-mesh = smesh.Mesh(shell, "MeshBox3")
-
-
-# ---- set Hypothesis and Algorithm
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegments = 10
-
-regular1D = mesh.Segment()
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
-
-print("-------------------------- MaxElementArea")
-
-maxElementArea = 500
-
-mefisto2D = mesh.Triangle()
-hypArea = mefisto2D.MaxElementArea(maxElementArea)
-print(hypArea.GetName())
-print(hypArea.GetId())
-print(hypArea.GetMaxElementArea())
-smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-print("-------------------------- MaxElementVolume")
-
-maxElementVolume = 500
-
-netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
-hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
-print(hypVolume.GetName())
-print(hypVolume.GetId())
-print(hypVolume.GetMaxElementVolume())
-smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
-
-print("-------------------------- compute shell")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- log = mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the MeshBox3:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons: ", mesh.NbTetras())
-else:
- print("probleme when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Tetrahedrization of a simple box. Hypothesis and algorithms for
-# the mesh generation are global
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-
-idbox = geompy.addToStudy(box, "box")
-
-print("Analysis of the geometry box :")
-subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
-
-print("number of Shells in box : ", len(subShellList))
-print("number of Faces in box : ", len(subFaceList))
-print("number of Edges in box : ", len(subEdgeList))
-
-
-### ---------------------------- SMESH --------------------------------------
-
-# ---- init a Mesh with the box
-
-mesh = smesh.Mesh(box, "MeshBox")
-
-# ---- set Hypothesis and Algorithm
-
-print("-------------------------- NumberOfSegments")
-numberOfSegments = 10
-
-regular1D = mesh.Segment()
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
-
-print("-------------------------- MaxElementArea")
-
-maxElementArea = 500
-
-mefisto2D = mesh.Triangle()
-hypArea = mefisto2D.MaxElementArea(maxElementArea)
-print(hypArea.GetName())
-print(hypArea.GetId())
-print(hypArea.GetMaxElementArea())
-smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-print("-------------------------- MaxElementVolume")
-
-maxElementVolume = 500
-
-netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
-hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
-print(hypVolume.GetName())
-print(hypVolume.GetId())
-print(hypVolume.GetMaxElementVolume())
-smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
-
-print("-------------------------- compute the mesh of the box")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- log = mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the MeshBox:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons: ", mesh.NbTetras())
-else:
- print("probleme when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_control.py
-# Author : Sergey LITONIN
-# Module : SMESH
-#
-import salome
-import SMESH_mechanic
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-mesh = SMESH_mechanic.mesh
-
-# ---- Criterion : AREA > 100
-
-# create group
-aGroup = mesh.MakeGroup("Area > 100", SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100)
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Area > 100 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# ---- Criterion : Taper > 3e-15
-
-# create group
-aGroup = mesh.MakeGroup("Taper > 3e-15", SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, 3e-15)
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Taper > 3e-15 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# ---- Criterion : ASPECT RATIO > 1.3
-
-# create group
-aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.3)
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# ---- Criterion : MINIMUM ANGLE < 30
-
-# create group
-aGroup = mesh.MakeGroup("Minimum Angle < 30", SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, 30)
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Minimum Angle < 30 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# ---- Criterion : Warp > 2e-13
-
-# create group
-aGroup = mesh.MakeGroup("Warp > 2e-13", SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, 2e-13 )
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Warp > 2e-13 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# ---- Criterion : Skew > 18
-
-# create group
-aGroup = mesh.MakeGroup("Skew > 18", SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 18 )
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Skew > 18 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# Criterion : Length > 10
-
-# create group
-aGroup = mesh.MakeGroup("Length > 10", SMESH.FACE, SMESH.FT_Length, SMESH.FT_MoreThan, 10 )
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Length > 10 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# Criterion : Borders at multi-connections = 2
-
-# create group
-aGroup = mesh.MakeGroup("Borders at multi-connections = 2", SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, 2)
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Borders at multi-connections = 2 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-# Criterion : Element Diameter 2D > 10
-
-# create group
-aGroup = mesh.MakeGroup("Element Diameter 2D > 10", SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10 )
-
-# print result
-anIds = aGroup.GetIDs()
-print("Criterion: Element Diameter 2D > 10 Nb = ", len( anIds ))
-#for i in range( len( anIds ) ):
- #print anIds[ i ]
-
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-#==============================================================================
-# Info.
-# Bug (from script, bug) : SMESH_demo_hexa2_upd.py, PAL6781
-# Modified : 25/11/2004
-# Author : Kovaltchuk Alexey
-# Project : PAL/SALOME
-#==============================================================================
-# Tetrahedrization of a geometry (box minus a inner cylinder).
-# Hypothesis and algorithms for the mesh generation are not global:
-# the mesh of some edges is thinner
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-
-# -----------------------------------------------------------------------------
-
-ShapeTypeShell = 3
-ShapeTypeFace = 4
-ShapeTypeEdge = 6
-
-a = math.sqrt(2.)/4.
-ma = - a
-zero = 0.
-un = 1.
-mun= - un
-demi = 1./2.
-
-Orig = geompy.MakeVertex(zero,zero,zero)
-P0 = geompy.MakeVertex(a,a,zero)
-P1 = geompy.MakeVertex(zero,demi,zero)
-P2 = geompy.MakeVertex(ma,a,zero)
-P3 = geompy.MakeVertex(mun,un,zero)
-P4 = geompy.MakeVertex(un,un,zero)
-P5 = geompy.MakeVertex(zero,zero,un)
-
-arc = geompy.MakeArc(P0,P1,P2)
-e1 = geompy.MakeEdge(P2,P3)
-e2 = geompy.MakeEdge(P3,P4)
-e3 = geompy.MakeEdge(P4,P0)
-
-list = []
-list.append(arc)
-list.append(e1)
-list.append(e2)
-list.append(e3)
-
-wire = geompy.MakeWire(list)
-face = geompy.MakeFace(wire,1)
-
-dir = geompy.MakeVector(Orig,P5)
-vol1 = geompy.MakePipe(face,dir)
-
-angle = math.pi/2.
-#dir = geom.MakeVector(Orig,P5)
-vol2 = geompy.MakeRotation(vol1,dir,angle)
-
-vol3 = geompy.MakeRotation(vol2,dir,angle)
-
-vol4 = geompy.MakeRotation(vol3,dir,angle)
-
-list = []
-list.append(vol1)
-list.append(vol2)
-list.append(vol3)
-list.append(vol4)
-
-volComp = geompy.MakeCompound(list)
-
-tol3d = 1.e-3
-vol = geompy.MakeGlueFaces(volComp,tol3d)
-idVol = geompy.addToStudy(vol,"volume")
-
-print("Analysis of the final volume:")
-subShellList = geompy.SubShapeAllSorted(vol,ShapeTypeShell)
-subFaceList = geompy.SubShapeAllSorted(vol,ShapeTypeFace)
-subEdgeList = geompy.SubShapeAllSorted(vol,ShapeTypeEdge)
-
-print("number of Shells in the volume : ",len(subShellList))
-print("number of Faces in the volume : ",len(subFaceList))
-print("number of Edges in the volume : ",len(subEdgeList))
-
-idSubEdge = []
-for k in range(len(subEdgeList)):
- idSubEdge.append(geompy.addToStudyInFather(vol,subEdgeList[k],"SubEdge"+str(k)))
-
-edgeZ = []
-edgeZ.append(subEdgeList[0])
-edgeZ.append(subEdgeList[3])
-edgeZ.append(subEdgeList[10])
-edgeZ.append(subEdgeList[11])
-edgeZ.append(subEdgeList[20])
-edgeZ.append(subEdgeList[21])
-edgeZ.append(subEdgeList[28])
-edgeZ.append(subEdgeList[31])
-
-idEdgeZ = []
-for i in range(8):
- idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1)))
-
-### ---------------------------- SMESH --------------------------------------
-smesh.UpdateStudy()
-
-# ---- init a Mesh with the volume
-
-mesh = smesh.Mesh(vol, "meshVolume")
-
-# ---- set Hypothesis and Algorithm to main shape
-
-print("-------------------------- NumberOfSegments the global one")
-
-numberOfSegments = 10
-
-regular1D = mesh.Segment()
-regular1D.SetName("Wire Discretisation")
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments")
-
-
-print("-------------------------- Quadrangle_2D")
-
-quad2D=mesh.Quadrangle()
-quad2D.SetName("Quadrangle_2D")
-
-print("-------------------------- Hexa_3D")
-
-hexa3D=mesh.Hexahedron()
-hexa3D.SetName("Hexa_3D")
-
-
-print("-------------------------- NumberOfSegments in the Z direction")
-
-numberOfSegmentsZ = 40
-
-for i in range(8):
- print("-------------------------- add hypothesis to edge in the Z directions", (i+1))
-
- algo = mesh.Segment(edgeZ[i])
- hyp = algo.NumberOfSegments(numberOfSegmentsZ)
- smesh.SetName(hyp, "NumberOfSegmentsZ")
- smesh.SetName(algo.GetSubMesh(), "SubMeshEdgeZ_"+str(i+1))
-
-
-salome.sg.updateObjBrowser()
-
-print("-------------------------- compute the mesh of the volume")
-
-ret=mesh.Compute()
-
-print(ret)
-if ret != 0:
-## log=mesh.GetLog(0) # no erase trace
-## for linelog in log:
-## print linelog
- print("Information about the MeshBox :")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons: ", mesh.NbTetras())
-else:
- print("problem when Computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_fix_volute.py
-# Author : Paul RASCLE, EDF
-# Module : SMESH
-# $Header$
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import math
-
-# -----------------------------------------------------------------------------
-
-def MakeFace(lstEdges) :
- """
- Create a planar face from 4 edges
- """
- wire = geompy.MakeWire(lstEdges)
- face = geompy.MakeFace(wire, 1)
- return face
-
-# -----------------------------------------------------------------------------
-
-# ---- dimensions
-
-##longueurPlq = 0.686
-##largeurPlq = 0.573
-##epaisseurPlq = 0.150
-
-##hauteurFlanc = 0.380
-##epaisseurFlanc = 0.112
-##rayonConge = 0.150 - epaisseurFlanc
-
-##epaisseurFond = 0.162
-##rayonTrou = 0.075
-##posAxeTrou = hauteurFlanc -(0.180 + rayonTrou)
-##marge = 0.01
-##tol3d = 1.e-5
-
-longueurPlq = 686
-largeurPlq = 573
-epaisseurPlq = 150
-
-hauteurFlanc = 380
-epaisseurFlanc = 112
-rayonConge = 150 - epaisseurFlanc
-
-epaisseurFond = 162
-rayonTrou = 75
-posAxeTrou = hauteurFlanc - (180 + rayonTrou)
-marge = 10
-tol3d = 1.e-3
-
-# ---- points, directions de base
-
-p0 = geompy.MakeVertex(0., 0., 0.)
-
-vx = geompy.MakeVectorDXDYDZ(100., 0., 0.)
-vy = geompy.MakeVectorDXDYDZ(0., 100., 0.)
-vz = geompy.MakeVectorDXDYDZ(0., 0., 100.)
-
-# ---- ellipse du flanc
-
-he = hauteurFlanc - 2*rayonConge
-re = 0.5*(largeurPlq - epaisseurFond) - rayonConge
-sine = re/he
-cose = math.sqrt(1. - sine*sine)
-
-ve = geompy.MakeVectorDXDYDZ(sine, 0., cose)
-cyl0 = geompy.MakeCylinder(p0, ve, re, 2*he)
-cyl1 = geompy.MakeRotation(cyl0, ve, 0.5)
-cyle = geompy.MakeTranslation(cyl1, -marge*sine, 0., -marge*cose)
-
-pbe = geompy.MakeVertex(3*he, -2*re, 3*he)
-boxe = geompy.MakeBoxTwoPnt(p0, pbe)
-
-cylcoup = geompy.MakeBoolean(cyle, boxe, 2)
-
-aretes = []
-aretes = geompy.SubShapeAllSorted(cylcoup, geompy.ShapeType["EDGE"])
-
-shape = geompy.MakeCopy(aretes[0])
-aShape = geompy.MakeTranslation(shape, 0., rayonConge + re, epaisseurPlq + 2*rayonConge)
-
-
-# -----------------------------------------------------------------------------
-# ---- decoupage de la piece en volumes a 6 faces de 4 cotes
-# -----------------------------------------------------------------------------
-
-# ---- cotes x
-
-x0 = 0.
-x0h = rayonConge
-x1 = rayonConge + epaisseurFlanc
-xc = longueurPlq/2
-x2 = longueurPlq - rayonConge - epaisseurFlanc
-x3h = longueurPlq - rayonConge
-x3 = longueurPlq
-
-# ---- cotes y
-
-y0 = 0.
-y0h = rayonConge
-y1 = largeurPlq - epaisseurFond
-y1m = y1 - marge
-y2 = largeurPlq
-y2p = largeurPlq + marge
-
-# ---- cotes z
-
-z0 = 0.
-z1m = epaisseurPlq - marge
-z1 = epaisseurPlq
-z2 = epaisseurPlq + rayonConge
-z3 = epaisseurPlq + 2*rayonConge
-z4 = epaisseurPlq + hauteurFlanc
-z4p = epaisseurPlq + hauteurFlanc + marge
-
-zc = epaisseurPlq + posAxeTrou
-zc2 = epaisseurPlq + (posAxeTrou - rayonTrou)/3
-zc3 = epaisseurPlq + 2*(posAxeTrou - rayonTrou)/3
-
-# ---- decoupe du fond
-
-p11 = geompy.MakeVertex(x1, y1m, z1)
-p12 = geompy.MakeVertex(x1, y1m, z2)
-p13 = geompy.MakeVertex(x1, y1m, z3)
-p14 = geompy.MakeVertex(x1, y1m, z4)
-pc1 = geompy.MakeVertex(xc, y1m, z1)
-pc2 = geompy.MakeVertex(xc, y1m, zc2)
-pc3 = geompy.MakeVertex(xc, y1m, zc3)
-pcc = geompy.MakeVertex(xc, y1m, zc)
-pc4 = geompy.MakeVertex(xc, y1m, z4)
-p21 = geompy.MakeVertex(x2, y1m, z1)
-p22 = geompy.MakeVertex(x2, y1m, z2)
-p23 = geompy.MakeVertex(x2, y1m, z3)
-p24 = geompy.MakeVertex(x2, y1m, z4)
-pcf = geompy.MakeVertex(xc, y2p, zc)
-
-arc2 = geompy.MakeArc(p12,pc2,p22)
-arc3 = geompy.MakeArc(p13,pc3,p23)
-
-segz1 = geompy.MakeVector(p11,p21)
-segz41 = geompy.MakeVector(p14,pc4)
-segz42 = geompy.MakeVector(pc4,p24)
-segx11 = geompy.MakeVector(p11,p12)
-segx12 = geompy.MakeVector(p12,p13)
-segx13 = geompy.MakeVector(p13,p14)
-segxc2 = geompy.MakeVector(pc1,pc2)
-segxc3 = geompy.MakeVector(pc2,pc3)
-segxc4 = geompy.MakeVector(pcc,pc4)
-segx21 = geompy.MakeVector(p21,p22)
-segx22 = geompy.MakeVector(p22,p23)
-segx23 = geompy.MakeVector(p23,p24)
-segx1c1 = geompy.MakeVector(p13,pcc)
-segx1c2 = geompy.MakeVector(p14,pcc)
-segx2c1 = geompy.MakeVector(p23,pcc)
-segx2c2 = geompy.MakeVector(p24,pcc)
-
-facef = []
-facef.append(MakeFace([segx13,segx1c2,segx1c1]))
-facef.append(MakeFace([segx23,segx2c2,segx2c1]))
-facef.append(MakeFace([segx2c2,segxc4,segz42]))
-facef.append(MakeFace([segx1c2,segz41,segxc4]))
-facef.append(MakeFace([segx1c1,arc3,segx2c1]))
-facef.append(MakeFace([segx12,arc2,segx22,arc3]))
-facef.append(MakeFace([segx11,segz1,segx21,arc2]))
-
-vcccf = geompy.MakeVector(pcc, pcf)
-hcccf = y2p - y1m
-decf = []
-for face in facef:
- decf.append(geompy.MakePrismVecH(face,vcccf,hcccf))
-
-pc = geompy.MakeVertex(xc, 0., zc)
-py2 = geompy.MakeVertex(xc, y2, zc)
-axeCyl = geompy.MakeVector(pc, py2)
-
-cylFond = geompy.MakeCylinder(pc, vy, rayonTrou, 1.1*largeurPlq)
-cylFond2 = geompy.MakeRotation(cylFond, axeCyl, math.pi)
-
-fondec = []
-for id in (0,1,2,3):
- fondec.append(geompy.MakeBoolean(decf[id], cylFond2, 2))
-fondec.append(geompy.MakeBoolean(decf[4], cylFond, 2))
-for id in (5,6):
- fondec.append(decf[id])
-
-p_xcy2pz4p = geompy.MakeVertex(xc,y2p,z4p)
-p_x3y2pz4p = geompy.MakeVertex(x3,y2p,z4p)
-pxc = geompy.MakeVertex(xc,y0,z0)
-bcut1 = geompy.MakeBoxTwoPnt(p0, p_xcy2pz4p)
-bcut2 = geompy.MakeBoxTwoPnt(pxc, p_x3y2pz4p)
-
-fondec2 = []
-for id in (0,1,2,3):
- fondec2.append(fondec[id])
-for id in (4,5,6):
- fondec2.append(geompy.MakeBoolean(fondec[id], bcut1, 1))
- fondec2.append(geompy.MakeBoolean(fondec[id], bcut2, 1))
-
-# ----- autres blocs de decoupe
-
-bcong1 = geompy.MakeBox(x0,y0,z1, x1,y1,z2)
-bcong2 = geompy.MakeBox(x0,y1,z1, x1,y2,z2)
-bcong3 = geompy.MakeBox(x2,y0,z1, x3,y1,z2)
-bcong4 = geompy.MakeBox(x2,y1,z1, x3,y2,z2)
-
-pcylx0 = geompy.MakeVertex(0., -marge, z2)
-pcylx3 = geompy.MakeVertex(longueurPlq, -marge, z2)
-pcyly0 = geompy.MakeVertex(-marge, 0., z2)
-
-cylcongx0 = geompy.MakeCylinder(pcylx0, vy, rayonConge, largeurPlq + 2*marge)
-cylcongx3 = geompy.MakeCylinder(pcylx3, vy, rayonConge, largeurPlq + 2*marge)
-cylcongy0 = geompy.MakeCylinder(pcyly0, vx, rayonConge, longueurPlq + 2*marge)
-
-bcong1 = geompy.MakeBoolean(bcong1,cylcongx0,2)
-bcong2 = geompy.MakeBoolean(bcong2,cylcongx0,2)
-bcong1 = geompy.MakeBoolean(bcong1,cylcongy0,2)
-#NRI : inverse order of BOP
-bcong3 = geompy.MakeBoolean(bcong3,cylcongy0,2)
-bcong3 = geompy.MakeBoolean(bcong3,cylcongx3,2)
-bcong4 = geompy.MakeBoolean(bcong4,cylcongx3,2)
-
-pf1 = geompy.MakeVertex(0., y0h, z3)
-pf2 = geompy.MakeVertex(0., y1, z3)
-pf3 = geompy.MakeVertex(0., y1, z4)
-pf4 = geompy.MakeVertex(0., 0.5*(largeurPlq - epaisseurFond) , z4)
-
-vf1 = geompy.MakeEdge(pf1, pf2)
-vf2 = geompy.MakeEdge(pf2, pf3)
-vf3 = geompy.MakeEdge(pf3, pf4)
-
-faceFlanc = MakeFace([vf1,vf2,vf3,aShape])
-
-flanc1 = geompy.MakePrismVecH(faceFlanc, vx, epaisseurFlanc)
-flanc2 = geompy.MakeCopy(flanc1)
-flanc1 = geompy.MakeTranslation(flanc1, rayonConge, 0., 0.)
-flanc2 = geompy.MakeTranslation(flanc2, longueurPlq - rayonConge - epaisseurFlanc, 0., 0.)
-
-# ---- constitution et decoupe des blocs
-boxfond2 = geompy.MakeBox(x0, y1, z0, x3, y2, z4p)
-
-blocs = []
-for dec in fondec2:
- blocs.append(geompy.MakeBoolean(boxfond2, dec, 1))
-
-blocs.append(geompy.MakeBox(x0,y1,z0, x1,y2,z1))
-blocs.append(geompy.MakeBox(x1,y1,z0, xc,y2,z1))
-blocs.append(geompy.MakeBox(xc,y1,z0, x2,y2,z1))
-blocs.append(geompy.MakeBox(x2,y1,z0, x3,y2,z1))
-blocs.append(geompy.MakeBox(x0,y0,z0, x1,y1,z1))
-blocs.append(geompy.MakeBox(x1,y0,z0, xc,y1,z1))
-blocs.append(geompy.MakeBox(xc,y0,z0, x2,y1,z1))
-blocs.append(geompy.MakeBox(x2,y0,z0, x3,y1,z1))
-blocs.append(bcong2)
-blocs.append(bcong4)
-blocs.append(bcong1)
-blocs.append(bcong3)
-blocs.append(geompy.MakeBox(x0h,y1, z2, x1, y2, z3))
-blocs.append(geompy.MakeBox(x2, y1, z2, x3h,y2, z3))
-blocs.append(geompy.MakeBox(x0h,y0h,z2, x1, y1, z3))
-blocs.append(geompy.MakeBox(x2, y0h,z2, x3h,y1, z3))
-blocs.append(geompy.MakeBox(x0h,y1, z3, x1, y2, z4))
-blocs.append(geompy.MakeBox(x2, y1, z3, x3h,y2, z4))
-blocs.append(flanc1)
-blocs.append(flanc2)
-
-compbloc = geompy.MakeCompound(blocs)
-idcomp = geompy.addToStudy(compbloc, "compbloc")
-
-# ---- eliminer les faces en double, solid-->shell
-
-compshell = geompy.MakeGlueFaces(compbloc,tol3d)
-idcomp = geompy.addToStudy(compshell, "compshell")
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Hexahedrization of the geometry generated by the Python script
-# SMESH_fixation.py
-# Hypothesis and algorithms for the mesh generation are global
-#
-import salome
-import SMESH_fixation
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-compshell = SMESH_fixation.compshell
-idcomp = SMESH_fixation.idcomp
-geompy = SMESH_fixation.geompy
-salome = SMESH_fixation.salome
-
-print("Analysis of the geometry to be meshed :")
-subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
-
-print("number of Shells in compshell : ", len(subShellList))
-print("number of Faces in compshell : ", len(subFaceList))
-print("number of Edges in compshell : ", len(subEdgeList))
-
-status = geompy.CheckShape(compshell)
-print(" check status ", status)
-
-### ---------------------------- SMESH --------------------------------------
-smesh.UpdateStudy()
-
-# ---- init a Mesh with the compshell
-shape_mesh = salome.IDToObject( idcomp )
-
-mesh = smesh.Mesh(shape_mesh, "MeshCompShell")
-
-
-# ---- set Hypothesis and Algorithm
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegments = 5
-
-regular1D = mesh.Segment()
-regular1D.SetName("Wire Discretisation")
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
-
-print("-------------------------- Quadrangle_2D")
-
-quad2D = mesh.Quadrangle()
-quad2D.SetName("Quadrangle_2D")
-
-print("-------------------------- Hexa_3D")
-
-hexa3D = mesh.Hexahedron()
-hexa3D.SetName("Hexa_3D")
-
-print("-------------------------- compute compshell")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- log = mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the MeshcompShel:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of quadrangles : ", mesh.NbQuadrangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of hexahedrons : ", mesh.NbHexas())
-else:
- print("problem when Computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Tetrahedrization of the geometry generated by the Python script
-# SMESH_fixation.py
-# The new Netgen algorithm is used that discretizes baoundaries itself
-#
-import salome
-import SMESH_fixation
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-compshell = SMESH_fixation.compshell
-idcomp = SMESH_fixation.idcomp
-geompy = SMESH_fixation.geompy
-salome = SMESH_fixation.salome
-
-print("Analysis of the geometry to be meshed :")
-subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
-
-print("number of Shells in compshell : ", len(subShellList))
-print("number of Faces in compshell : ", len(subFaceList))
-print("number of Edges in compshell : ", len(subEdgeList))
-
-status = geompy.CheckShape(compshell)
-print(" check status ", status)
-
-### ---------------------------- SMESH --------------------------------------
-smesh.UpdateStudy()
-
-print("-------------------------- create Mesh, algorithm, hypothesis")
-
-mesh = smesh.Mesh(compshell, "MeshcompShel");
-netgen = mesh.Tetrahedron(smeshBuilder.FULL_NETGEN)
-netgen.SetMaxSize( 50 )
-#netgen.SetSecondOrder( 0 )
-netgen.SetFineness( smeshBuilder.Fine )
-#netgen.SetOptimize( 1 )
-
-print("-------------------------- compute mesh")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- print("Information about the MeshcompShel:")
- print("Number of nodes : ", mesh.GetMesh().NbNodes())
- print("Number of edges : ", mesh.GetMesh().NbEdges())
- print("Number of faces : ", mesh.GetMesh().NbFaces())
- print("Number of triangles : ", mesh.GetMesh().NbTriangles())
- print("Number of volumes : ", mesh.GetMesh().NbVolumes())
- print("Number of tetrahedrons : ", mesh.GetMesh().NbTetras())
-
-else:
- print("problem when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Tetrahedrization of the geometry generated by the Python script
-# SMESH_fixation.py
-# Hypothesis and algorithms for the mesh generation are global
-#
-import salome
-import SMESH_fixation
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-compshell = SMESH_fixation.compshell
-idcomp = SMESH_fixation.idcomp
-geompy = SMESH_fixation.geompy
-salome = SMESH_fixation.salome
-
-print("Analysis of the geometry to be meshed :")
-subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
-
-print("number of Shells in compshell : ", len(subShellList))
-print("number of Faces in compshell : ", len(subFaceList))
-print("number of Edges in compshell : ", len(subEdgeList))
-
-status = geompy.CheckShape(compshell)
-print(" check status ", status)
-
-### ---------------------------- SMESH --------------------------------------
-smesh.UpdateStudy()
-
-# ---- init a Mesh with the compshell
-
-mesh = smesh.Mesh(compshell, "MeshcompShell")
-
-
-# ---- set Hypothesis and Algorithm
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegments = 5
-
-regular1D = mesh.Segment()
-regular1D.SetName("Wire Discretisation")
-hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
-
-## print "-------------------------- MaxElementArea"
-
-## maxElementArea = 80
-
-## mefisto2D = mesh.Triangle()
-## mefisto2D.SetName("MEFISTO_2D")
-## hypArea = mefisto2D.MaxElementArea(maxElementArea)
-## print hypArea.GetName()
-## print hypArea.GetId()
-## print hypArea.GetMaxElementArea()
-## smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-print("-------------------------- LengthFromEdges")
-
-mefisto2D = mesh.Triangle()
-mefisto2D.SetName("MEFISTO_2D")
-hypLengthFromEdges = mefisto2D.LengthFromEdges()
-print(hypLengthFromEdges.GetName())
-print(hypLengthFromEdges.GetId())
-smesh.SetName(hypLengthFromEdges, "LengthFromEdges")
-
-
-print("-------------------------- MaxElementVolume")
-
-maxElementVolume = 1000
-
-netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
-netgen3D.SetName("NETGEN_3D")
-hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
-print(hypVolume.GetName())
-print(hypVolume.GetId())
-print(hypVolume.GetMaxElementVolume())
-smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
-
-print("-------------------------- compute compshell")
-ret = mesh.Compute(mesh)
-print(ret)
-if ret != 0:
- log = mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the MeshcompShel:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons : ", mesh.NbTetras())
-
-else:
- print("problem when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Triangulation of the skin of the geometry from a Brep representing a plane
-# Hypothesis and algorithms for the mesh generation are global
-#
-import os
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-# ---------------------------- GEOM --------------------------------------
-
-# import a BRep
-#before running this script, please be sure about
-#the path the file fileName
-
-filePath = os.environ["DATA_DIR"]
-filePath = filePath + "/Shapes/Brep/"
-
-filename = "flight_solid.brep"
-filename = filePath + filename
-
-shape = geompy.Import(filename, "BREP")
-idShape = geompy.addToStudy(shape, "flight")
-
-print("Analysis of the geometry flight :")
-subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"])
-
-print("number of Shells in flight : ", len(subShellList))
-print("number of Faces in flight : ", len(subFaceList))
-print("number of Edges in flight : ", len(subEdgeList))
-
-
-### ---------------------------- SMESH --------------------------------------
-smesh.UpdateStudy()
-
-# ---- init a Mesh with the shell
-shape_mesh = salome.IDToObject( idShape )
-
-mesh = smesh.Mesh(shape_mesh, "MeshFlight")
-
-
-# ---- set Hypothesis and Algorithm
-
-print("-------------------------- LocalLength")
-
-lengthOfSegments = 0.3
-
-regular1D = mesh.Segment()
-hypLength = regular1D.LocalLength(lengthOfSegments)
-print(hypLength.GetName())
-print(hypLength.GetId())
-print(hypLength.GetLength())
-smesh.SetName(hypLength, "LocalLength_" + str(lengthOfSegments))
-
-print("-------------------------- LengthFromEdges")
-
-mefisto2D = mesh.Triangle()
-hypLengthFromEdge = mefisto2D.LengthFromEdges()
-print(hypLengthFromEdge.GetName())
-print(hypLengthFromEdge.GetId())
-smesh.SetName(hypLengthFromEdge,"LengthFromEdge")
-
-print("-------------------------- compute the skin flight")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- log = mesh.GetLog(0) # no erase trace
- # for linelog in log:
- # print(linelog)
- print("Information about the Mesh_mechanic_tetra:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of volumes : ", mesh.NbVolumes())
-else:
- print("probleme when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-# Create box without one plane
-
-box = geompy.MakeBox(0., 0., 0., 10., 20., 30.)
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-
-FaceList = []
-for i in range( 5 ):
- FaceList.append( subShapeList[ i ] )
-
-aComp = geompy.MakeCompound( FaceList )
-aBox = geompy.Sew( aComp, 1. )
-idbox = geompy.addToStudy( aBox, "box" )
-
-aBox = salome.IDToObject( idbox )
-
-# Create mesh
-smesh.UpdateStudy()
-
-mesh = smesh.Mesh(aBox, "Mesh_freebord")
-
-algoReg = mesh.Segment()
-hypNbSeg = algoReg.NumberOfSegments(5)
-
-algoMef = mesh.Triangle()
-hypArea = algoMef.MaxElementArea(20)
-
-
-mesh.Compute()
-
-
-# Criterion : Free edges. Create group.
-
-aCriterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_FreeEdges)
-
-aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion)
-
-anIds = aGroup.GetIDs()
-
-# print result
-print("Criterion: Free edges Nb = ", len( anIds ))
-for i in range( len( anIds ) ):
- print(anIds[ i ])
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# -----------------------------------------------------------------------------
-
-p0 = geompy.MakeVertex(0., 0., 0.)
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex(0., 100., 0.)
-pz = geompy.MakeVertex(0., 0., 100.)
-vx = geompy.MakeVector(p0, px)
-vy = geompy.MakeVector(p0, py)
-vz = geompy.MakeVector(p0, pz)
-
-sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
-sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
-sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
-sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
-ptcyle = geompy.MakeVertex(0., -300., -450.)
-cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
-
-vol1=geompy.MakeCut(sphereExt,sphereA)
-vol2=geompy.MakeCut(vol1,sphereB)
-vol3=geompy.MakeCut(vol2,cylindre)
-blob=geompy.MakeCut(vol3,sphereInt)
-blob=geompy.RemoveExtraEdges(blob)
-
-idblob = geompy.addToStudy(blob,"blob")
-
-edgeGroups = geompy.Propagate( blob )
-assert len( edgeGroups ) == 3
-
-salome.sg.updateObjBrowser()
-
-# -----------------------------------------------------------------------------
-
-print("-------------------------- mesh")
-smesh.UpdateStudy()
-
-# ---- define a mesh on the geom shape 'blob'
-mesh=smesh.Mesh(blob, "MeshBlob")
-
-# ---- assign global hypothesis and algorithms to mesh
-print("-------------------------- add hypothesis to mesh")
-algo1 = mesh.Segment()
-algo2 = mesh.Quadrangle()
-algo3 = mesh.Hexahedron()
-
-# ---- assign local hypothesis and algorithms to mesh
-for edges in edgeGroups: # loop on groups of logically parallel edges
- length = geompy.BasicProperties( edges )[0]
- if length < 500: nbSeg = 4
- elif length < 2000: nbSeg = 10
- else: nbSeg = 15
- algo = mesh.Segment( edges )
- algo.NumberOfSegments( nbSeg )
- pass
-
-# ---- compute mesh
-print("-------------------------- compute mesh")
-ok = mesh.Compute()
-if ok:
- print("Information about the Mesh:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of quadrangles : ", mesh.NbQuadrangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of hexahedrons : ", mesh.NbHexas())
-else:
- print("problem when Computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_withHole.py
-# Author : Lucien PIGNOLONI
-# Module : SMESH
-# $Header$
-#-------------------------------------------------------------------------
-#
-import salome
-salome.salome_init_without_session()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-from salome.StdMeshers import StdMeshersBuilder
-
-# ---------------------------- GEOM --------------------------------------
-
-# ---- define contiguous arcs and segment to define a closed wire
-p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
-p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
-p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
-arc1 = geompy.MakeArc( p1, p2, p3 )
-
-p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
-seg1 = geompy.MakeVector( p3, p4 )
-
-p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
-p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
-arc2 = geompy.MakeArc( p4, p5, p6 )
-
-p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
-arc3 = geompy.MakeArc( p6, p7, p1 )
-
-# ---- define a closed wire with arcs and segment
-List1 = []
-List1.append( arc1 )
-List1.append( seg1 )
-List1.append( arc2 )
-List1.append( arc3 )
-
-wire1 = geompy.MakeWire( List1 )
-Id_wire1 = geompy.addToStudy( wire1, "wire1" )
-
-# ---- define a planar face with wire
-WantPlanarFace = 1 #True
-face1 = geompy.MakeFace( wire1, WantPlanarFace )
-Id_face1 = geompy.addToStudy( face1, "face1" )
-
-# ---- create a shape by extrusion
-pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
-pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
-vz = geompy.MakeVector( pO, pz )
-
-prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
-Id_prism1 = geompy.addToStudy( prism1, "prism1" )
-
-# ---- create two cylinders
-pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
-pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
-
-radius = 20.0
-height = 180.0
-cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
-cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
-
-Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
-Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
-
-# ---- cut with cyl1
-shape = geompy.MakeBoolean( prism1, cyl1, 2 )
-
-# ---- fuse with cyl2 to obtain the final mechanic piece :)
-mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
-Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
-
-# ---- explode on faces
-SubFaceL = geompy.SubShapeAllSorted(mechanic, geompy.ShapeType["FACE"])
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face1 = SubFaceL[0]
-name = geompy.SubShapeName( sub_face1, mechanic )
-
-Id_SubFace1 = geompy.addToStudyInFather( mechanic, sub_face1, name )
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face2 = SubFaceL[4]
-name = geompy.SubShapeName( sub_face2, mechanic )
-
-Id_SubFace2 = geompy.addToStudyInFather( mechanic, sub_face2, name )
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face3 = SubFaceL[5]
-name = geompy.SubShapeName( sub_face3, mechanic )
-
-Id_SubFace3 = geompy.addToStudyInFather( mechanic, sub_face3, name )
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face4 = SubFaceL[10]
-name = geompy.SubShapeName( sub_face4, mechanic )
-
-Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
-
-# ---------------------------- SMESH --------------------------------------
-smesh.UpdateStudy()
-
-# -- Init --
-shape_mesh = salome.IDToObject( Id_mechanic )
-
-mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic")
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegment = 10
-
-algo = mesh.Segment()
-hypNbSeg = algo.NumberOfSegments(numberOfSegment)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_10")
-
-print("-------------------------- MaxElementArea")
-
-maxElementArea = 25
-
-algo = mesh.Triangle()
-hypArea25 = algo.MaxElementArea(maxElementArea)
-print(hypArea25.GetName())
-print(hypArea25.GetId())
-print(hypArea25.GetMaxElementArea())
-smesh.SetName(hypArea25, "MaxElementArea_25")
-
-# Create submesh on sub_face1 - sub_face4
-# ---------------------------------------
-
-# Set 2D algorithm to submesh on sub_face1
-algo = mesh.Quadrangle(sub_face1)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace1")
-
-# Set 2D algorithm to submesh on sub_face2
-algo = mesh.Quadrangle(sub_face2)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace2")
-
-# Set 2D algorithm to submesh on sub_face3
-algo = mesh.Quadrangle(sub_face3)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace3")
-
-# Set 2D algorithm to submesh on sub_face4
-algo = mesh.Quadrangle(sub_face4)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace4")
-
-print("-------------------------- compute the mesh of the mechanic piece")
-
-mesh.Compute()
-
-print("Information about the Mesh_mechanic:")
-print("Number of nodes : ", mesh.NbNodes())
-print("Number of edges : ", mesh.NbEdges())
-print("Number of faces : ", mesh.NbFaces())
-print("Number of triangles : ", mesh.NbTriangles())
-print("Number of quadrangles : ", mesh.NbQuadrangles())
-print("Number of volumes : ", mesh.NbVolumes())
-print("Number of tetrahedrons: ", mesh.NbTetras())
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_withHole.py
-# Author : Lucien PIGNOLONI
-# Module : SMESH
-# $Header$
-#-------------------------------------------------------------------------
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---------------------------- GEOM --------------------------------------
-
-# ---- define contiguous arcs and segment to define a closed wire
-p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
-p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
-p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
-arc1 = geompy.MakeArc( p1, p2, p3 )
-
-p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
-seg1 = geompy.MakeVector( p3, p4 )
-
-p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
-p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
-arc2 = geompy.MakeArc( p4, p5, p6 )
-
-p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
-arc3 = geompy.MakeArc( p6, p7, p1 )
-
-# ---- define a closed wire with arcs and segment
-List1 = []
-List1.append( arc1 )
-List1.append( seg1 )
-List1.append( arc2 )
-List1.append( arc3 )
-
-wire1 = geompy.MakeWire( List1 )
-Id_wire1 = geompy.addToStudy( wire1, "wire1" )
-
-# ---- define a planar face with wire
-WantPlanarFace = 1 #True
-face1 = geompy.MakeFace( wire1, WantPlanarFace )
-Id_face1 = geompy.addToStudy( face1, "face1" )
-
-# ---- create a shape by extrusion
-pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
-pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
-vz = geompy.MakeVector( pO, pz )
-
-prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
-Id_prism1 = geompy.addToStudy( prism1, "prism1" )
-
-# ---- create two cylinders
-pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
-pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
-
-radius = 20.0
-height = 180.0
-cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
-cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
-
-Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
-Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
-
-# ---- cut with cyl1
-shape = geompy.MakeBoolean( prism1, cyl1, 2 )
-
-# ---- fuse with cyl2 to obtain the final mechanic piece :)
-mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
-Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
-
-# ---- explode on faces
-SubFaceL = geompy.SubShapeAllSorted(mechanic, geompy.ShapeType["FACE"])
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face1 = SubFaceL[0]
-name = geompy.SubShapeName( sub_face1, mechanic )
-
-Id_SubFace1 = geompy.addToStudyInFather( mechanic, sub_face1, name )
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face2 = SubFaceL[4]
-name = geompy.SubShapeName( sub_face2, mechanic )
-
-Id_SubFace2 = geompy.addToStudyInFather( mechanic, sub_face2, name )
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face3 = SubFaceL[5]
-name = geompy.SubShapeName( sub_face3, mechanic )
-
-Id_SubFace3 = geompy.addToStudyInFather( mechanic, sub_face3, name )
-
-# ---- add a face sub-shape in study to be meshed different
-sub_face4 = SubFaceL[10]
-name = geompy.SubShapeName( sub_face4, mechanic )
-
-Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
-
-# ---------------------------- SMESH --------------------------------------
-
-# -- Init --
-shape_mesh = salome.IDToObject( Id_mechanic )
-
-mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic")
-
-print("-------------------------- NumberOfSegments")
-
-numberOfSegment = 10
-
-algo = mesh.Segment()
-hypNbSeg = algo.NumberOfSegments(numberOfSegment)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment))
-
-
-print("-------------------------- MaxElementArea")
-
-maxElementArea = 25
-
-algo = mesh.Triangle()
-hypArea25 = algo.MaxElementArea(maxElementArea)
-print(hypArea25.GetName())
-print(hypArea25.GetId())
-print(hypArea25.GetMaxElementArea())
-smesh.SetName(hypArea25, "MaxElementArea_" + str(maxElementArea))
-
-
-# Create submesh on sub_face1 - sub_face4
-# ---------------------------------------
-
-# Set 2D algorithm to submesh on sub_face1
-algo = mesh.Quadrangle(sub_face1)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace1")
-submesh1 = algo.GetSubMesh()
-
-# Set 2D algorithm to submesh on sub_face2
-algo = mesh.Quadrangle(sub_face2)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace2")
-submesh2 = algo.GetSubMesh()
-
-# Set 2D algorithm to submesh on sub_face3
-algo = mesh.Quadrangle(sub_face3)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace3")
-submesh3 = algo.GetSubMesh()
-
-# Set 2D algorithm to submesh on sub_face4
-algo = mesh.Quadrangle(sub_face4)
-smesh.SetName(algo.GetSubMesh(), "SubMeshFace4")
-submesh4 = algo.GetSubMesh()
-
-
-print("-------------------------- compute the mesh of the mechanic piece")
-
-mesh.Compute()
-
-print("Information about the Mesh_mechanic:")
-print("Number of nodes : ", mesh.NbNodes())
-print("Number of edges : ", mesh.NbEdges())
-print("Number of faces : ", mesh.NbFaces())
-print("Number of triangles : ", mesh.NbTriangles())
-print("Number of quadrangles : ", mesh.NbQuadrangles())
-print("Number of volumes : ", mesh.NbVolumes())
-print("Number of tetrahedrons: ", mesh.NbTetras())
-
-
-#1 cutting of quadrangles of the 'SubMeshFace2' submesh
-mesh.SplitQuadObject(submesh2, 1)
-
-#2 cutting of triangles of the group
-FacesTriToQuad = [ 2391, 2824, 2825, 2826, 2827, 2828, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2841, 2844, 2845, 2847, 2854, 2861, 2863, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2940, 2941, 2946, 2951, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985 ]
-GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", SMESH.FACE, FacesTriToQuad)
-mesh.TriToQuadObject(GroupTriToQuad, SMESH.FT_AspectRatio , 1.57)
-
-#3 extrusion of the group
-point = SMESH.PointStruct(0, 0, 5)
-vector = SMESH.DirStruct(point)
-mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5)
-
-#4 mirror object
-mesh.Mirror([], SMESH.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0)
-
-#5 mesh translation
-point = SMESH.PointStruct(10, 10, 10)
-vector = SMESH.DirStruct(point)
-mesh.Translate([], vector, 0)
-
-#6 mesh rotation
-axisXYZ = SMESH.AxisStruct(0, 0, 0, 10, 10, 10)
-angle180 = 180*3.141/180
-mesh.Rotate([], axisXYZ, angle180, 0)
-
-#7 group smoothing
-FacesSmooth = [864, 933, 941, 950, 1005, 1013]
-GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", SMESH.FACE, FacesSmooth)
-mesh.SmoothObject(GroupSmooth, [], 20, 2, smesh.CENTROIDAL_SMOOTH)
-
-#8 rotation sweep object
-FacesRotate = [492, 493, 502, 503]
-GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", SMESH.FACE, FacesRotate)
-angle45 = 45*3.141/180
-axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632)
-mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5)
-
-#9 reorientation of the submesh1
-mesh.ReorientObject(submesh1)
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# Quadrangulation of the geometry generated by the Python script
-# SMESH_mechanic.py
-# The new Netgen algorithm is used that discretizes baoundaries itself
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---------------------------- GEOM --------------------------------------
-
-# ---- define contiguous arcs and segment to define a closed wire
-p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
-p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
-p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
-arc1 = geompy.MakeArc( p1, p2, p3 )
-
-p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
-seg1 = geompy.MakeVector( p3, p4 )
-
-p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
-p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
-arc2 = geompy.MakeArc( p4, p5, p6 )
-
-p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
-arc3 = geompy.MakeArc( p6, p7, p1 )
-
-# ---- define a closed wire with arcs and segment
-List1 = []
-List1.append( arc1 )
-List1.append( seg1 )
-List1.append( arc2 )
-List1.append( arc3 )
-
-wire1 = geompy.MakeWire( List1 )
-Id_wire1 = geompy.addToStudy( wire1, "wire1" )
-
-# ---- define a planar face with wire
-WantPlanarFace = 1 #True
-face1 = geompy.MakeFace( wire1, WantPlanarFace )
-Id_face1 = geompy.addToStudy( face1, "face1" )
-
-# ---- create a shape by extrusion
-pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
-pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
-vz = geompy.MakeVector( pO, pz )
-
-prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
-Id_prism1 = geompy.addToStudy( prism1, "prism1")
-
-# ---- create two cylinders
-
-pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
-pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
-radius = 20.0
-height = 180.0
-cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
-cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
-
-Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
-Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
-
-# ---- cut with cyl1
-shape = geompy.MakeBoolean( prism1, cyl1, 2 )
-
-# ---- fuse with cyl2 to obtain the final mechanic piece :)
-mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
-Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
-
-# ---- Analysis of the geometry
-
-print("Analysis of the geometry mechanic :")
-
-subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"])
-
-print("number of Shells in mechanic : ",len(subShellList))
-print("number of Faces in mechanic : ",len(subFaceList))
-print("number of Edges in mechanic : ",len(subEdgeList))
-
-### ---------------------------- SMESH --------------------------------------
-
-print("-------------------------- create Mesh, algorithm, hypothesis")
-
-mesh = smesh.Mesh(mechanic, "Mesh_mechanic");
-netgen = mesh.Triangle(smeshBuilder.NETGEN)
-netgen.SetMaxSize( 50 )
-#netgen.SetSecondOrder( 0 )
-netgen.SetFineness( smeshBuilder.Fine )
-netgen.SetQuadAllowed( 1 )
-#netgen.SetOptimize( 1 )
-
-print("-------------------------- compute mesh")
-ret = mesh.Compute()
-print(ret)
-if ret != 0:
- print("Information about the MeshcompShel:")
- print("Number of nodes : ", mesh.NbNodes())
- print("Number of edges : ", mesh.NbEdges())
- print("Number of faces : ", mesh.NbFaces())
- print("Number of triangles : ", mesh.NbTriangles())
- print("Number of quadrangles : ", mesh.NbQuadrangles())
- print("Number of volumes : ", mesh.NbVolumes())
- print("Number of tetrahedrons : ", mesh.NbTetras())
-
-else:
- print("problem when computing the mesh")
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_withHole.py
-# Author : Lucien PIGNOLONI
-# Module : SMESH
-# $Header$
-#
-import salome
-salome.salome_init_without_session()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---------------------------- GEOM --------------------------------------
-
-# ---- define contiguous arcs and segment to define a closed wire
-p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
-p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
-p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
-arc1 = geompy.MakeArc( p1, p2, p3 )
-
-p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
-seg1 = geompy.MakeVector( p3, p4 )
-
-p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
-p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
-arc2 = geompy.MakeArc( p4, p5, p6 )
-
-p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
-arc3 = geompy.MakeArc( p6, p7, p1 )
-
-# ---- define a closed wire with arcs and segment
-List1 = []
-List1.append( arc1 )
-List1.append( seg1 )
-List1.append( arc2 )
-List1.append( arc3 )
-
-wire1 = geompy.MakeWire( List1 )
-Id_wire1 = geompy.addToStudy( wire1, "wire1" )
-
-# ---- define a planar face with wire
-WantPlanarFace = 1 #True
-face1 = geompy.MakeFace( wire1, WantPlanarFace )
-Id_face1 = geompy.addToStudy( face1, "face1" )
-
-# ---- create a shape by extrusion
-pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
-pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
-vz = geompy.MakeVector( pO, pz )
-
-prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
-Id_prism1 = geompy.addToStudy( prism1, "prism1")
-
-# ---- create two cylinders
-
-pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
-pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
-radius = 20.0
-height = 180.0
-cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
-cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
-
-Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
-Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
-
-# ---- cut with cyl1
-shape = geompy.MakeBoolean( prism1, cyl1, 2 )
-
-# ---- fuse with cyl2 to obtain the final mechanic piece :)
-mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
-Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
-
-# ---- Analysis of the geometry
-
-print("Analysis of the geometry mechanic :")
-
-subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"])
-subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"])
-subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"])
-
-print("number of Shells in mechanic : ",len(subShellList))
-print("number of Faces in mechanic : ",len(subFaceList))
-print("number of Edges in mechanic : ",len(subEdgeList))
-
-### ---------------------------- SMESH --------------------------------------
-
-shape_mesh = salome.IDToObject( Id_mechanic )
-
-mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic_tetra")
-
-print("-------------------------- add hypothesis to main mechanic")
-
-numberOfSegment = 10
-
-algo1 = mesh.Segment()
-hypNbSeg = algo1.NumberOfSegments(numberOfSegment)
-print(hypNbSeg.GetName())
-print(hypNbSeg.GetId())
-print(hypNbSeg.GetNumberOfSegments())
-smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment))
-
-
-maxElementArea = 20
-
-algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
-hypArea = algo2.MaxElementArea(maxElementArea)
-print(hypArea.GetName())
-print(hypArea.GetId())
-print(hypArea.GetMaxElementArea())
-smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-
-
-maxElementVolume = 20
-
-algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN)
-hypVolume = algo3.MaxElementVolume(maxElementVolume)
-print(hypVolume.GetName())
-print(hypVolume.GetId())
-print(hypVolume.GetMaxElementVolume())
-smesh.SetName(hypVolume, "maxElementVolume_" + str(maxElementVolume))
-
-
-print("-------------------------- compute the mesh of the mechanic piece")
-mesh.Compute()
-
-print("Information about the Mesh_mechanic_tetra:")
-print("Number of nodes : ", mesh.NbNodes())
-print("Number of edges : ", mesh.NbEdges())
-print("Number of faces : ", mesh.NbFaces())
-print("Number of triangles : ", mesh.NbTriangles())
-print("Number of quadrangles: ", mesh.NbQuadrangles())
-print("Number of volumes : ", mesh.NbVolumes())
-print("Number of tetrahedrons: ", mesh.NbTetras())
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_reg.py
-# Module : SMESH
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-from salome.StdMeshers import StdMeshersBuilder
-
-
-# ---- define a box
-print("Define box")
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# ---- add faces of box to study
-print("Add faces to study")
-idface = []
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-for f in subShapeList:
- name = geompy.SubShapeName(f, box)
- print(name)
- idface.append( geompy.addToStudyInFather(box, f, name) )
-
-# ---- add edges of box to study
-print("Add edges to study")
-idedge = []
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
-for f in subShapeList:
- name = geompy.SubShapeName(f, box)
- print(name)
- idedge.append( geompy.addToStudyInFather(box, f, name) )
-
-salome.sg.updateObjBrowser()
-
-# ---- launch SMESH
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init()
-smesh.UpdateStudy()
-
-# ---- Creating meshes
-
-box = salome.IDToObject(idbox)
-names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ]
-
-
-print("-------------------------- Create ", names[0], " mesh")
-mesh = smesh.Mesh(box, names[0])
-algo = mesh.Segment()
-hyp = algo.NumberOfSegments(7)
-hyp.SetDistrType(0)
-smesh.SetName(hyp, "NumberOfSegmentsReg")
-algo = mesh.Triangle()
-algo.MaxElementArea(2500)
-
-print("-------------------------- Create ", names[1], " mesh")
-mesh = smesh.Mesh(box, names[1])
-algo = mesh.Segment()
-hyp = algo.NumberOfSegments(7)
-hyp.SetDistrType(1)
-hyp.SetScaleFactor(2)
-smesh.SetName(hyp, "NumberOfSegmentsScale")
-algo = mesh.Triangle()
-algo.MaxElementArea(2500)
-
-print("-------------------------- Create ", names[2], " mesh")
-mesh = smesh.Mesh(box,names[2])
-algo = mesh.Segment()
-hyp = algo.NumberOfSegments(7)
-hyp.SetDistrType(2)
-hyp.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] )
-hyp.SetConversionMode(0)
-smesh.SetName(hyp, "NumberOfSegmentsTable")
-algo = mesh.Triangle()
-algo.MaxElementArea(2500)
-
-print("-------------------------- Create ", names[3], " mesh")
-mesh = smesh.Mesh(box, names[3])
-algo = mesh.Segment()
-hyp = algo.NumberOfSegments(10)
-hyp.SetDistrType(3)
-hyp.SetExpressionFunction("sin(3*t)")
-hyp.SetConversionMode(1)
-smesh.SetName(hyp, "NumberOfSegmentsExpr")
-algo = mesh.Triangle()
-algo.MaxElementArea(2500)
-
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
-# File : SMESH_test.py
-# Module : SMESH
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idb = geompy.addToStudy(box, "box")
-
-# ---- add first face of box in study
-
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-name = geompy.SubShapeName(face, box)
-idf = geompy.addToStudyInFather(box, face, name)
-
-# ---- add shell from box in study
-
-subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-ids = geompy.addToStudyInFather(box, shell, name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
-edge = edgeList[0];
-name = geompy.SubShapeName(edge, face)
-ide = geompy.addToStudyInFather(face, edge, name)
-
-# ---- SMESH
-
-smesh.UpdateStudy()
-box = salome.IDToObject(idb)
-mesh = smesh.Mesh(box, "Meshbox")
-
-print("-------------------------- add hypothesis to box")
-
-algo_1 = mesh.Segment(box)
-hyp = algo_1.LocalLength(100)
-print(hyp.GetName())
-print(hyp.GetId())
-print(hyp.GetLength())
-
-algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box)
-hyp = algo_2.MaxElementArea(5000)
-print(hyp.GetName())
-print(hyp.GetId())
-print(hyp.GetMaxElementArea())
-
-smesh.SetName(algo_2.GetSubMesh(), "SubMeshBox")
-
-
-print("-------------------------- add hypothesis to edge")
-
-edge = salome.IDToObject(ide)
-
-algo_3 = mesh.Segment(edge)
-hyp = algo_3.LocalLength(100)
-print(hyp.GetName())
-print(hyp.GetId())
-print(hyp.GetLength())
-
-smesh.SetName(algo_3.GetSubMesh(), "SubMeshEdge")
-
-
-print("-------------------------- compute face")
-
-face = salome.IDToObject(idf)
-
-ret = mesh.Compute(face)
-print(ret)
-log = [] #mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after
-for a in log:
- print("-------")
- ii = 0
- ir = 0
- comType = a.commandType
- if comType == 0:
- for i in range(a.number):
- ind = a.indexes[ii]
- ii = ii+1
- r1 = a.coords[ir]
- ir = ir+1
- r2 = a.coords[ir]
- ir = ir+1
- r3 = a.coords[ir]
- ir = ir+1
- print("AddNode %i - %g %g %g" % (ind, r1, r2, r3))
- elif comType == 1:
- for i in range(a.number):
- ind = a.indexes[ii]
- ii = ii+1
- i1 = a.indexes[ii]
- ii = ii+1
- i2 = a.indexes[ii]
- ii = ii+1
- print("AddEdge %i - %i %i" % (ind, i1, i2))
- elif comType == 2:
- for i in range(a.number):
- ind = a.indexes[ii]
- print(ind)
- ii = ii+1
- print(ii)
- i1 = a.indexes[ii]
- ii = ii+1
- i2 = a.indexes[ii]
- print(i2)
- ii = ii+1
- print("ii", ii)
- i3 = a.indexes[ii]
- print(i3)
- #ii = ii+1
- ii = ii+1
- print("AddTriangle %i - %i %i %i" % (ind, i1, i2, i3))
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_test0.py
-# Module : SMESH
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# ---- add first face of box in study
-
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-name = geompy.SubShapeName(face, box)
-print(name)
-idface = geompy.addToStudyInFather(box, face, name)
-
-# ---- add shell from box in study
-
-subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-print(name)
-idshell = geompy.addToStudyInFather(box, shell, name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
-edge = edgeList[0]
-name = geompy.SubShapeName(edge, face)
-print(name)
-idedge = geompy.addToStudyInFather(face, edge, name)
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_test1.py
-# Module : SMESH
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# ---- add first face of box in study
-
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-name = geompy.SubShapeName(face, box)
-print(name)
-idface = geompy.addToStudyInFather(box, face, name)
-
-# ---- add shell from box in study
-
-subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-print(name)
-idshell = geompy.addToStudyInFather(box, shell, name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
-edge = edgeList[0]
-name = geompy.SubShapeName(edge, face)
-print(name)
-idedge = geompy.addToStudyInFather(face, edge, name)
-
-
-# ---- SMESH
-
-# ---- Init a Mesh with the box
-
-mesh = smesh.Mesh(box, "Meshbox")
-
-print("-------------------------- add hypothesis to box")
-algoReg1 = mesh.Segment()
-hypNbSeg1 = algoReg1.NumberOfSegments(7)
-print(hypNbSeg1.GetName())
-print(hypNbSeg1.GetId())
-print(hypNbSeg1.GetNumberOfSegments())
-smesh.SetName(hypNbSeg1, "NumberOfSegments_7")
-
-algoMef1 = mesh.Triangle()
-hypArea1 = algoMef1.MaxElementArea(2500)
-print(hypArea1.GetName())
-print(hypArea1.GetId())
-print(hypArea1.GetMaxElementArea())
-smesh.SetName(hypArea1, "MaxElementArea_2500")
-
-# ---- add hypothesis to edge
-print("-------------------------- add hypothesis to edge")
-edge = salome.IDToObject(idedge)
-
-algoReg2 = mesh.Segment(edge)
-hypLen1 = algoReg2.LocalLength(100)
-smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge")
-print(hypLen1.GetName())
-print(hypLen1.GetId())
-print(hypLen1.GetLength())
-smesh.SetName(hypLen1, "Local_Length_100")
-
-# ---- add hypothesis to face
-print("-------------------------- add hypothesis to face")
-face = salome.IDToObject(idface)
-
-algoMef2 = mesh.Triangle(face)
-hypArea2 = algoMef2.MaxElementArea(500)
-smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace")
-print(hypArea2.GetName())
-print(hypArea2.GetId())
-print(hypArea2.GetMaxElementArea())
-smesh.SetName(hypArea2, "MaxElementArea_500")
-
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_test1.py
-# Module : SMESH
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# ---- define a box
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-# ---- add first face of box in study
-
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-name = geompy.SubShapeName(face, box)
-print(name)
-idface = geompy.addToStudyInFather(box, face, name)
-
-# ---- add shell from box in study
-
-subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
-shell = subShellList[0]
-name = geompy.SubShapeName(shell, box)
-print(name)
-idshell = geompy.addToStudyInFather(box, shell, name)
-
-# ---- add first edge of face in study
-
-edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
-edge = edgeList[0]
-name = geompy.SubShapeName(edge, face)
-print(name)
-idedge = geompy.addToStudyInFather(face, edge, name)
-
-
-# ---- SMESH
-
-# ---- Init a Mesh with the box
-
-mesh = smesh.Mesh(box, "Meshbox")
-
-print("-------------------------- add hypothesis to box")
-algoReg1 = mesh.Segment()
-hypNbSeg1 = algoReg1.NumberOfSegments(7)
-print(hypNbSeg1.GetName())
-print(hypNbSeg1.GetId())
-print(hypNbSeg1.GetNumberOfSegments())
-smesh.SetName(hypNbSeg1, "NumberOfSegments_7")
-
-algoMef1 = mesh.Triangle()
-hypArea1 = algoMef1.MaxElementArea(2500)
-print(hypArea1.GetName())
-print(hypArea1.GetId())
-print(hypArea1.GetMaxElementArea())
-smesh.SetName(hypArea1, "MaxElementArea_2500")
-
-# ---- add hypothesis to edge
-print("-------------------------- add hypothesis to edge")
-edge = salome.IDToObject(idedge)
-
-algoReg2 = mesh.Segment(edge)
-hypLen1 = algoReg2.LocalLength(100)
-smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge")
-print(hypLen1.GetName())
-print(hypLen1.GetId())
-print(hypLen1.GetLength())
-smesh.SetName(hypLen1, "Local_Length_100")
-
-# ---- add hypothesis to face
-print("-------------------------- add hypothesis to face")
-face = salome.IDToObject(idface)
-
-algoMef2 = mesh.Triangle(face)
-hypArea2 = algoMef2.MaxElementArea(500)
-smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace")
-print(hypArea2.GetName())
-print(hypArea2.GetId())
-print(hypArea2.GetMaxElementArea())
-smesh.SetName(hypArea2, "MaxElementArea_500")
-
-mesh.Compute()
-
-salome.sg.updateObjBrowser()
-
-sg = salome.ImportComponentGUI('SMESH')
-if not isinstance(sg, type(salome.salome_ComponentGUI)):
- sg.CreateAndDisplayActor('0:1:2:3')
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_test2.py
-# Module : SMESH
-#
-from SMESH_test1 import *
-
-# ---- compute box
-
-print("-------------------------- compute box")
-ret = mesh.Compute()
-print(ret)
-log = mesh.GetLog(0); # no erase trace
-# for linelog in log:
-# print(linelog)
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_test3.py
-# Module : SMESH
-#import salome
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-import math
-
-pi = math.pi
-
-# ---------------------------------------------
-xa = math.sin(pi/12)
-ya = 0
-za = math.cos(pi/12)
-
-xb = 0
-yb = math.sin(pi/18)
-zb = math.cos(pi/18)
-
-xc = math.cos(-pi/18)
-yc = 0
-zc = math.sin(-pi/18)
-
-rc1 = 150
-rc2 = 150
-rc3 = 150
-rc4 = 300
-
-hc1 = 300
-hc2 = 2*hc1
-hc3 = 2*hc1
-hc4 = 2*hc1
-
-# ---------------------------------------------
-point_0 = geompy.MakeVertex(0, 0, 0)
-point_z = geompy.MakeVertex(0, 0, 1)
-
-point_a = geompy.MakeVertex(xa, ya, za)
-point_b = geompy.MakeVertex(xb, yb, zb)
-point_c = geompy.MakeVertex(xc, yc, zc)
-
-dir_z = geompy.MakeVector(point_0, point_z)
-dir_a = geompy.MakeVector(point_0, point_a)
-dir_b = geompy.MakeVector(point_0, point_b)
-dir_c = geompy.MakeVector(point_0, point_c)
-
-axe_z = dir_z
-axe_a = dir_a
-axe_b = dir_b
-axe_c = dir_c
-
-cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1)
-
-cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2)
-cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1)
-
-cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3)
-cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1)
-
-cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4)
-cyl_t = geompy.MakeRotation(cyl_t, axe_c, pi/2)
-cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0)
-cyl_d = geompy.MakeTranslation(cyl_t, -hc1, 0, 1.3*rc4)
-
-inter_t = geompy.MakeBoolean(cyl_c,cyl_d, 1) # common
-
-blob_t = geompy.MakeBoolean(cyl_1, cyl_a, 2) # cut
-blob_t = geompy.MakeBoolean(blob_t, cyl_b, 2)
-
-blob = geompy.MakeBoolean(blob_t, inter_t, 1) # common
-
-idblob = geompy.addToStudy(blob,"blob")
-#idc = geompy.addToStudy(cyl_c,"cyl_c")
-#idd = geompy.addToStudy(cyl_d,"cyl_d")
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-
-# ---- GEOM
-
-box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
-idbox = geompy.addToStudy(box, "box")
-
-subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-face = subShapeList[0]
-name = geompy.SubShapeName(face, box)
-idface = geompy.addToStudyInFather(box, face, name)
-
-box = salome.IDToObject(idbox)
-face = salome.IDToObject(idface)
-
-# ---- SMESH
-
-smesh.UpdateStudy()
-mesh = smesh.Mesh(box, "Meshbox")
-
-# Set 1D algorithm/hypotheses to mesh
-algo1 = mesh.Segment()
-algo1.NumberOfSegments(10)
-
-# Set 2D algorithm/hypotheses to mesh
-algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
-algo2.MaxElementArea(10)
-
-# Create submesh on face
-algo3 = mesh.Segment(face)
-algo3.NumberOfSegments(10)
-algo4 = mesh.Triangle(smeshBuilder.MEFISTO, face)
-algo4.MaxElementArea(100)
-submesh = algo4.GetSubMesh()
-smesh.SetName(submesh, "SubMeshFace")
-
-
-mesh.Compute()
-
-faces = submesh.GetElementsByType(SMESH.FACE)
-if len(faces) > 1:
- print(len(faces), len(faces)/2)
- group1 = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces")
- group2 = mesh.CreateEmptyGroup(SMESH.FACE,"Another group of faces")
- group1.Add(faces[:int(len(faces)/2)])
- group2.Add(faces[int(len(faces)/2):])
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# File : SMESH_test5.py
-# Module : SMESH
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import CORBA
-import os
-import os.path
-
-def SetSObjName(theSObj,theName) :
- ok, anAttr = theSObj.FindAttribute("AttributeName")
- if ok:
- aName = anAttr._narrow(SALOMEDS.AttributeName)
- #print aName.__dict__
- aName.SetValue(theName)
-
-def ConvertMED2UNV(thePath,theFile) :
- anInitFileName = thePath + theFile
- aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName)
- print(aResult, aMeshes)
-
- for iMesh in range(len(aMeshes)) :
- aMesh = aMeshes[iMesh]
- print(aMesh.GetName(), end=' ')
- aFileName = anInitFileName
- aFileName = os.path.basename(aFileName)
- aMesh.SetName(aFileName)
- print(aMesh.GetName())
-
- aOutPath = '/tmp/'
- aFileName = aOutPath + theFile + "." + str(iMesh) + ".unv"
- aMesh.ExportUNV(aFileName)
- aMesh = smesh.CreateMeshesFromUNV(aFileName)
- print(aMesh.GetName(), end=' ')
- os.remove(aFileName)
- aFileName = os.path.basename(aFileName)
- aMesh.SetName(aFileName)
- print(aMesh.GetName())
-
-aPath = os.getenv('DATA_DIR') + '/MedFiles/'
-aListDir = os.listdir(aPath)
-print(aListDir)
-
-for iFile in range(len(aListDir)) :
- aFileName = aListDir[iFile]
- aName,anExt = os.path.splitext(aFileName)
- if anExt == ".med" :
- aFileName = os.path.basename(aFileName)
- print(aFileName)
- ConvertMED2UNV(aPath,aFileName)
- #break
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-#!/usr/bin/env python3
-# Copyright (C) 2018-2021 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
-#
-
-# test used in YACS, ForEachLoop
-
-def geomesh(l0, r0, h0, d0, d1, my_container, direc):
- print("Géometrie et maillage barre : (l0, r0, h0, d0, d1)=", (l0, r0, h0, d0, d1))
-
- import sys
- import salome
- salome.salome_init()
- import GEOM
- from salome.geom import geomBuilder
- import math
- import os
- import SALOMEDS
- import SMESH
- from salome.smesh import smeshBuilder
-
- my_container.load_component_Library("GEOM")
- #engineGeom = my_container.create_component_instance("GEOM")
- engineGeom = my_container.load_impl("GEOM","")
- geompy = geomBuilder.New(engineGeom)
- my_container.load_component_Library("SMESH")
- #engineSmesh = my_container.create_component_instance("SMESH")
- engineSmesh = my_container.load_impl("SMESH","")
- smesh = smeshBuilder.New(engineSmesh,engineGeom)
- print("instances Names:", engineGeom.instanceName, engineSmesh.instanceName)
- print("instances:", engineGeom, engineSmesh)
- print("builders:", geompy, smesh)
-
- volume = (2.*l0*r0 + 0.75*math.pi*r0*r0)*h0
- 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(-l0, -r0, 0)
- Vertex_2 = geompy.MakeVertex(-l0-r0, 0, 0)
- Vertex_3 = geompy.MakeVertex(-l0, r0, 0)
- Vertex_4 = geompy.MakeVertex(l0, r0, 0)
- Vertex_5 = geompy.MakeVertex(l0+r0, 0, 0)
- Vertex_6 = geompy.MakeVertex(l0, -r0, 0)
- Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
- Arc_2 = geompy.MakeArc(Vertex_4, Vertex_5, Vertex_6)
- Line_1 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
- Line_2 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_1)
- Face_1 = geompy.MakeFaceWires([Arc_1, Arc_2, Line_1, Line_2], 1)
- barre0 = geompy.MakePrismVecH(Face_1, OZ, h0)
- Vertex_1a = geompy.MakeVertex(-l0, -r0/2, 0)
- Vertex_2a = geompy.MakeVertex(-l0-r0/2, 0, 0)
- Vertex_3a = geompy.MakeVertex(-l0, r0/2, 0)
- Vertex_4a = geompy.MakeVertex(l0, r0/2, 0)
- Vertex_5a = geompy.MakeVertex(l0+r0/2, 0, 0)
- Vertex_6a = geompy.MakeVertex(l0, -r0/2, 0)
- Arc_1a = geompy.MakeArc(Vertex_1a, Vertex_2a, Vertex_3a)
- Arc_2a = geompy.MakeArc(Vertex_4a, Vertex_5a, Vertex_6a)
- Line_1a = geompy.MakeLineTwoPnt(Vertex_3a, Vertex_4a)
- Line_2a = geompy.MakeLineTwoPnt(Vertex_6a, Vertex_1a)
- Face_1a = geompy.MakeFaceWires([Arc_1a, Arc_2a, Line_1a, Line_2a], 1)
- barrea = geompy.MakePrismVecH(Face_1a, OZ, h0)
- barreb = geompy.MakeCut(barre0, barrea)
- Plane_1 = geompy.MakePlane(Vertex_1, OX, 2000)
- Plane_2 = geompy.MakePlane(Vertex_6, OX, 2000)
- barre = geompy.MakePartition([barreb], [Plane_1, Plane_2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
- v1 = geompy.MakeVertex(-l0-r0, 0, h0/2.)
- v2 = geompy.MakeVertex(l0+r0, 0, h0/2.)
- f1 = geompy.GetShapesNearPoint(barre, v1, geompy.ShapeType["FACE"])
- f2 = geompy.GetShapesNearPoint(barre, v2, geompy.ShapeType["FACE"])
- #f1 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
- #geompy.UnionIDs(f1, [3])
- #f2 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
- #geompy.UnionIDs(f2, [20])
-
- Auto_group_for_Sub_mesh_1 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
- geompy.UnionList(Auto_group_for_Sub_mesh_1, [f1, f2])
- nom = r'barre_l_{:03d}__r_{:05.2f}__h_{:05.2f}__d0_{:05.2f}__d1_{:05.2f}'.format(int(l0), r0, h0, d0, d1)
- nombrep = nom + ".brep"
- geompy.ExportBREP(barre, direc + os.sep + nombrep )
- props = geompy.BasicProperties(barre)
- geomvol = props[2]
-
- #geompy.addToStudy( barre, 'barre' )
- #geompy.addToStudyInFather( barre, f1, 'f1' )
- #geompy.addToStudyInFather( barre, f2, 'f2' )
-
- smesh.SetEnablePublish( False )
-
- isTetra = False
- barre_1 = smesh.Mesh(barre)
- # SO = salome.myStudy.FindObjectIOR(salome.myStudy.ConvertObjectToIOR(barre_1.GetMesh()))
- # if SO:
- # print ("_______",SO.GetID(),SO.GetName())
- # else:
- # print ("_______NO_SO!!!")
- if (isTetra):
- NETGEN_1D_2D_3D = barre_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
- NETGEN_3D_Parameters_1 = NETGEN_1D_2D_3D.Parameters()
- NETGEN_3D_Parameters_1.SetMaxSize( d0 )
- NETGEN_3D_Parameters_1.SetSecondOrder( 0 )
- NETGEN_3D_Parameters_1.SetOptimize( 1 )
- NETGEN_3D_Parameters_1.SetFineness( 3 )
- NETGEN_3D_Parameters_1.SetChordalError( 0.1 )
- NETGEN_3D_Parameters_1.SetChordalErrorEnabled( 0 )
- NETGEN_3D_Parameters_1.SetMinSize( d0 )
- NETGEN_3D_Parameters_1.SetUseSurfaceCurvature( 1 )
- NETGEN_3D_Parameters_1.SetFuseEdges( 1 )
- NETGEN_3D_Parameters_1.SetQuadAllowed( 0 )
- NETGEN_1D_2D = barre_1.Triangle(algo=smeshBuilder.NETGEN_1D2D,geom=Auto_group_for_Sub_mesh_1)
- NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
- NETGEN_2D_Parameters_1.SetMaxSize( d1 )
- NETGEN_2D_Parameters_1.SetSecondOrder( 0 )
- NETGEN_2D_Parameters_1.SetOptimize( 1 )
- NETGEN_2D_Parameters_1.SetFineness( 3 )
- NETGEN_2D_Parameters_1.SetChordalError( 0.1 )
- NETGEN_2D_Parameters_1.SetChordalErrorEnabled( 0 )
- NETGEN_2D_Parameters_1.SetMinSize( d1 )
- NETGEN_2D_Parameters_1.SetUseSurfaceCurvature( 1 )
- NETGEN_2D_Parameters_1.SetFuseEdges( 1 )
- NETGEN_2D_Parameters_1.SetQuadAllowed( 0 )
- else:
- Regular_1D = barre_1.Segment()
- Number_of_Segments_1 = Regular_1D.NumberOfSegments(15)
- Quadrangle_2D = barre_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
- Hexa_3D = barre_1.Hexahedron(algo=smeshBuilder.Hexa)
- isDone = barre_1.Compute()
-
- f1_1 = barre_1.GroupOnGeom(f1,'f1',SMESH.FACE)
- f2_1 = barre_1.GroupOnGeom(f2,'f2',SMESH.FACE)
- smesh.SetName(barre_1, nom)
- nommed = nom + ".med"
- barre_1.ExportMED( direc + os.sep + nommed, auto_groups=0, minor=0, overwrite=1, meshPart=None, autoDimension=1 )
- measure = smesh.CreateMeasurements()
- meshvol = measure.Volume(barre_1.mesh)
- print("Maillage publié : ", direc + os.sep + nommed)
- clearMesh(barre_1, salome.myStudy, nom)
- deltag = abs(geomvol - volume)/volume
- deltam = abs(meshvol - geomvol)/geomvol
- delta = abs(meshvol - volume)/volume
- print("volumes:", volume, geomvol, meshvol, deltag, deltam)
- assert(deltag < 1.e-5)
- assert(deltam < 2.e-3)
- #import time
- #time.sleep(30)
- return delta
-
-
-def clearMesh(theMesh, theStudy, aName):
- theMesh.Clear()
- aMesh = theMesh.GetMesh()
- aMesh.UnRegister()
- # aStudyBuilder = theStudy.NewBuilder()
- # SO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(aMesh))
- # objects_to_unpublish = [SO]
- # refs = theStudy.FindDependances(SO)
- # objects_to_unpublish += refs
- # for o in objects_to_unpublish:
- # if o is not None:
- # aStudyBuilder.RemoveObjectWithChildren(o)
- print("clearMesh done:", aName)
-
-def genere(r0, h0, my_container, direc):
- l0 = 50.0
- d0 = min(r0/2., h0/6.)
- d1 = d0/2.
- res = geomesh(l0, r0, h0, d0, d1, my_container, direc)
- return res
-
-def genere2(r0h0, my_container, direc):
- l0 = 50.0
- r0 = r0h0[0]
- h0 = r0h0[1]
- d0 = min(r0/2., h0/6.)
- d1 = d0/2.
- res = geomesh(l0, r0, h0, d0, d1, my_container, direc)
- return res
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# ==================================
-# Load all examples
-# -----------------
-#
-import ex01_cube2build
-import ex02_cube2primitive
-import ex03_cube2partition
-import ex04_cube5tetraHexa
-import ex05_hole1build
-import ex06_hole1boolean
-import ex07_hole1partition
-import ex08_hole2build
-import ex09_grid4build
-import ex10_grid4geometry
-import ex11_grid3partition
-import ex12_grid17partition
-import ex13_hole1partial
-import ex14_cyl1holed
-import ex15_cyl2geometry
-import ex16_cyl2complementary
-import ex17_dome1
-import ex18_dome2
-import ex19_sphereINcube
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# A small cube centered and put on a great cube build by points, edges, faces and solids
-
-# Points
-# ------
-
-greatPoint111 = geompy.MakeVertex( 0, 0, 0)
-greatPoint211 = geompy.MakeVertex(10, 0, 0)
-greatPoint311 = geompy.MakeVertex(20, 0, 0)
-greatPoint411 = geompy.MakeVertex(30, 0, 0)
-
-greatPoint121 = geompy.MakeVertex( 0, 10, 0)
-greatPoint221 = geompy.MakeVertex(10, 10, 0)
-greatPoint321 = geompy.MakeVertex(20, 10, 0)
-greatPoint421 = geompy.MakeVertex(30, 10, 0)
-
-greatPoint112 = geompy.MakeVertex( 0, 0, 10)
-greatPoint212 = geompy.MakeVertex(10, 0, 10)
-greatPoint312 = geompy.MakeVertex(20, 0, 10)
-greatPoint412 = geompy.MakeVertex(30, 0, 10)
-
-greatPoint122 = geompy.MakeVertex( 0, 10, 10)
-greatPoint222 = geompy.MakeVertex(10, 10, 10)
-greatPoint322 = geompy.MakeVertex(20, 10, 10)
-greatPoint422 = geompy.MakeVertex(30, 10, 10)
-
-greatPoint113 = geompy.MakeVertex( 0, 0, 20)
-greatPoint213 = geompy.MakeVertex(10, 0, 20)
-greatPoint313 = geompy.MakeVertex(20, 0, 20)
-greatPoint413 = geompy.MakeVertex(30, 0, 20)
-
-greatPoint123 = geompy.MakeVertex( 0, 10, 20)
-greatPoint223 = geompy.MakeVertex(10, 10, 20)
-greatPoint323 = geompy.MakeVertex(20, 10, 20)
-greatPoint423 = geompy.MakeVertex(30, 10, 20)
-
-greatPoint114 = geompy.MakeVertex( 0, 0, 30)
-greatPoint214 = geompy.MakeVertex(10, 0, 30)
-greatPoint314 = geompy.MakeVertex(20, 0, 30)
-greatPoint414 = geompy.MakeVertex(30, 0, 30)
-
-greatPoint124 = geompy.MakeVertex( 0, 10, 30)
-greatPoint224 = geompy.MakeVertex(10, 10, 30)
-greatPoint324 = geompy.MakeVertex(20, 10, 30)
-greatPoint424 = geompy.MakeVertex(30, 10, 30)
-
-
-smallPoint111 = greatPoint222
-smallPoint211 = greatPoint322
-smallPoint121 = geompy.MakeVertex(10, 20, 10)
-smallPoint221 = geompy.MakeVertex(20, 20, 10)
-
-smallPoint112 = greatPoint223
-smallPoint212 = greatPoint323
-smallPoint122 = geompy.MakeVertex(10, 20, 20)
-smallPoint222 = geompy.MakeVertex(20, 20, 20)
-
-# Edges
-# -----
-
-smallEdgeX11 = geompy.MakeEdge(smallPoint111, smallPoint211)
-smallEdgeX21 = geompy.MakeEdge(smallPoint121, smallPoint221)
-smallEdgeX12 = geompy.MakeEdge(smallPoint112, smallPoint212)
-smallEdgeX22 = geompy.MakeEdge(smallPoint122, smallPoint222)
-
-smallEdgeY11 = geompy.MakeEdge(smallPoint111, smallPoint121)
-smallEdgeY21 = geompy.MakeEdge(smallPoint211, smallPoint221)
-smallEdgeY12 = geompy.MakeEdge(smallPoint112, smallPoint122)
-smallEdgeY22 = geompy.MakeEdge(smallPoint212, smallPoint222)
-
-smallEdgeZ11 = geompy.MakeEdge(smallPoint111, smallPoint112)
-smallEdgeZ21 = geompy.MakeEdge(smallPoint211, smallPoint212)
-smallEdgeZ12 = geompy.MakeEdge(smallPoint121, smallPoint122)
-smallEdgeZ22 = geompy.MakeEdge(smallPoint221, smallPoint222)
-
-
-greatEdgeX111 = geompy.MakeEdge(greatPoint111, greatPoint211)
-greatEdgeX211 = geompy.MakeEdge(greatPoint211, greatPoint311)
-greatEdgeX311 = geompy.MakeEdge(greatPoint311, greatPoint411)
-greatEdgeX121 = geompy.MakeEdge(greatPoint121, greatPoint221)
-greatEdgeX221 = geompy.MakeEdge(greatPoint221, greatPoint321)
-greatEdgeX321 = geompy.MakeEdge(greatPoint321, greatPoint421)
-
-greatEdgeX112 = geompy.MakeEdge(greatPoint112, greatPoint212)
-greatEdgeX212 = geompy.MakeEdge(greatPoint212, greatPoint312)
-greatEdgeX312 = geompy.MakeEdge(greatPoint312, greatPoint412)
-greatEdgeX122 = geompy.MakeEdge(greatPoint122, greatPoint222)
-greatEdgeX222 = smallEdgeX11
-greatEdgeX322 = geompy.MakeEdge(greatPoint322, greatPoint422)
-
-greatEdgeX113 = geompy.MakeEdge(greatPoint113, greatPoint213)
-greatEdgeX213 = geompy.MakeEdge(greatPoint213, greatPoint313)
-greatEdgeX313 = geompy.MakeEdge(greatPoint313, greatPoint413)
-greatEdgeX123 = geompy.MakeEdge(greatPoint123, greatPoint223)
-greatEdgeX223 = smallEdgeX12
-greatEdgeX323 = geompy.MakeEdge(greatPoint323, greatPoint423)
-
-greatEdgeX114 = geompy.MakeEdge(greatPoint114, greatPoint214)
-greatEdgeX214 = geompy.MakeEdge(greatPoint214, greatPoint314)
-greatEdgeX314 = geompy.MakeEdge(greatPoint314, greatPoint414)
-greatEdgeX124 = geompy.MakeEdge(greatPoint124, greatPoint224)
-greatEdgeX224 = geompy.MakeEdge(greatPoint224, greatPoint324)
-greatEdgeX324 = geompy.MakeEdge(greatPoint324, greatPoint424)
-
-greatEdgeY11 = geompy.MakeEdge(greatPoint111, greatPoint121)
-greatEdgeY21 = geompy.MakeEdge(greatPoint211, greatPoint221)
-greatEdgeY31 = geompy.MakeEdge(greatPoint311, greatPoint321)
-greatEdgeY41 = geompy.MakeEdge(greatPoint411, greatPoint421)
-
-greatEdgeY12 = geompy.MakeEdge(greatPoint112, greatPoint122)
-greatEdgeY22 = geompy.MakeEdge(greatPoint212, greatPoint222)
-greatEdgeY32 = geompy.MakeEdge(greatPoint312, greatPoint322)
-greatEdgeY42 = geompy.MakeEdge(greatPoint412, greatPoint422)
-
-greatEdgeY13 = geompy.MakeEdge(greatPoint113, greatPoint123)
-greatEdgeY23 = geompy.MakeEdge(greatPoint213, greatPoint223)
-greatEdgeY33 = geompy.MakeEdge(greatPoint313, greatPoint323)
-greatEdgeY43 = geompy.MakeEdge(greatPoint413, greatPoint423)
-
-greatEdgeY14 = geompy.MakeEdge(greatPoint114, greatPoint124)
-greatEdgeY24 = geompy.MakeEdge(greatPoint214, greatPoint224)
-greatEdgeY34 = geompy.MakeEdge(greatPoint314, greatPoint324)
-greatEdgeY44 = geompy.MakeEdge(greatPoint414, greatPoint424)
-
-greatEdgeZ111 = geompy.MakeEdge(greatPoint111, greatPoint112)
-greatEdgeZ211 = geompy.MakeEdge(greatPoint211, greatPoint212)
-greatEdgeZ311 = geompy.MakeEdge(greatPoint311, greatPoint312)
-greatEdgeZ411 = geompy.MakeEdge(greatPoint411, greatPoint412)
-
-greatEdgeZ121 = geompy.MakeEdge(greatPoint121, greatPoint122)
-greatEdgeZ221 = geompy.MakeEdge(greatPoint221, greatPoint222)
-greatEdgeZ321 = geompy.MakeEdge(greatPoint321, greatPoint322)
-greatEdgeZ421 = geompy.MakeEdge(greatPoint421, greatPoint422)
-
-greatEdgeZ112 = geompy.MakeEdge(greatPoint112, greatPoint113)
-greatEdgeZ212 = geompy.MakeEdge(greatPoint212, greatPoint213)
-greatEdgeZ312 = geompy.MakeEdge(greatPoint312, greatPoint313)
-greatEdgeZ412 = geompy.MakeEdge(greatPoint412, greatPoint413)
-
-greatEdgeZ122 = geompy.MakeEdge(greatPoint122, greatPoint123)
-greatEdgeZ222 = smallEdgeZ11
-greatEdgeZ322 = smallEdgeZ21
-greatEdgeZ422 = geompy.MakeEdge(greatPoint422, greatPoint423)
-
-greatEdgeZ113 = geompy.MakeEdge(greatPoint113, greatPoint114)
-greatEdgeZ213 = geompy.MakeEdge(greatPoint213, greatPoint214)
-greatEdgeZ313 = geompy.MakeEdge(greatPoint313, greatPoint314)
-greatEdgeZ413 = geompy.MakeEdge(greatPoint413, greatPoint414)
-
-greatEdgeZ123 = geompy.MakeEdge(greatPoint123, greatPoint124)
-greatEdgeZ223 = geompy.MakeEdge(greatPoint223, greatPoint224)
-greatEdgeZ323 = geompy.MakeEdge(greatPoint323, greatPoint324)
-greatEdgeZ423 = geompy.MakeEdge(greatPoint423, greatPoint424)
-
-# Faces
-# -----
-
-smallFaceX1 = geompy.MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12)
-smallFaceX2 = geompy.MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22)
-smallFaceY1 = geompy.MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21)
-smallFaceY2 = geompy.MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22)
-smallFaceZ1 = geompy.MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21)
-smallFaceZ2 = geompy.MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22)
-
-
-greatFaceX11 = geompy.MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121)
-greatFaceX21 = geompy.MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221)
-greatFaceX31 = geompy.MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321)
-greatFaceX41 = geompy.MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421)
-
-greatFaceX12 = geompy.MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122)
-greatFaceX22 = geompy.MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222)
-greatFaceX32 = geompy.MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322)
-greatFaceX42 = geompy.MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422)
-
-greatFaceX13 = geompy.MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123)
-greatFaceX23 = geompy.MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223)
-greatFaceX33 = geompy.MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323)
-greatFaceX43 = geompy.MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423)
-
-greatFaceY111 = geompy.MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211)
-greatFaceY211 = geompy.MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311)
-greatFaceY311 = geompy.MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411)
-greatFaceY121 = geompy.MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221)
-greatFaceY221 = geompy.MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321)
-greatFaceY321 = geompy.MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421)
-
-greatFaceY112 = geompy.MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212)
-greatFaceY212 = geompy.MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312)
-greatFaceY312 = geompy.MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412)
-greatFaceY122 = geompy.MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222)
-greatFaceY222 = smallFaceY1
-greatFaceY322 = geompy.MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422)
-
-greatFaceY113 = geompy.MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213)
-greatFaceY213 = geompy.MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313)
-greatFaceY313 = geompy.MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413)
-greatFaceY123 = geompy.MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223)
-greatFaceY223 = geompy.MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323)
-greatFaceY323 = geompy.MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423)
-
-greatFaceZ11 = geompy.MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21)
-greatFaceZ21 = geompy.MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31)
-greatFaceZ31 = geompy.MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41)
-
-greatFaceZ12 = geompy.MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22)
-greatFaceZ22 = geompy.MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32)
-greatFaceZ32 = geompy.MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42)
-
-greatFaceZ13 = geompy.MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23)
-greatFaceZ23 = geompy.MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33)
-greatFaceZ33 = geompy.MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43)
-
-greatFaceZ14 = geompy.MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24)
-greatFaceZ24 = geompy.MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34)
-greatFaceZ34 = geompy.MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44)
-
-# Solids
-# ------
-
-smallBlock = geompy.MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2)
-
-greatBlock11 = geompy.MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12)
-greatBlock21 = geompy.MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22)
-greatBlock31 = geompy.MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32)
-
-greatBlock12 = geompy.MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13)
-greatBlock22 = geompy.MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23)
-greatBlock32 = geompy.MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33)
-
-greatBlock13 = geompy.MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14)
-greatBlock23 = geompy.MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24)
-greatBlock33 = geompy.MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34)
-
-# Compound
-# --------
-
-c_l = []
-c_l.append(smallBlock)
-c_l.append(greatBlock11)
-c_l.append(greatBlock21)
-c_l.append(greatBlock31)
-c_l.append(greatBlock12)
-c_l.append(greatBlock22)
-c_l.append(greatBlock32)
-c_l.append(greatBlock13)
-c_l.append(greatBlock23)
-c_l.append(greatBlock33)
-
-piece = geompy.MakeCompound(c_l)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex01_cube2build")
-
-# Meshing
-# =======
-
-# Create hexahedrical mesh on piece
-# ---------------------------------
-
-hexa = smesh.Mesh(piece, "ex01_cube2build:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(4)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Create local hypothesis
-# -----------------------
-
-algo = hexa.Segment(greatEdgeX111)
-
-algo.Arithmetic1D(1, 4)
-
-algo.Propagation()
-
-# Compute the mesh
-# ----------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# A small cube centered and put on a great cube build by primitive geometric functionalities
-
-# Values
-# ------
-
-ox = 0
-oy = 0
-oz = 0
-
-arete = 10
-
-# Points
-# ------
-
-blockPoint111 = geompy.MakeVertex(ox , oy, oz)
-blockPoint211 = geompy.MakeVertex(ox+arete, oy, oz)
-blockPoint112 = geompy.MakeVertex(ox , oy, oz+arete)
-blockPoint212 = geompy.MakeVertex(ox+arete, oy, oz+arete)
-
-# Face and solid
-# --------------
-
-blockFace1 = geompy.MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112)
-
-blockSolid11 = geompy.MakePrismVecH(blockFace1, geompy.MakeVectorDXDYDZ(0, 1, 0), arete)
-
-# Translations
-# ------------
-
-blockSolid21 = geompy.MakeTranslation(blockSolid11, arete, 0, 0)
-blockSolid31 = geompy.MakeTranslation(blockSolid21, arete, 0, 0)
-
-blockSolid12 = geompy.MakeTranslation(blockSolid11, 0, 0, arete)
-blockSolid22 = geompy.MakeTranslation(blockSolid12, arete, 0, 0)
-blockSolid32 = geompy.MakeTranslation(blockSolid22, arete, 0, 0)
-
-blockSolid13 = geompy.MakeTranslation(blockSolid12, 0, 0, arete)
-blockSolid23 = geompy.MakeTranslation(blockSolid13, arete, 0, 0)
-blockSolid33 = geompy.MakeTranslation(blockSolid23, arete, 0, 0)
-
-blockSolid111 = geompy.MakeTranslation(blockSolid22, 0, arete, 0)
-
-# Compound and glue
-# -----------------
-
-c_l = []
-c_l.append(blockSolid11)
-c_l.append(blockSolid21)
-c_l.append(blockSolid31)
-c_l.append(blockSolid12)
-c_l.append(blockSolid22)
-c_l.append(blockSolid32)
-c_l.append(blockSolid13)
-c_l.append(blockSolid23)
-c_l.append(blockSolid33)
-c_l.append(blockSolid111)
-
-c_cpd = geompy.MakeCompound(c_l)
-
-piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex02_cube2primitive")
-
-# Meshing
-# =======
-
-# Create hexahedrical mesh on piece
-# ---------------------------------
-
-hexa = smesh.Mesh(piece, "ex02_cube2primitive:hexa")
-
-algo = hexa.Segment()
-algo.LocalLength(1)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Compute the mesh
-# ----------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# A small cube centered and put on a great cube build with partition
-
-# Values
-# ------
-
-g_ox = 0
-g_oy = 0
-g_oz = 0
-
-g_arete = 10
-
-g_trim = 1000
-
-# Points
-# ------
-
-v_arete2 = g_arete*2
-v_arete3 = g_arete*3
-
-v_1 = geompy.MakeVertex(g_ox , g_oy , g_oz )
-v_2 = geompy.MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
-
-v_3 = geompy.MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
-v_4 = geompy.MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
-
-# Solids
-# ------
-
-s_base = geompy.MakeBoxTwoPnt(v_1, v_2)
-s_haut = geompy.MakeBoxTwoPnt(v_3, v_4)
-
-# Partition
-# ---------
-
-p_dir1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
-p_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1)
-p_dir3 = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-p_tools = []
-
-p_tools.append(geompy.MakePlane(v_3, p_dir1, g_trim))
-p_tools.append(geompy.MakePlane(v_4, p_dir1, g_trim))
-p_tools.append(geompy.MakePlane(v_3, p_dir2, g_trim))
-p_tools.append(geompy.MakePlane(v_4, p_dir2, g_trim))
-p_tools.append(geompy.MakePlane(v_3, p_dir3, g_trim))
-
-piece = geompy.MakePartition([s_base, s_haut], p_tools, [], [], geompy.ShapeType["SOLID"])
-
-# Study
-# -----
-
-piece_id = geompy.addToStudy(piece, "ex03_cube2partition")
-
-# Meshing
-# =======
-
-# Create hexahedrical mesh on piece
-# ---------------------------------
-
-hexa = smesh.Mesh(piece, "ex03_cube2partition:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(5)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Compute the mesh
-# ----------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# 5 box with a hexahedral mesh and with 2 box in tetrahedral mesh
-
-# Values
-# ------
-
-arete = 100
-
-arete0 = 0
-arete1 = arete
-arete2 = arete*2
-arete3 = arete*3
-
-# Solids
-# ------
-
-box_tetra1 = geompy.MakeBox(arete0, arete0, 0, arete1, arete1, arete)
-
-box_ijk1 = geompy.MakeBox(arete1, arete0, 0, arete2, arete1, arete)
-
-box_hexa = geompy.MakeBox(arete1, arete1, 0, arete2, arete2, arete)
-
-box_ijk2 = geompy.MakeBox(arete2, arete1, 0, arete3, arete2, arete)
-
-box_tetra2 = geompy.MakeBox(arete2, arete2, 0, arete3 ,arete3, arete)
-
-# Piece
-# -----
-
-piece_cpd = geompy.MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2])
-
-piece = geompy.MakeGlueFaces(piece_cpd, 1e-4)
-
-piece_id = geompy.addToStudy(piece, "ex04_cube5tetraHexa")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-mixed = smesh.Mesh(piece, "ex04_cube5tetraHexa:mixed")
-
-algo = mixed.Segment()
-
-algo.StartEndLength(3, 25)
-
-mixed.Quadrangle()
-
-mixed.Hexahedron()
-
-# Tetrahedral local mesh
-# ----------------------
-
-def localMesh(b, hyp):
- box = geompy.GetInPlace(piece, b)
- faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
-
- i = 0
- n = len(faces)
- while i<n:
- algo = mixed.Triangle(faces[i])
- if hyp:
- algo.MaxElementArea(80)
- else:
- algo.LengthFromEdges()
- i = i + 1
-
- algo = mixed.Tetrahedron(smeshBuilder.NETGEN, box)
- algo.MaxElementVolume(400)
-
-localMesh(box_tetra1, 1)
-localMesh(box_tetra2, 0)
-
-# Mesh calculus
-# -------------
-
-mixed.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-# Geometry
-# ========
-
-# A centered holed cube build by build by points, edges, faces and solids
-
-# Values
-# ------
-
-ox = 0
-oy = 0
-oz = 0
-
-longueur = 100
-largeur = 80
-hauteur = 50
-
-rayon = 10
-
-# Points
-# ------
-
-basePoint111 = geompy.MakeVertex(ox , oy, oz)
-basePoint211 = geompy.MakeVertex(ox+longueur, oy, oz)
-basePoint112 = geompy.MakeVertex(ox , oy, oz+largeur)
-basePoint212 = geompy.MakeVertex(ox+longueur, oy, oz+largeur)
-
-cx = ox+longueur/2
-cy = oy
-cz = oz+largeur/2
-
-ll = longueur/largeur
-ll = ll*ll
-dx = rayon/math.sqrt(1+ll)
-dz = rayon/math.sqrt(1+1/ll)
-
-circlePoint1 = geompy.MakeVertex(cx-dx, cy, cz-dz)
-circlePoint2 = geompy.MakeVertex(cx+dx, cy, cz-dz)
-circlePoint3 = geompy.MakeVertex(cx+dx, cy, cz+dz)
-circlePoint4 = geompy.MakeVertex(cx-dx, cy, cz+dz)
-
-# Edges
-# -----
-
-squareEdge1 = geompy.MakeEdge(basePoint111, basePoint211)
-squareEdge2 = geompy.MakeEdge(basePoint211, basePoint212)
-squareEdge3 = geompy.MakeEdge(basePoint212, basePoint112)
-squareEdge4 = geompy.MakeEdge(basePoint112, basePoint111)
-
-diagEdge1 = geompy.MakeEdge(basePoint111, circlePoint1)
-diagEdge2 = geompy.MakeEdge(basePoint211, circlePoint2)
-diagEdge3 = geompy.MakeEdge(basePoint212, circlePoint3)
-diagEdge4 = geompy.MakeEdge(basePoint112, circlePoint4)
-
-arcEdge1 = geompy.MakeArc(circlePoint1, geompy.MakeVertex(cx , cy, cz-rayon), circlePoint2)
-arcEdge2 = geompy.MakeArc(circlePoint2, geompy.MakeVertex(cx+rayon, cy, cz ), circlePoint3)
-arcEdge3 = geompy.MakeArc(circlePoint3, geompy.MakeVertex(cx , cy, cz+rayon), circlePoint4)
-arcEdge4 = geompy.MakeArc(circlePoint4, geompy.MakeVertex(cx-rayon, cy, cz ), circlePoint1)
-
-# Faces
-# -----
-
-baseFace1 = geompy.MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1)
-baseFace2 = geompy.MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2)
-baseFace3 = geompy.MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3)
-baseFace4 = geompy.MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4)
-
-# Solids
-# ------
-
-baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur)
-baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur)
-baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur)
-baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur)
-
-# Compound
-# --------
-
-c_l = []
-c_l.append(baseSolid1)
-c_l.append(baseSolid2)
-c_l.append(baseSolid3)
-c_l.append(baseSolid4)
-
-c_cpd = geompy.MakeCompound(c_l)
-piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex05_hole1build")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex05_hole1build:hexa")
-
-algo = hexa.Segment()
-
-algo.NumberOfSegments(6, 3)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# A not centered holed cube build by boolean geometric operations
-
-# Values
-# ------
-
-ox = 0
-oy = 0
-oz = 0
-
-longueur1 = 30
-longueur2 = 70
-
-largeur1 = 30
-largeur2 = 50
-
-hauteur = 50
-
-rayon = 10
-
-# Triangular face
-# ---------------
-
-def triangle(p1, p2, p3):
- l = []
- l.append(geompy.MakeEdge(p1, p2))
- l.append(geompy.MakeEdge(p2, p3))
- l.append(geompy.MakeEdge(p3, p1))
- w = geompy.MakeWire(l)
- return geompy.MakeFace(w, 1)
-
-# Points
-# ------
-
-basePoint111 = geompy.MakeVertex(ox-longueur1, oy, oz-largeur1)
-basePoint211 = geompy.MakeVertex(ox+longueur2, oy, oz-largeur1)
-basePoint112 = geompy.MakeVertex(ox-longueur1, oy, oz+largeur2)
-basePoint212 = geompy.MakeVertex(ox+longueur2, oy, oz+largeur2)
-
-holePoint = geompy.MakeVertex(ox, oy, oz)
-
-# Faces
-# -----
-
-baseFace1 = triangle(basePoint111, basePoint211, holePoint)
-baseFace2 = triangle(basePoint211, basePoint212, holePoint)
-baseFace3 = triangle(basePoint212, basePoint112, holePoint)
-baseFace4 = triangle(basePoint112, basePoint111, holePoint)
-
-# Solids
-# ------
-
-baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur)
-baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur)
-baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur)
-baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur)
-
-holeSolid = geompy.MakeCylinder(holePoint, baseVector, rayon, hauteur)
-
-# Boolean operations
-# ------------------
-
-baseHexa1 = geompy.MakeCut(baseSolid1, holeSolid)
-baseHexa2 = geompy.MakeCut(baseSolid2, holeSolid)
-baseHexa3 = geompy.MakeCut(baseSolid3, holeSolid)
-baseHexa4 = geompy.MakeCut(baseSolid4, holeSolid)
-
-# Compound, glue and repair
-# -------------------------
-
-c_l = []
-c_l.append(baseHexa1)
-c_l.append(baseHexa2)
-c_l.append(baseHexa3)
-c_l.append(baseHexa4)
-
-c_cpd = geompy.MakeCompound(c_l)
-c_glu = geompy.MakeGlueFaces(c_cpd, 1.e-5)
-piece = geompy.RemoveExtraEdges(c_glu, doUnionFaces=True)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex06_hole1boolean")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex06_hole1boolean:hexa")
-
-algo = hexa.Segment()
-
-algo.NumberOfSegments(11)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Create local hypothesis
-# -----------------------
-
-edge1 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz-largeur1))
-algo1 = hexa.Segment(edge1)
-algo1.NumberOfSegments(3)
-algo1.Propagation()
-
-edge2 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox-longueur1, oy, oz))
-algo2 = hexa.Segment(edge2)
-algo2.NumberOfSegments(5)
-algo2.Propagation()
-
-edge3 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz+largeur2))
-algo3 = hexa.Segment(edge3)
-algo3.NumberOfSegments(7)
-algo3.Propagation()
-
-edge4 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox+longueur2, oy, oz))
-algo4 = hexa.Segment(edge4)
-algo4.NumberOfSegments(9)
-algo4.Propagation()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# A holed cube build by partitioning geometric operations
-
-# Values
-# ------
-
-g_x = 0
-g_y = 0
-g_z = 0
-
-g_longueur = 50.0
-g_largeur = 40.0
-g_hauteur = 25.0
-
-g_rayon = 10
-
-g_trim = 1000
-
-# Box
-# ---
-
-b_boite = geompy.MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur, g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur)
-
-# Cylinder
-# --------
-
-c_axe = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-c_cyl = geompy.MakeCylinder(geompy.MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2)
-
-c_piece = geompy.MakeCut(b_boite, c_cyl)
-
-# Partition and reperation
-# ------------------------
-
-p_centre = geompy.MakeVertex(g_x, g_y, g_z)
-
-p_tools = []
-p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim))
-p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim))
-
-p_part = geompy.MakePartition([c_piece], p_tools, [], [], geompy.ShapeType["SOLID"])
-
-p_blocs = geompy.RemoveExtraEdges(p_part, doUnionFaces=True)
-piece = geompy.MakeGlueFaces(p_blocs, 1.e-5)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex07_hole1partition")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex07_hole1partition:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(20)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# A twice holed cube build by points, edges, faces and solids
-
-# Values
-# ------
-
-ox = 0
-oy = 0
-oz = 0
-
-longueur = 200
-largeur = 100
-hauteur = 80
-
-cylindre = 50
-
-rayon = 20
-
-# Points
-# ------
-
-piecePoint1 = geompy.MakeVertex(ox , oy, oz)
-piecePoint2 = geompy.MakeVertex(ox+longueur, oy, oz)
-piecePoint3 = geompy.MakeVertex(ox+longueur, oy, oz+largeur)
-piecePoint4 = geompy.MakeVertex(ox , oy, oz+largeur)
-
-cz = oz+largeur/2
-
-cylPoint1 = geompy.MakeVertex(ox+cylindre , oy, cz-rayon)
-cylPoint2 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz-rayon)
-cylPoint3 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz+rayon)
-cylPoint4 = geompy.MakeVertex(ox+cylindre , oy, cz+rayon)
-
-# Edges
-# -----
-
-pieceEdge1 = geompy.MakeEdge(piecePoint1, piecePoint4)
-pieceEdge2 = geompy.MakeEdge(piecePoint1, cylPoint1)
-pieceEdge3 = geompy.MakeEdge(piecePoint4, cylPoint4)
-
-pieceEdge4 = geompy.MakeEdge(piecePoint2, piecePoint3)
-pieceEdge5 = geompy.MakeEdge(piecePoint2, cylPoint2)
-pieceEdge6 = geompy.MakeEdge(piecePoint3, cylPoint3)
-
-pieceEdge7 = geompy.MakeEdge(cylPoint1, cylPoint2)
-pieceEdge8 = geompy.MakeEdge(cylPoint3, cylPoint4)
-
-cylEdge1 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4)
-cylEdge2 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4)
-cylEdge3 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3)
-cylEdge4 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3)
-
-# Faces
-# -----
-
-pieceFace1 = geompy.MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 )
-pieceFace2 = geompy.MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3)
-pieceFace3 = geompy.MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 )
-pieceFace4 = geompy.MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6)
-pieceFace5 = geompy.MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 )
-
-# Solids
-# ------
-
-pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur)
-pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur)
-pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur)
-pieceSolid4 = geompy.MakePrismVecH(pieceFace4, pieceVector, hauteur)
-pieceSolid5 = geompy.MakePrismVecH(pieceFace5, pieceVector, hauteur)
-
-# Compound and glue
-# -----------------
-
-c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5])
-
-piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex08_hole2build")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex08_hole2build:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(7)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-# Geometry
-# ========
-
-# Element of a grid compound by a square with a cylinder on each vertex build by points, edges, faces and solids
-
-# Values
-# ------
-
-ox = 0
-oy = 0
-oz = 0
-
-arete = 50
-hauteur = 100
-
-rayon = 10
-
-demi = rayon/2
-r3 = demi*math.sqrt(3)
-
-# Points
-# ------
-
-piecePoint111 = geompy.MakeVertex(ox+rayon , oy, oz)
-piecePoint211 = geompy.MakeVertex(ox+arete-rayon, oy, oz)
-piecePoint112 = geompy.MakeVertex(ox , oy, oz+rayon)
-piecePoint212 = geompy.MakeVertex(ox+arete , oy, oz+rayon)
-piecePoint113 = geompy.MakeVertex(ox , oy, oz+arete-rayon)
-piecePoint213 = geompy.MakeVertex(ox+arete , oy, oz+arete-rayon)
-piecePoint114 = geompy.MakeVertex(ox+rayon , oy, oz+arete)
-piecePoint214 = geompy.MakeVertex(ox+arete-rayon, oy, oz+arete)
-
-pieceCenter1 = geompy.MakeVertex(ox , oy, oz)
-pieceCenter2 = geompy.MakeVertex(ox+arete , oy, oz)
-pieceCenter3 = geompy.MakeVertex(ox , oy, oz+arete)
-pieceCenter4 = geompy.MakeVertex(ox+arete , oy, oz+arete)
-
-piecePass1 = geompy.MakeVertex(ox+demi , oy, oz+r3)
-piecePass2 = geompy.MakeVertex(ox+arete-demi , oy, oz+r3)
-piecePass3 = geompy.MakeVertex(ox+arete-demi , oy, oz+arete-r3)
-piecePass4 = geompy.MakeVertex(ox+demi , oy, oz+arete-r3)
-
-# Edges
-# -----
-
-pieceEdgeSquare1 = geompy.MakeEdge(piecePoint111, piecePoint211)
-pieceEdgeSquare2 = geompy.MakeEdge(piecePoint114, piecePoint214)
-pieceEdgeSquare3 = geompy.MakeEdge(piecePoint112, piecePoint113)
-pieceEdgeSquare4 = geompy.MakeEdge(piecePoint212, piecePoint213)
-
-pieceEdgeDiagonal1 = geompy.MakeEdge(piecePoint111, piecePoint213)
-pieceEdgeDiagonal2 = geompy.MakeEdge(piecePoint112, piecePoint214)
-
-pieceEdgeArc1 = geompy.MakeArc(piecePoint111, piecePass1, piecePoint112)
-pieceEdgeArc2 = geompy.MakeArc(piecePoint211, piecePass2, piecePoint212)
-pieceEdgeArc3 = geompy.MakeArc(piecePoint213, piecePass3, piecePoint214)
-pieceEdgeArc4 = geompy.MakeArc(piecePoint113, piecePass4, piecePoint114)
-
-# Faces
-# -----
-
-pieceFace1 = geompy.MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1)
-pieceFace2 = geompy.MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2)
-
-pieceFace3 = geompy.MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2)
-
-# Solids
-# ------
-
-pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur)
-pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur)
-pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur)
-
-# Compound and glue
-# -----------------
-
-c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3])
-
-piece = geompy.MakeGlueFaces(c_cpd, 1.e-5)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex09_grid4build")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex09_grid4build:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(6)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# Element of a grid compound by a square with a cylinder on each vertex build by using partition
-
-# Values
-# ------
-
-ox = 0
-oy = 0
-oz = 0
-
-arete = 50
-hauteur = 100
-rayon = 10
-
-g_trim = 1000
-
-# Box
-# ---
-
-piecePoint = geompy.MakeVertex(ox, oy, oz)
-
-pieceBox = geompy.MakeBoxTwoPnt(piecePoint, geompy.MakeVertex(ox+arete, oy+hauteur, oz+arete))
-
-# Cut by cylinders
-# ----------------
-
-dirUp = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-pieceCut1 = geompy.MakeCut(pieceBox , geompy.MakeCylinder(piecePoint , dirUp, rayon, hauteur))
-pieceCut2 = geompy.MakeCut(pieceCut1, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur))
-pieceCut3 = geompy.MakeCut(pieceCut2, geompy.MakeCylinder(geompy.MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur))
-pieceCut4 = geompy.MakeCut(pieceCut3, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur))
-
-# Compound by make a partition of a solid
-# ---------------------------------------
-
-dir = geompy.MakeVectorDXDYDZ(-1, 0, 1)
-
-tools = []
-tools.append(geompy.MakePlane(geompy.MakeVertex(ox+rayon, oy, oz ), dir, g_trim))
-tools.append(geompy.MakePlane(geompy.MakeVertex(ox , oy, oz+rayon), dir, g_trim))
-
-piece = geompy.MakePartition([pieceCut4], tools, [], [], geompy.ShapeType["SOLID"])
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex10_grid4geometry")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex10_grid4geometry:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(10)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# grid compound of 3 x 3 elements
-# an element is compound of 3 cylinders concentriques
-# an element is centered in a square of the grid
-# the smaller cylinder is a hole
-
-# prism the grid, and mesh it in hexahedral way
-
-# Values
-# ------
-
-g_x = 0
-g_y = 0
-g_z = 0
-
-g_arete = 50
-g_hauteur = 30
-
-g_rayon1 = 20
-g_rayon2 = 30
-g_rayon3 = 40
-
-g_grid = 3
-
-g_trim = 1000
-
-# Element
-# -------
-
-e_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
-
-e_hauteur = 2*g_hauteur
-e_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z)
-e_dir = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-e_cyl1 = geompy.MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur)
-
-e_blo1 = geompy.MakeCut(e_boite, e_cyl1)
-
-e_cyl2 = geompy.MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur)
-
-e_blo2 = geompy.MakeCut(e_cyl1, e_cyl2)
-
-e_cyl3 = geompy.MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur)
-
-e_blo3 = geompy.MakeCut(e_cyl2, e_cyl3)
-
-# Partition and repair
-# --------------------
-
-p_tools = []
-p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim))
-p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim))
-
-p_part = geompy.MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], geompy.ShapeType["SOLID"])
-
-p_element = geompy.RemoveExtraEdges(p_part, doUnionFaces=True)
-
-# Grid and glue
-# -------------
-
-grid = geompy.MakeMultiTranslation2D(p_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
-
-piece = geompy.MakeGlueFaces(grid, 1e-5)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex11_grid3partition")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex11_grid3partition:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(3)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import time
-t1= time.time()
-
-# Geometry
-# ========
-
-# grid compound of 3 x 3 elements
-# an element is compound of 3 concentric cylinders
-# an element is centered in a square of the grid
-
-# prism the grid, and mesh it in hexahedral way
-
-# Values
-# ------
-
-g_x = 0
-g_y = 0
-g_z = 0
-
-g_arete = 50
-g_hauteur = 30
-
-g_rayon1 = 20
-g_rayon2 = 30
-g_rayon3 = 40
-
-g_grid = 3
-
-g_trim = 1000
-
-# Solids and rotation to prevent repair
-# -------------------------------------
-
-s_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
-
-s_pi4 = 3.141592653/4
-s_hauteur = 2*g_hauteur
-s_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z)
-s_dir = geompy.MakeVectorDXDYDZ(0, 1, 0)
-
-s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon3, s_hauteur)
-s_cyl1 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4)
-
-s_blo1 = geompy.MakeCut(s_boite, s_cyl1)
-
-s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon2, s_hauteur)
-s_cyl2 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4)
-
-s_blo2 = geompy.MakeCut(s_cyl1, s_cyl2)
-
-s_cyl0 = geompy.MakeCylinder(s_centre, s_dir, g_rayon1, s_hauteur)
-s_cyl3 = geompy.MakeRotation(s_cyl0, s_dir, s_pi4)
-
-s_blo3 = geompy.MakeCut(s_cyl2, s_cyl3)
-
-s_arete = g_rayon1/2
-
-s_blo4 = geompy.MakeBox(g_x-s_arete, g_y-g_hauteur, g_z-s_arete, g_x+s_arete, g_y+g_hauteur, g_z+s_arete)
-
-s_blo5 = geompy.MakeCut(s_cyl3, s_blo4)
-
-# Partition
-# ---------
-
-p_tools = []
-p_tools.append(geompy.MakePlane(s_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim))
-p_tools.append(geompy.MakePlane(s_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim))
-
-p_partie = geompy.MakePartition([s_blo1, s_blo2, s_blo3, s_blo5], p_tools, [], [], geompy.ShapeType["SOLID"])
-
-# Compound and glue
-# -----------------
-
-c_blocs = geompy.SubShapeAll(p_partie, geompy.ShapeType["SOLID"])
-c_blocs.append(s_blo4)
-
-c_cpd = geompy.MakeCompound(c_blocs)
-
-c_element = geompy.MakeGlueFaces(c_cpd, 1e-4)
-
-# Grid
-# ----
-
-piece = geompy.MakeMultiTranslation2D(c_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
-
-# Add in study
-# ------------
-
-piece_id = geompy.addToStudy(piece, "ex12_grid17partition")
-
-t2= time.time()
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex12_grid17partition:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(2)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-t3= time.time()
-
-print ("time geom",t2-t1)
-print ("time mesh",t3-t2 )
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# With hexahedral, build a box partially holed by a not centered cylinder with a thickness
-
-# Values
-# ------
-
-box_dx = 1000
-box_dy = 900
-box_dz = 800
-
-cyl_x = 500
-cyl_y = 300
-cyl_dz = 600
-cyl_radius = 150
-cyl_thick = 30
-
-# Triangular face
-# ---------------
-
-def triangle(p1, p2, p3):
- l = []
- l.append(geompy.MakeEdge(p1, p2))
- l.append(geompy.MakeEdge(p2, p3))
- l.append(geompy.MakeEdge(p3, p1))
- w = geompy.MakeWire(l)
- return geompy.MakeFace(w, 1)
-
-# The holed part
-# ==============
-
-# Vertex of the holed part
-# ------------------------
-
-hole_point_11 = geompy.MakeVertex(0 , 0 , 0)
-hole_point_21 = geompy.MakeVertex(box_dx, 0 , 0)
-hole_point_12 = geompy.MakeVertex(0 , box_dy, 0)
-hole_point_22 = geompy.MakeVertex(box_dx, box_dy, 0)
-
-hole_center = geompy.MakeVertex(cyl_x, cyl_y, 0)
-
-# Faces of the holed part
-# -----------------------
-
-hole_face_1 = triangle(hole_point_11, hole_point_21, hole_center)
-hole_face_2 = triangle(hole_point_21, hole_point_22, hole_center)
-hole_face_3 = triangle(hole_point_12, hole_point_22, hole_center)
-hole_face_4 = triangle(hole_point_11, hole_point_12, hole_center)
-
-# Solids of the holed part
-# ------------------------
-
-cyl_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-hole_solid_1 = geompy.MakePrismVecH(hole_face_1, cyl_dir, cyl_dz)
-hole_solid_2 = geompy.MakePrismVecH(hole_face_2, cyl_dir, cyl_dz)
-hole_solid_3 = geompy.MakePrismVecH(hole_face_3, cyl_dir, cyl_dz)
-hole_solid_4 = geompy.MakePrismVecH(hole_face_4, cyl_dir, cyl_dz)
-
-hole_internal = geompy.MakeCylinder(hole_center, cyl_dir, cyl_radius , cyl_dz)
-hole_external = geompy.MakeCylinder(hole_center, cyl_dir, cyl_radius+cyl_thick, cyl_dz)
-hole_median = geompy.MakeCut(hole_external, hole_internal)
-
-# Boolean operations
-# ------------------
-
-blocks = []
-
-blocks.append( geompy.MakeCut(hole_solid_1, hole_external))
-blocks.append(geompy.MakeCommon(hole_solid_1, hole_median ))
-
-blocks.append( geompy.MakeCut(hole_solid_2, hole_external))
-blocks.append(geompy.MakeCommon(hole_solid_2, hole_median ))
-
-blocks.append( geompy.MakeCut(hole_solid_3, hole_external))
-blocks.append(geompy.MakeCommon(hole_solid_3, hole_median ))
-
-blocks.append( geompy.MakeCut(hole_solid_4, hole_external))
-blocks.append(geompy.MakeCommon(hole_solid_4, hole_median ))
-
-# The full part
-# =============
-
-# Vertex of the full part
-# -----------------------
-
-full_point_11 = geompy.MakeVertex(0 , 0 , cyl_dz)
-full_point_21 = geompy.MakeVertex(box_dx, 0 , cyl_dz)
-full_point_12 = geompy.MakeVertex(0 , box_dy, cyl_dz)
-full_point_22 = geompy.MakeVertex(box_dx, box_dy, cyl_dz)
-
-full_center = geompy.MakeVertex(cyl_x, cyl_y, cyl_dz)
-
-# Faces of the full part
-# ----------------------
-
-full_face_1 = triangle(full_point_11, full_point_21, full_center)
-full_face_2 = triangle(full_point_21, full_point_22, full_center)
-full_face_3 = triangle(full_point_12, full_point_22, full_center)
-full_face_4 = triangle(full_point_11, full_point_12, full_center)
-
-# Solids of the full part
-# ------------------------
-
-full_dz = box_dz - cyl_dz
-
-full_solid_1 = geompy.MakePrismVecH(full_face_1, cyl_dir, full_dz)
-full_solid_2 = geompy.MakePrismVecH(full_face_2, cyl_dir, full_dz)
-full_solid_3 = geompy.MakePrismVecH(full_face_3, cyl_dir, full_dz)
-full_solid_4 = geompy.MakePrismVecH(full_face_4, cyl_dir, full_dz)
-
-full_internal = geompy.MakeCylinder(full_center, cyl_dir, cyl_radius , full_dz)
-full_external = geompy.MakeCylinder(full_center, cyl_dir, cyl_radius+cyl_thick, full_dz)
-full_median = geompy.MakeCut(full_external, full_internal)
-
-# Boolean operations
-# ------------------
-
-full = []
-
-full.append( geompy.MakeCut(full_solid_1, full_external))
-full.append(geompy.MakeCommon(full_solid_1, full_median))
-
-full.append( geompy.MakeCut(full_solid_2, full_external))
-full.append(geompy.MakeCommon(full_solid_2, full_median ))
-
-full.append( geompy.MakeCut(full_solid_3, full_external))
-full.append(geompy.MakeCommon(full_solid_3, full_median))
-
-full.append( geompy.MakeCut(full_solid_4, full_external))
-full.append(geompy.MakeCommon(full_solid_4, full_median))
-
-# Filling the hole
-# ----------------
-
-box_d = cyl_radius/3
-
-x = cyl_x-box_d
-y = x * cyl_y / cyl_x
-box_point_11 = geompy.MakeVertex(x, y, cyl_dz)
-
-x = cyl_x+box_d
-y = (box_dx - x) * cyl_y / (box_dx - cyl_x)
-box_point_12 = geompy.MakeVertex(x, y, cyl_dz)
-
-x = cyl_x-box_d
-y = box_dy - x * (box_dy - cyl_y) / cyl_x
-box_point_21 = geompy.MakeVertex(x, y, cyl_dz)
-
-x = cyl_x+box_d
-y = box_dy - (box_dx - x) * (box_dy - cyl_y) / (box_dx - cyl_x)
-box_point_22 = geompy.MakeVertex(x, y, cyl_dz)
-
-box_face = geompy.MakeQuad4Vertices(box_point_11, box_point_12, box_point_21, box_point_22)
-
-box = geompy.MakePrismVecH(box_face, cyl_dir, full_dz)
-
-full.append(box)
-
-full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_1, full_internal), box))
-full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_2, full_internal), box))
-full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_3, full_internal), box))
-full.append(geompy.MakeCut(geompy.MakeCommon(full_solid_4, full_internal), box))
-
-# Cut the cylinder thickness
-# -------------------------
-
-full_plan = geompy.MakePlane(geompy.MakeVertex(0, 0, cyl_dz+cyl_thick), cyl_dir, 5000)
-
-full_parts = geompy.MakePartition(full, [full_plan], [], [], geompy.ShapeType["SOLID"])
-
-# Geometry result
-# ---------------
-
-blocks.append(full_parts)
-
-piece_cpd = geompy.MakeCompound(blocks)
-
-piece_ok = geompy.RemoveExtraEdges(piece_cpd, doUnionFaces=True)
-
-piece = geompy.MakeGlueFaces(piece_ok, 1.e-3)
-
-piece_id = geompy.addToStudy(piece, "ex13_hole1partial")
-
-# Meshing
-# =======
-
-# Create a mesh
-# -------------
-
-hexa = smesh.Mesh(piece, "ex13_hole1partial:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(2)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Local hypothesis
-# ----------------
-
-def local(x, y, z, d):
- edge = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(x, y, z))
- algo = hexa.Segment(edge)
- algo.NumberOfSegments(d)
- algo.Propagation()
-
-local(0, 0, 100, 40)
-local(0, 0, 700, 15)
-
-local(100, 0, 0, 20)
-local(0, 100, 0, 20)
-
-local(100, 100, 0, 25)
-
-d = cyl_radius-3*cyl_thick
-local(cyl_x+d, cyl_y+d, box_dz, 10)
-
-# Compute the mesh
-# ----------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometrie
-# =========
-
-# Creer un cylindre avec un trou cylindrique excentre, decoupage en hexahedre et mailler.
-
-# Donnees
-# -------
-
-# unite: millimetre
-
-g_ox = 0
-g_oy = 0
-g_oz = 0
-
-g_cyl_rayon = 1000
-g_cyl_demiHauteur = 3000
-
-g_trou_rayon = 5
-g_trou_centre = 300
-
-g_trim = 15000
-
-# Construire le cylindre
-# ----------------------
-
-c_point = geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur)
-c_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
-c_hauteur = 2*g_cyl_demiHauteur
-c_cylindre = geompy.MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur)
-
-# Trouer le cylindre par un minuscule cylindre excentre
-# -----------------------------------------------------
-
-t_hauteur = g_cyl_demiHauteur
-t_point = geompy.MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur)
-t_trou = geompy.MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur)
-
-t_piece = geompy.MakeCut(c_cylindre, t_trou)
-
-# Geometrie hexahedrique
-# ======================
-
-# Decouper
-# --------
-
-h_outils = []
-h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(1, 0, 0), g_trim))
-h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
-
-h_piece = geompy.MakePartition([t_piece], h_outils, [], [], geompy.ShapeType["SOLID"])
-
-# Decouper pour les conditions locales
-# ------------------------------------
-
-l_outils = []
-l_i = 1
-l_n = 12
-l_hauteur = c_hauteur/l_n
-
-while l_i<l_n:
- l_outils.append(geompy.MakePlane(geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur+l_i*l_hauteur), c_dir, g_trim))
- l_i = l_i+1
-
-piece = geompy.MakePartition([h_piece], l_outils, [], [], geompy.ShapeType["SOLID"])
-
-# Ajouter la piece dans l'etude
-# -----------------------------
-
-piece_id = geompy.addToStudy(piece, "ex14_cyl1holed")
-
-# Maillage
-# ========
-
-# Creer un maillage hexahedrique
-# ------------------------------
-
-hexa = smesh.Mesh(piece, "ex14_cyl1holed:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(4)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Poser les hypotheses locales
-# ----------------------------
-
-m_i = 0
-m_n = 12
-m_h = c_hauteur/m_n
-m_d = [4, 6, 8, 10, 10, 9, 8, 7, 6, 5, 4, 3]
-
-m_x = g_ox+g_cyl_rayon
-m_y = g_oy
-m_z = g_oz-g_cyl_demiHauteur+m_h/2
-
-while m_i<m_n:
- m_p = geompy.MakeVertex(m_x, m_y, m_z + m_i*m_h)
- m_e = geompy.GetEdgeNearPoint(piece, m_p)
- m_a = hexa.Segment(m_e)
- m_a.NumberOfSegments(m_d[m_i])
- m_a.Propagation()
- m_i = m_i + 1
-
-# Calculer le maillage
-# --------------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometrie
-# =========
-
-# Construire avec des hexahedres une piece faite de 2 cylindres de diametre different
-# et dont les axes se coupent orthogonalement, puis mailler.
-
-# Valeurs
-# -------
-
-cx = 0
-cy = 0
-cz = 0
-
-g_rayon = 100.0
-g_hauteur = 500
-
-p_rayon = 50.0
-p_hauteur = 500
-
-g_trim = 1000
-
-# Gros cylindre
-# -------------
-
-cpd = []
-
-g_base = geompy.MakeVertex(cx, cy, cz)
-g_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
-t_hauteur = p_rayon+10.0
-
-g_cyl = geompy.MakeCylinder(g_base, g_dir, g_rayon, g_hauteur)
-
-g_coupe = geompy.MakeVectorDXDYDZ(1, 0, 0)
-
-g_tools = []
-g_tools.append(geompy.MakePlane(geompy.MakeVertex(cx+t_hauteur, cy, cz), g_coupe, g_trim))
-g_tools.append(geompy.MakePlane(geompy.MakeVertex(cx-t_hauteur, cy, cz), g_coupe, g_trim))
-
-g_partie = geompy.MakePartition([g_cyl], g_tools, [], [], geompy.ShapeType["SOLID"])
-g_bas, g_centre, g_haut = geompy.SubShapeAllSorted(g_partie, geompy.ShapeType["SOLID"])
-
-# Partie basse du gros cylindre
-# -----------------------------
-
-b_hauteur = 10
-b_base = 20
-
-b_boite = geompy.MakeBox(cx-t_hauteur, cy-b_base, cz, cx-t_hauteur-b_hauteur, cy+b_base, cz+g_hauteur)
-cpd.append(b_boite)
-
-b_cyl = geompy.MakeCut(g_bas, b_boite)
-
-b_tools = []
-b_tools.append(geompy.MakePlane(geompy.MakeVertex(cx-t_hauteur-b_hauteur, cy+b_base, cz), geompy.MakeVectorDXDYDZ( 1, 1, 0), g_trim))
-b_tools.append(geompy.MakePlane(geompy.MakeVertex(cx-t_hauteur-b_hauteur, cy-b_base, cz), geompy.MakeVectorDXDYDZ(-1, 1, 0), g_trim))
-
-b_partie = geompy.MakePartition([b_cyl], b_tools, [], [], geompy.ShapeType["SOLID"])
-b_element = geompy.SubShapeAll(b_partie, geompy.ShapeType["SOLID"])
-cpd = cpd + b_element
-
-# Partie haute du gros cylindre
-# -----------------------------
-
-h_plan = geompy.MakePlane(g_base, g_coupe, g_trim)
-
-cpd.append(geompy.MakeMirrorByPlane(b_boite, h_plan))
-
-for h in b_element:
- h_symetrie = geompy.MakeMirrorByPlane(h, h_plan)
- cpd.append(h_symetrie)
-
-# Petit cylindre
-# --------------
-
-z_arete = p_rayon/2
-x_arete = z_arete*t_hauteur*2/g_hauteur
-
-px = cx-x_arete
-py = cy-1.5*g_rayon
-pz = cz+g_hauteur/2
-
-p_base = geompy.MakeVertex(cx, py, pz)
-p_dir = geompy.MakeVectorDXDYDZ(0, 1, 0)
-p_cyl = geompy.MakeCylinder(p_base, p_dir, p_rayon, p_hauteur)
-
-p_boite = geompy.MakeBox(px, py, pz-z_arete, cx+x_arete, py+p_hauteur, pz+z_arete)
-
-# Partie interieure du petit cylindre
-# -----------------------------------
-
-i_cyl = geompy.MakeCommon(p_cyl, g_cyl)
-i_tuyau = geompy.MakeCut(i_cyl, p_boite)
-i_boite = geompy.MakeCommon(p_boite, g_cyl)
-
-# Partie exterieure du petit cylindre
-# -----------------------------------
-
-e_cyl0 = geompy.MakeCut(p_cyl, g_cyl)
-e_cyl = geompy.SubShapeAllSorted(e_cyl0, geompy.ShapeType["SOLID"])
-
-e_tuyau = geompy.MakeCut(e_cyl[1], p_boite)
-
-e_boite0 = geompy.MakeCut(p_boite, g_cyl)
-e_boite = geompy.SubShapeAllSorted(e_boite0, geompy.ShapeType["SOLID"])
-
-cpd.append(e_boite[1])
-
-# Partie centrale du gros cylindre
-# --------------------------------
-
-c_cyl = geompy.MakeCut(g_centre, p_cyl)
-
-# Partitionner
-# ------------
-
-p_tools = []
-p_tools.append(geompy.MakePlane(geompy.MakeVertex(px, py, pz-z_arete), geompy.MakeVectorDXDYDZ(-z_arete, 0, x_arete), g_trim))
-p_tools.append(geompy.MakePlane(geompy.MakeVertex(px, py, pz+z_arete), geompy.MakeVectorDXDYDZ( z_arete, 0, x_arete), g_trim))
-
-p_partie = geompy.MakePartition([e_tuyau], p_tools, [], [], geompy.ShapeType["SOLID"])
-p_element = geompy.SubShapeAll(p_partie, geompy.ShapeType["SOLID"])
-cpd = cpd + p_element
-
-q_partie = geompy.MakePartition([i_tuyau, c_cyl], p_tools, [], [], geompy.ShapeType["SOLID"])
-q_element = geompy.SubShapeAll(q_partie, geompy.ShapeType["SOLID"])
-
-q_element = q_element + [i_boite]
-
-q_tools = []
-q_tools.append(geompy.MakePlane(geompy.MakeVertex(cx, cy-b_base, cz), geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
-q_tools.append(geompy.MakePlane(geompy.MakeVertex(cx, cy+b_base, cz), geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
-
-r_element = []
-for e in q_element:
- r_partie = geompy.MakePartition([e], q_tools, [], [], geompy.ShapeType["SOLID"])
- r_element = r_element + geompy.SubShapeAll(r_partie, geompy.ShapeType["SOLID"])
-
-cpd = cpd + r_element
-
-# Compound
-# --------
-
-piece = geompy.RemoveExtraEdges(geompy.MakeCompound(cpd), True)
-
-# Ajouter la piece dans l'etude
-# -----------------------------
-
-piece_id = geompy.addToStudy(piece, "ex15_cyl2geometry")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex15_cyl2geometry:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(12)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# Create the hexahedrical block geometry of a holed parallelepipede.
-# The hole has a T form composed by 2 cylinders with different radius, and their axis are normal.
-# This piece is meshed in hexahedrical.
-
-# Values
-# ------
-
-gx = 0
-gy = 0
-gz = 0
-
-g_dx = 250
-g_dy = 200
-g_dz = 150
-
-g_rayonGrand = 70
-g_rayonPetit = 50
-
-g_trim = 1000
-
-# The parallelepipede
-# -------------------
-
-p_boite = geompy.MakeBox(gx-g_dx, gy-g_dy, gz-g_dz, gx+g_dx, gy+g_dy, gz+g_dz)
-
-# The great cylinder
-# ------------------
-
-g_base = geompy.MakeVertex(gx-g_dx, gy, gz)
-g_dir = geompy.MakeVectorDXDYDZ(1, 0, 0)
-g_cyl = geompy.MakeCylinder(g_base, g_dir, g_rayonGrand, g_dx*2)
-
-# The first hole
-# --------------
-
-b_boite = geompy.MakeCut(p_boite , g_cyl)
-
-# Partitioning
-# ------------
-
-p_base = geompy.MakeVertex(gx, gy, gz)
-
-p_tools = []
-
-p_tools.append(geompy.MakePlane(p_base, geompy.MakeVectorDXDYDZ(0, 1 , 0 ), g_trim))
-p_tools.append(geompy.MakePlane(p_base, geompy.MakeVectorDXDYDZ(0, g_dz, g_dy), g_trim))
-p_tools.append(geompy.MakePlane(p_base, geompy.MakeVectorDXDYDZ(0, -g_dz, g_dy), g_trim))
-
-p_tools.append(geompy.MakePlane(geompy.MakeVertex(gx-g_rayonPetit, gy, gz), g_dir, g_trim))
-p_tools.append(geompy.MakePlane(geompy.MakeVertex(gx+g_rayonPetit, gy, gz), g_dir, g_trim))
-
-p_piece = geompy.MakePartition([b_boite], p_tools, [], [], geompy.ShapeType["SOLID"])
-
-# The small cylinder
-# ------------------
-
-c_cyl = geompy.MakeCylinder(p_base, geompy.MakeVectorDXDYDZ(0, 0, 1), g_rayonPetit, g_dz)
-
-# The second hole
-# ---------------
-
-d_element = geompy.SubShapeAllSorted(p_piece, geompy.ShapeType["SOLID"])
-
-d_element[ 8] = geompy.MakeCut(d_element[ 8], c_cyl)
-d_element[10] = geompy.MakeCut(d_element[10], c_cyl)
-
-# Compound
-# --------
-
-piece = geompy.RemoveExtraEdges(geompy.MakeCompound(d_element))
-piece = geompy.MakeGlueFaces(piece, 1e-07)
-
-# Add piece in study
-# ------------------
-
-piece_id = geompy.addToStudy(piece, "ex16_cyl2complementary")
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex16_cyl2complementary:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(12)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Define local hypothesis
-# -----------------------
-
-def local(x, y, z, d):
- edge = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(x, y, z))
- algo = hexa.Segment(edge)
- algo.NumberOfSegments(d)
- algo.Propagation()
-
-local(gx , gy+g_dy, gz+g_dz, 7)
-local(gx+g_dx, gy+g_dy, gz , 21)
-local(gx+g_dx, gy-g_dy, gz , 21)
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometrie
-# =========
-
-# Creer un cylindre surplombe d'une demi-sphere le tout troue par un petit cylindre.
-# Decouper en hexahedre et mailler.
-
-# Donnees
-# -------
-
-cylindre_rayon = 100
-cylindre_hauteur = 400
-
-trou_rayon = 20
-trou_z = cylindre_rayon/2
-
-plan_trim = 2000
-
-# Cylindre
-# --------
-
-cylindre_base = geompy.MakeVertex(0, 0, 0)
-cylindre_dir = geompy.MakeVectorDXDYDZ(1, 0, 0)
-cylindre = geompy.MakeCylinder(cylindre_base, cylindre_dir, cylindre_rayon, cylindre_hauteur)
-
-# Dome
-# ----
-
-dome_sphere = geompy.MakeSpherePntR(cylindre_base, cylindre_rayon)
-dome = geompy.MakeFuse(dome_sphere, cylindre)
-
-# Cheminee
-# --------
-
-cheminee_base = geompy.MakeVertex(-cylindre_hauteur/2, 0, trou_z)
-cheminee_trou = geompy.MakeCylinder(cheminee_base, cylindre_dir, trou_rayon, 2*cylindre_hauteur)
-cheminee = geompy.MakeCut(dome, cheminee_trou)
-
-# Decoupage et reparation
-# -----------------------
-
-blocs_plan1 = geompy.MakePlane(cheminee_base, geompy.MakeVectorDXDYDZ(0, 1, 0), plan_trim)
-blocs_plan2 = geompy.MakePlane(cheminee_base, geompy.MakeVectorDXDYDZ(0, 0, 1), plan_trim)
-
-blocs_part = geompy.MakePartition([cheminee], [blocs_plan1, blocs_plan2], [], [], geompy.ShapeType["SOLID"])
-
-piece = geompy.RemoveExtraEdges(blocs_part)
-
-# Etude
-# -----
-
-piece_id = geompy.addToStudy(piece, "ex17_dome1")
-
-# Maillage
-# ========
-
-# Maillage hexahedrique
-# ---------------------
-
-hexa = smesh.Mesh(piece, "ex17_dome1:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(20)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Calcul du maillage
-# ------------------
-
-hexa.Compute()
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import math
-
-# Geometrie
-# =========
-
-# Creer un cylindre ayant a chaque bout un morceau de sphere et le tout troue par un petit cylindrique excentre.
-# Decouper en hexahedre et mailler.
-
-# Donnees
-# -------
-
-# unite: millimetre
-
-g_ox = 0
-g_oy = 0
-g_oz = 0
-
-g_cyl_rayon = 1000
-g_cyl_demiHauteur = 3000
-
-g_trou_rayon = 5
-g_trou_centre = 300
-
-g_sphere_rayon = 3500
-
-g_trim = 15000
-
-# Cylindre
-# --------
-
-c_point = geompy.MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur)
-c_dir = geompy.MakeVectorDXDYDZ(0, 0, 1)
-c_hauteur = 2*g_cyl_demiHauteur
-
-c_cylindre = geompy.MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur)
-
-# Sphere
-# ------
-
-s_hauteur = math.sqrt(g_sphere_rayon*g_sphere_rayon - g_cyl_rayon*g_cyl_rayon) - g_cyl_demiHauteur
-
-s_sphere = geompy.MakeSphere(g_ox, g_oy, g_oz-s_hauteur, g_sphere_rayon)
-
-# Calottes
-# --------
-
-c_outils = []
-c_outils.append(geompy.MakePlane(geompy.MakeVertex(g_ox, g_oy, g_oz+g_cyl_demiHauteur), geompy.MakeVectorDXDYDZ(0, 0, 1), g_trim))
-
-c_cpd = geompy.MakePartition([s_sphere], c_outils, [], [], geompy.ShapeType["SOLID"])
-c_calotte_haut, c_reste = geompy.SubShapeAllSorted(c_cpd, geompy.ShapeType["SOLID"])
-
-c_plan = geompy.MakePlane(geompy.MakeVertex(g_ox, g_oy, g_oz), geompy.MakeVectorDXDYDZ(0, 0, 1), g_trim)
-c_calotte_bas = geompy.MakeMirrorByPlane(c_calotte_haut, c_plan)
-
-# Fusionner
-# ---------
-
-f_piece1 = geompy.MakeFuse(c_cylindre, c_calotte_haut)
-f_piece = geompy.MakeFuse(f_piece1, c_calotte_bas)
-
-# Trouer
-# ------
-
-t_hauteur = g_sphere_rayon
-t_point = geompy.MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur)
-t_trou = geompy.MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur)
-
-t_piece = geompy.MakeCut(f_piece, t_trou)
-
-# Decouper
-# --------
-
-h_outils = []
-h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(1, 0, 0), g_trim))
-h_outils.append(geompy.MakePlane(t_point, geompy.MakeVectorDXDYDZ(0, 1, 0), g_trim))
-
-h_piece = geompy.MakePartition([t_piece], h_outils, [], [], geompy.ShapeType["SOLID"])
-
-# Reparer
-# -------
-
-piece = geompy.RemoveExtraEdges(h_piece)
-
-# Ajouter la piece dans l'etude
-# -----------------------------
-
-piece_id = geompy.addToStudy(piece, "ex18_dome2")
-
-# Maillage
-# ========
-
-# Maillage hexahedrique
-# ---------------------
-
-hexa = smesh.Mesh(piece, "ex18_dome2:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(2)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Calcul du maillage
-# ------------------
-
-hexa.Compute()
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometrie
-# =========
-
-# Mailler en hexahedre une sphere dans un cube.
-
-# Donnees
-# -------
-
-sphere_rayon = 100
-
-cube_cote = 200
-
-plan_trim = 1000
-
-# Sphere
-# ------
-
-sphere_centre = geompy.MakeVertex(0, 0, 0)
-
-sphere_pleine = geompy.MakeSpherePntR(sphere_centre, sphere_rayon)
-
-# Cube interieur
-# --------------
-
-boite_cote = sphere_rayon / 2
-
-boite = geompy.MakeBox(-boite_cote, -boite_cote, -boite_cote, +boite_cote, +boite_cote, +boite_cote)
-
-blocs = [boite]
-
-# Decoupage sphere
-# ----------------
-
-sphere_troue = geompy.MakeCut(sphere_pleine, boite)
-
-#sphere_outils = []
-#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, 1), plan_trim))
-#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, -1), plan_trim))
-#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 1, 0), plan_trim))
-#sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ(-1, 1, 0), plan_trim))
-
-f1 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), plan_trim)
-f2 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ(-1, 1, 0), plan_trim)
-f3 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ( 1, 1, 0), plan_trim)
-f4 = geompy.MakePlane(sphere_centre, geompy.MakeVectorDXDYDZ( 1, 0, -1), plan_trim)
-
-
-#sphere_decoupee = MakePartition(solids, sphere_outils, [], [], ShapeType["SOLID"])
-
-sphere_decoupee = geompy.MakePartition([sphere_troue], [f1], [], [], geompy.ShapeType["SOLID"])
-sphere_decoupee = geompy.MakePartition([sphere_decoupee], [f2], [], [], geompy.ShapeType["SOLID"])
-sphere_decoupee = geompy.MakePartition([sphere_decoupee], [f3], [], [], geompy.ShapeType["SOLID"])
-sphere_decoupee = geompy.MakePartition([sphere_decoupee], [f4], [], [], geompy.ShapeType["SOLID"])
-
-sphere_partie = geompy.MakeCompound([sphere_decoupee])
-
-sphere_partie = geompy.GetBlockNearPoint(sphere_decoupee, geompy.MakeVertex(-sphere_rayon, 0, 0))
-sphere_bloc = geompy.RemoveExtraEdges(sphere_partie)
-
-blocs.append(sphere_bloc)
-
-pi2 = 3.141592653/2
-
-sphere_dir1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
-sphere_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir1, +pi2))
-blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir1, -pi2))
-
-blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir2, +pi2))
-blocs.append(geompy.MakeRotation(sphere_bloc, sphere_dir2, -pi2))
-
-blocs.append(geompy.MakeMirrorByPoint(sphere_bloc, sphere_centre))
-
-# Cube exterieur
-# --------------
-
-cube_plein = geompy.MakeBox(-cube_cote, -cube_cote, -cube_cote, +cube_cote, +cube_cote, +cube_cote)
-cube_trou = geompy.MakeCut(cube_plein, sphere_pleine)
-#cube_decoupe = MakePartition([cube_trou], sphere_outils, [], [], ShapeType["SOLID"])
-
-cube_decoupe = geompy.MakePartition([cube_trou], [f1], [], [], geompy.ShapeType["SOLID"])
-cube_decoupe = geompy.MakePartition([cube_decoupe], [f2], [], [], geompy.ShapeType["SOLID"])
-cube_decoupe = geompy.MakePartition([cube_decoupe], [f3], [], [], geompy.ShapeType["SOLID"])
-cube_decoupe = geompy.MakePartition([cube_decoupe], [f4], [], [], geompy.ShapeType["SOLID"])
-
-cube_decoupe = geompy.MakeCompound([cube_decoupe])
-
-
-cube_partie = geompy.GetBlockNearPoint(cube_decoupe, geompy.MakeVertex(-cube_cote, 0, 0))
-cube_bloc = geompy.RemoveExtraEdges(cube_partie)
-
-blocs.append(cube_bloc)
-
-blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir1, +pi2))
-blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir1, -pi2))
-
-blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir2, +pi2))
-blocs.append(geompy.MakeRotation(cube_bloc, sphere_dir2, -pi2))
-
-blocs.append(geompy.MakeMirrorByPoint(cube_bloc, sphere_centre))
-
-# Piece
-# -----
-
-piece_cpd = geompy.MakeCompound(blocs)
-piece = geompy.MakeGlueFaces(piece_cpd, 1.e-3)
-
-piece_id = geompy.addToStudy(piece, "ex19_sphereINcube")
-
-# Groupe geometrique
-# ==================
-
-# Definition du groupe
-# --------------------
-
-groupe = geompy.CreateGroup(piece, geompy.ShapeType["SOLID"])
-
-groupe_nom = "ex19_sphereINcube_interieur"
-geompy.addToStudy(groupe, groupe_nom)
-groupe.SetName(groupe_nom)
-
-# Contenu du groupe
-# -----------------
-
-groupe_sphere = geompy.GetShapesOnSphere(piece, geompy.ShapeType["SOLID"], sphere_centre, sphere_rayon, GEOM.ST_ONIN)
-
-geompy.UnionList(groupe, groupe_sphere)
-
-# Meshing
-# =======
-
-# Create a hexahedral mesh
-# ------------------------
-
-hexa = smesh.Mesh(piece, "ex19_sphereINcube:hexa")
-
-algo = hexa.Segment()
-algo.NumberOfSegments(10)
-
-hexa.Quadrangle()
-
-hexa.Hexahedron()
-
-# Mesh calculus
-# -------------
-
-hexa.Compute()
-
-# Le groupe de mailles
-# --------------------
-
-hexa_groupe = hexa.Group(groupe)
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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 salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Geometry
-# ========
-
-# an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral.
-
-# Define values
-# -------------
-
-name = "ex21_lamp"
-
-cote = 60
-
-section = 20
-size = 200
-
-radius_1 = 80
-radius_2 = 40
-height = 100
-
-# Build a box
-# -----------
-
-box = geompy.MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
-
-# Build a cylinder
-# ----------------
-
-pt1 = geompy.MakeVertex(0, 0, cote/3)
-di1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
-cyl = geompy.MakeCylinder(pt1, di1, section, size)
-
-# Build a truncated cone
-# ----------------------
-
-pt2 = geompy.MakeVertex(0, 0, size)
-cone = geompy.MakeCone(pt2, di1, radius_1, radius_2, height)
-
-# Fuse
-# ----
-
-box_cyl = geompy.MakeFuse(box, cyl)
-piece = geompy.MakeFuse(box_cyl, cone)
-
-# Add in study
-# ------------
-
-geompy.addToStudy(piece, name)
-
-# Create a group of faces
-# -----------------------
-
-group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"])
-
-group_name = name + "_grp"
-geompy.addToStudy(group, group_name)
-group.SetName(group_name)
-
-# Add faces in the group
-# ----------------------
-
-faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"])
-
-geompy.UnionIDs(group, faces)
-
-# Create a mesh
-# =============
-
-# Define a mesh on a geometry
-# ---------------------------
-
-tetra = smesh.Mesh(piece, name)
-
-# Define 1D hypothesis
-# --------------------
-
-algo1d = tetra.Segment()
-algo1d.LocalLength(10)
-
-# Define 2D hypothesis
-# --------------------
-
-algo2d = tetra.Triangle()
-algo2d.LengthFromEdges()
-
-# Define 3D hypothesis
-# --------------------
-
-algo3d = tetra.Tetrahedron(smeshBuilder.NETGEN)
-algo3d.MaxElementVolume(100)
-
-# Compute the mesh
-# ----------------
-
-tetra.Compute()
-
-# Create a groupe of faces
-# ------------------------
-
-tetra.Group(group)
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
\ No newline at end of file
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# ==================================
-#
-import math
-
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-geo = geompy
-
-# Parameters
-# ----------
-
-radius = 50
-height = 200
-
-# Build a cylinder
-# ----------------
-
-base = geompy.MakeVertex(0, 0, 0)
-direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-cylinder = geompy.MakeCylinder(base, direction, radius, height)
-
-geompy.addToStudy(cylinder, "cylinder")
-
-# Build blocks
-# ------------
-
-size = radius/2.0
-
-box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height)
-box_axis = geompy.MakeLine(base, direction)
-box = geompy.MakeRotation(box_rot, box_axis, math.pi/4)
-
-hole = geompy.MakeCut(cylinder, box)
-
-plane_trim = 2000
-
-plane_a = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
-plane_b = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
-
-blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"])
-blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"])
-blocks_all = geompy.MakeCompound(blocks_list)
-blocks = geompy.MakeGlueFaces(blocks_all, 0.0001)
-
-geompy.addToStudy(blocks, "cylinder:blocks")
-
-# Build geometric groups
-# ----------------------
-
-def group(name, shape, type, base=None, direction=None):
- t = geompy.ShapeType[type]
- g = geompy.CreateGroup(shape, t)
-
- geompy.addToStudy(g, name)
- g.SetName(name)
-
- if base!=None:
- l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON)
- geompy.UnionIDs(g, l)
-
- return g
-
-group_a = group("baseA", blocks, "FACE", base, direction)
-
-base_b = geompy.MakeVertex(0, 0, height)
-group_b = group("baseB", blocks, "FACE", base_b, direction)
-
-group_1 = group("limit", blocks, "SOLID")
-group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"])
-geompy.UnionIDs(group_1, group_1_all)
-group_1_box = geompy.GetBlockNearPoint(blocks, base)
-geompy.DifferenceList(group_1, [group_1_box])
-
-# Mesh the blocks with hexahedral
-# -------------------------------
-
-smesh.UpdateStudy()
-
-def discretize(x, y, z, n, s=blocks):
- p = geompy.MakeVertex(x, y, z)
- e = geompy.GetEdgeNearPoint(s, p)
- a = hexa.Segment(e)
- a.NumberOfSegments(n)
- a.Propagation()
-
-hexa = smesh.Mesh(blocks)
-
-hexa_1d = hexa.Segment()
-hexa_1d.NumberOfSegments(1)
-
-discretize(+radius , +radius, 0, 5)
-discretize(-radius , +radius, 0, 8)
-discretize((radius+size)/2, 0, 0, 10)
-discretize( +radius, 0, height/2, 20)
-
-hexa.Quadrangle()
-hexa.Hexahedron()
-
-hexa.Compute()
-
-hexa.Group(group_a)
-hexa.Group(group_b)
-hexa.Group(group_1)
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# =======================================
-# Procedure that take a triangulation and split all triangles in 4 others triangles
-#
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import os
-
-# Values
-# ------
-
-tmpDir = os.getenv('SALOME_TMP_DIR', '/tmp')
-print("Output directory:", tmpDir)
-
-# Path for ".med" files
-path = os.path.join( tmpDir, "ex29_%s_" % os.getenv('USER','unknown'))
-
-# Name of the shape and the mesh
-name = "Carre"
-
-# Add a node and needed edges
-# ---------------------------
-
-def node(m, f, n1, n2, lnv):
- x1, y1, z1 = m.GetNodeXYZ(n1)
- x2, y2, z2 = m.GetNodeXYZ(n2)
-
- x = (x1 + x2) / 2.0
- y = (y1 + y2) / 2.0
- z = (z1 + z2) / 2.0
-
- i = m.AddNode(x, y, z)
-
- in1 = m.GetShapeID(n1)
- in2 = m.GetShapeID(n2)
-
- if (in1==f) or (in2==f):
- m.SetNodeOnFace(i, f, 0, 0)
-
- else:
- e1 = m.AddEdge([ n1, i ])
- e2 = m.AddEdge([ i , n2 ])
-
- if n1 in lnv:
- e = in2
- else:
- e = in1
-
- m.SetMeshElementOnShape(e1, e)
- m.SetMeshElementOnShape(e2, e)
- m.SetNodeOnEdge(i, e, 0)
-
- return i
-
-# Add a triangle and associate to the CAD face
-# --------------------------------------------
-
-def triangle(m, f, n1, n2, n3):
- i = m.AddFace([ n1, n2, n3 ])
- m.SetMeshElementOnShape(i, f)
-
-# Split all triangles in 4 triangles
-# ----------------------------------
-
-def SplitTrianglesIn4(m):
- # Get all triangles
- triangles = m.GetElementsByType(SMESH.FACE)
-
- # Remove all edges
- m.RemoveElements(m.GetElementsByType(SMESH.EDGE))
-
- # Get the list of nodes (ids) associated with the CAD vertices
- shape = m.GetShape()
- lnv = []
- for v in geompy.SubShapeAll(shape, geompy.ShapeType["VERTEX"]):
- lnv = lnv + m.GetSubMeshNodesId(v, True)
-
- # Split every triangle
- for t in triangles:
- noeud_1, noeud_2, noeud_3 = m.GetElemNodes(t)
-
- face = m.GetShapeIDForElem(t)
-
- noeud_12 = node(m, face, noeud_1, noeud_2, lnv)
- noeud_23 = node(m, face, noeud_2, noeud_3, lnv)
- noeud_13 = node(m, face, noeud_1, noeud_3, lnv)
-
- triangle(m, face, noeud_1 , noeud_12, noeud_13)
- triangle(m, face, noeud_2 , noeud_23, noeud_12)
- triangle(m, face, noeud_3 , noeud_13, noeud_23)
- triangle(m, face, noeud_12, noeud_23, noeud_13)
-
- # Remove all initial triangles
- m.RemoveElements(triangles)
-
- # Merge all identical nodes
- m.MergeNodes(m.FindCoincidentNodes(0.0001))
-
-# Build a CAD square
-# ------------------
-
-x0 = 0.0 ; y0 = 0.0 ; z0 = 0.0
-x1 = 1.0 ; y1 = 0.0 ; z1 = 0.0
-x2 = 1.0 ; y2 = 1.0 ; z2 = 0.0
-x3 = 0.0 ; y3 = 1.0 ; z3 = 0.0
-
-P0 = geompy.MakeVertex(x0, y0, z0)
-P1 = geompy.MakeVertex(x1, y1, z1)
-P2 = geompy.MakeVertex(x2, y2, z2)
-P3 = geompy.MakeVertex(x3, y3, z3)
-
-square = geompy.MakeQuad4Vertices(P0, P1, P2, P3)
-geompy.addToStudy(square, name)
-
-# Refine edges and create group of mesh
-# -------------------------------------
-
-def refine(m, p1, p2, n, k, name):
- s = m.GetShape()
-
- g = geompy.CreateGroup(s, geompy.ShapeType["EDGE"])
- e = geompy.GetEdge(s, p1, p2)
- i = geompy.GetSubShapeID(s, e)
- geompy.AddObject(g, i)
- m.Group(g, name)
-
- a = m.Segment(e)
- a.NumberOfSegments(n, k)
-
-# Mesh the square
-# ---------------
-
-MyMesh = smesh.Mesh(square)
-
-refine(MyMesh, P1, P2, 8, 7, "Droite")
-refine(MyMesh, P3, P0, 9, 10, "Gauche")
-refine(MyMesh, P0, P1, 7, 9, "Bas" )
-refine(MyMesh, P2, P3, 12, 14, "Haut" )
-
-algo2D = MyMesh.Triangle()
-algo2D.MaxElementArea(0.07)
-
-MyMesh.Compute()
-
-MyMesh.ExportMED(path+"110_triangles.med", 0)
-
-# Disturb the mesh
-# ----------------
-
-MyMesh.MoveNode( 37, 0.05 , 0.368967 , 0 )
-MyMesh.MoveNode( 38, 0.34 , 0.0762294, 0 )
-MyMesh.MoveNode( 40, 0.8 , 0.42 , 0 )
-MyMesh.MoveNode( 42, 0.702662, 0.74 , 0 )
-MyMesh.MoveNode( 46, 0.4 , 0.374656 , 0 )
-MyMesh.MoveNode( 47, 0.13 , 0.63 , 0 )
-MyMesh.MoveNode( 49, 0.222187, 0.3 , 0 )
-MyMesh.MoveNode( 54, 0.557791, 0.05 , 0 )
-MyMesh.MoveNode( 55, 0.7 , 0.2 , 0 )
-MyMesh.MoveNode( 56, 0.73 , 0.52 , 0 )
-MyMesh.MoveNode( 58, 0.313071, 0.31 , 0 )
-MyMesh.MoveNode( 59, 0.8 , 0.56 , 0 )
-MyMesh.MoveNode( 62, 0.592703, 0.95 , 0 )
-MyMesh.MoveNode( 63, 0.28 , 0.5 , 0 )
-MyMesh.MoveNode( 65, 0.49 , 0.93 , 0 )
-MyMesh.MoveNode( 68, 0.501038, 0.65 , 0 )
-MyMesh.MoveNode( 69, 0.37 , 0.63 , 0 )
-MyMesh.MoveNode( 70, 0.597025, 0.52 , 0 )
-MyMesh.MoveNode( 72, 0.899 , 0.878589 , 0 )
-MyMesh.MoveNode( 73, 0.92 , 0.85 , 0 )
-MyMesh.MoveNode( 74, 0.820851, 0.75 , 0 )
-
-NbCells1 = 110
-MyMesh.ExportMED(path+"110_triangles_2.med", 0)
-
-# First mesh refining
-# -------------------
-
-SplitTrianglesIn4(MyMesh)
-
-NbCells2 = NbCells1*4
-print(("Mesh with "+str(NbCells2)+" cells computed."))
-
-MyMesh.ExportMED(path+str(NbCells2)+"_triangles.med", 0)
-
-# Second mesh refining
-# --------------------
-
-SplitTrianglesIn4(MyMesh)
-
-NbCells3 = NbCells2*4
-print(("Mesh with "+str(NbCells3)+" cells computed."))
-
-MyMesh.ExportMED(path+str(NbCells3)+"_triangles.med",0)
-
-# Third mesh refining
-# -------------------
-
-SplitTrianglesIn4(MyMesh)
-
-NbCells4 = NbCells3*4
-print(("Mesh with "+str(NbCells4)+" cells computed."))
-
-MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0)
-
-# Update the object browser
-# -------------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-import math
-
-global Face_1
-Face_1 = geompy.MakeFaceHW(100, 100, 1)
-geompy.addToStudy( Face_1, "Face_1" )
-
-smesh.UpdateStudy()
-from salome.StdMeshers import StdMeshersBuilder
-pattern = smesh.GetPattern()
-Mesh_1 = smesh.Mesh(Face_1)
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
-Nb_Segments_1.SetDistrType( 0 )
-Quadrangle_2D = Mesh_1.Quadrangle()
-isDone = Mesh_1.Compute()
-
-# groups creation
-
-aListOfElems = [ 52, 53, 54, 55, 56, 57,
- 62, 63, 64, 65, 66, 67,
- 72, 73, 74, 75, 76, 77,
- 82, 83, 84, 85, 86, 87 ]
-
-aRedGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Red" )
-aRedGroup.Add( aListOfElems );
-aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )
-
-aListOfElems = [ 55, 56, 57, 58, 59,
- 65, 66, 67, 68, 69,
- 75, 76, 77, 78, 79,
- 85, 86, 87, 88, 89,
- 95, 96, 97, 98, 99,
- 105, 106, 107, 108, 109,
- 115, 116, 117, 118, 119,
- 125, 126, 127, 128, 129 ]
-
-aGreenGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Green" )
-aGreenGroup.Add( aListOfElems );
-aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )
-
-aListOfElems = [ 63, 64, 65, 66, 67, 68,
- 73, 74, 75, 76, 77, 78,
- 83, 84, 85, 86, 87, 88,
- 93, 94, 95, 96, 97, 98,
- 103, 104, 105, 106, 107, 108,
- 113, 114, 115, 116, 117, 118 ]
-
-aBlueGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Blue" )
-aBlueGroup.Add( aListOfElems );
-aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )
-
-# UnionListOfGroups()
-aUnGrp = Mesh_1.UnionListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "UnionGrp" )
-
-# IntersectListOfGroups()
-aIntGrp=Mesh_1.IntersectListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "IntGrp" )
-
-# CutListOfGroups()
-aCutGrp=Mesh_1.CutListOfGroups([aRedGroup],[aGreenGroup,aBlueGroup],"CutGrp")
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-# ====================================================================
-#
-import os
-
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-# Parameters
-# ----------
-
-results = "/tmp/ZZ"
-
-radius = 50
-height = 200
-
-# Build a cylinder
-# ----------------
-
-base = geompy.MakeVertex(0, 0, 0)
-direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-cylinder = geompy.MakeCylinder(base, direction, radius, height)
-
-geompy.addToStudy(cylinder, "Cylinder")
-
-# Define a mesh on a geometry
-# ---------------------------
-
-smesh.UpdateStudy()
-
-m = smesh.Mesh(cylinder)
-
-# 2D mesh with BLSURF
-# -------------------
-
-algo2d = m.Triangle(smeshBuilder.BLSURF)
-
-algo2d.SetPhysicalMesh(1)
-algo2d.SetPhySize(5)
-
-algo2d.SetGeometricMesh(0)
-
-# 3D mesh with tepal
-# ------------------
-
-algo3d = m.Tetrahedron(smeshBuilder.GHS3DPRL)
-
-algo3d.SetMEDName(results)
-algo3d.SetNbPart(4)
-algo3d.SetBackground(False)
-algo3d.SetKeepFiles(False)
-
-# Launch meshers
-# --------------
-
-status = m.Compute()
-
-# Test if ok
-# ----------
-
-if os.access(results+".xml", os.F_OK):
- print("Ok: tepal")
-else:
- print("KO: tepal")
-
-# Update object browser
-# ---------------------
-
-salome.sg.updateObjBrowser()
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021 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
-#
-
-import salome
-salome.salome_init()
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-import math
-
-global Box_1
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-geompy.addToStudy( Box_1, "Box_1" )
-
-smesh.UpdateStudy()
-from salome.StdMeshers import StdMeshersBuilder
-Mesh_1 = smesh.Mesh(Box_1)
-Regular_1D = Mesh_1.Segment()
-Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
-Nb_Segments_1.SetDistrType( 0 )
-Quadrangle_2D = Mesh_1.Quadrangle()
-Hexa_3D = Mesh_1.Hexahedron()
-isDone = Mesh_1.Compute()
-
-### CreateDimGroup()
-
-aListOf3d_1=list(range(721,821))
-
-aGrp3D_1=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 1" )
-aGrp3D_1.Add( aListOf3d_1 )
-
-aListOf3d_2=list(range(821, 921))
-aGrp3D_2=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 2" )
-aGrp3D_2.Add( aListOf3d_2 )
-
-aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.FACE, "Faces" )
-
-aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.EDGE, "Edges" )
-
-aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.NODE, "Nodes" )
-
-salome.sg.updateObjBrowser()
-
+++ /dev/null
-# Copyright (C) 2015-2021 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 : smesh_selection.py
-# Author : Roman NIKOLAEV, OPEN CASCADE ( roman.nikolaev@opencascade.com )
-# Module : SMESH
-
-import salome
-salome.salome_init()
-
-import libSMESH_Swig
-sm_gui = libSMESH_Swig.SMESH_Swig()
-
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New()
-
-import GEOM
-
-# swig -> idl
-_converter = {
- libSMESH_Swig.EdgeOfCell : None, # TODO: check how to process it
- libSMESH_Swig.Node : SMESH.NODE,
- libSMESH_Swig.Edge : SMESH.EDGE,
- libSMESH_Swig.Face : SMESH.FACE,
- libSMESH_Swig.Volume : SMESH.VOLUME,
- libSMESH_Swig.Elem0D : SMESH.ELEM0D,
- libSMESH_Swig.Ball : SMESH.BALL,
- libSMESH_Swig.Cell : SMESH.ALL
-}
-
-# Converts swig to idl enumeration
-def _swig2idl( type ):
- if type in _converter :
- return _converter[type]
- return None
-
-def _getEntry(mesh):
- if isinstance( mesh, smeshBuilder.Mesh ) :
- return salome.ObjectToID( mesh.GetMesh() )
- else :
- if isinstance( mesh, str ) :
- return mesh
- return None
-
-def _getMesh(mesh):
- if isinstance( mesh, smeshBuilder.Mesh ) :
- return mesh.GetMesh()
- else :
- if isinstance( mesh, str ) :
- return salome.IDToObject( mesh )
- return None
-
-def _getGeom(geom):
- if isinstance( geom, GEOM._objref_GEOM_Object ) :
- return geom
- else :
- if isinstance( geom, str ) :
- return salome.IDToObject( geom )
- return None
-
-
-# Selects an elements lst on the mesh
-def select( mesh, lst, append = False ) :
- # Check mesh parameter
- entry = _getEntry(mesh)
- if entry is None:
- print("Wrong 'mesh' parameter")
- return
-
- # Check lst parameter
- tmp = []
- if isinstance( lst, int ) :
- tmp.append( lst )
- else :
- if isinstance( lst,list ) :
- tmp = lst
- else :
- print("Wrong 'lst' parameter")
- return
- sm_gui.select( entry, tmp, append )
-
-
-def _preProcess(mesh) :
- m = _getMesh(mesh);
- if m is None:
- print("Wrong 'mesh' parameter")
- return [None, None]
-
- elemType = _swig2idl(sm_gui.getSelectionMode())
- if elemType is None:
- return [None, None]
- return [m, elemType]
-
-
-
-# Selects an elements on the mesh inside the sphere with radius r and center (x, y, z)
-def selectInsideSphere( mesh, x, y, z, r, append = False ) :
-
- [m, elemType] = _preProcess(mesh)
- if m is None or elemType is None :
- return
-
- l = smesh.GetInsideSphere( m, elemType, x, y, z, r )
- if len(l) > 0:
- select(mesh, l, append)
-
-# Selects an elements on the mesh inside the box
-def selectInsideBox( mesh, x1, y1, z1, x2, y2, z2 , append = False ) :
-
- [m, elemType] = _preProcess(mesh)
- if m is None or elemType is None :
- return
-
- l = smesh.GetInsideBox( m, elemType, x1, y1, z1, x2, y2, z2 )
- if len(l) > 0:
- select(mesh, l, append)
-
-# Selects an elements on the mesh inside the cylinder
-def selectInsideCylinder( mesh, x, y, z, dx, dy, dz, h, r, append = False ) :
-
- [m, elemType] = _preProcess(mesh)
- if m is None or elemType is None :
- return
-
- l = smesh.GetInsideCylinder( m, elemType, x, y, z, dx, dy, dz, h, r )
- if len(l) > 0:
- select(mesh, l, append)
-
-# Selects an elements on the mesh inside the geometrical object
-def selectInside( mesh, geom, tolerance , append = False ):
-
- [m, elemType] = _preProcess(mesh)
- if m is None or elemType is None :
- return
-
- g = _getGeom(geom)
-
- l = smesh.GetInside( m, elemType, g ,tolerance )
- if len(l) > 0:
- select(mesh, l, append)