Merge V9_dev branch into master

This commit is contained in:
rnv 2018-06-14 14:56:19 +03:00
commit b7a7d49664
764 changed files with 13544 additions and 24020 deletions

View File

@ -306,7 +306,7 @@ INCLUDE(CMakePackageConfigHelpers)
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
SMESHControls MeshDriver MeshDriverDAT MeshDriverGMF MeshDriverMED
MeshDriverSTL MeshDriverUNV MEDWrapperBase MEDWrapper MEDWrapper_V2_2
MeshDriverSTL MeshDriverUNV MEDWrapper
SMDS SMESHimpl SMESHEngine SMESHClient SMESHDS
SMESHUtils StdMeshers StdMeshersEngine MeshJobManagerEngine
SPADDERPluginTesterEngine SalomeIDLSMESH SalomeIDLSPADDER

View File

@ -138,9 +138,7 @@ SET(SMESH_MeshDriverGMF MeshDriverGMF)
SET(SMESH_MeshDriverMED MeshDriverMED)
SET(SMESH_MeshDriverSTL MeshDriverSTL)
SET(SMESH_MeshDriverUNV MeshDriverUNV)
SET(SMESH_MEDWrapperBase MEDWrapperBase)
SET(SMESH_MEDWrapper MEDWrapper)
SET(SMESH_MEDWrapper_V2_2 MEDWrapper_V2_2)
IF(SALOME_SMESH_ENABLE_MEFISTO)
SET(SMESH_MEFISTO2D MEFISTO2D)
ENDIF(SALOME_SMESH_ENABLE_MEFISTO)

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#!/usr/bin/env python3
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
@ -30,7 +29,7 @@ def set_env(args):
python_version="python%d.%d" % sys.version_info[0:2]
if not os.environ.has_key("SALOME_StdMeshersResources"):
if "SALOME_StdMeshersResources" not in os.environ:
os.environ["SALOME_StdMeshersResources"] \
= os.path.join(os.environ["SMESH_ROOT_DIR"],"share",salome_subdir,"resources","smesh")
pass
@ -38,7 +37,7 @@ def set_env(args):
# find plugins
plugin_list = ["StdMeshers"]
resource_path_list = []
for env_var in os.environ.keys():
for env_var in list(os.environ.keys()):
value = os.environ[env_var]
if env_var[-9:] == "_ROOT_DIR" and value:
plugin_root = value
@ -60,14 +59,14 @@ def set_env(args):
if plugin in plugin_list: continue
# add paths of plugin
plugin_list.append(plugin)
if not os.environ.has_key("SALOME_"+plugin+"Resources"):
plugin_list.append(plugin)
if "SALOME_"+plugin+"Resources" not in os.environ:
resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
os.environ["SALOME_"+plugin+"Resources"] = resource_path
resource_path_list.append( resource_path )
add_path(os.path.join(plugin_root,get_lib_dir(),python_version, "site-packages",salome_subdir), "PYTHONPATH")
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
if sys.platform == "win32":
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
@ -80,4 +79,3 @@ def set_env(args):
break
os.environ["SMESH_MeshersList"] = ":".join(plugin_list)
os.environ["SalomeAppConfig"] = os.environ["SalomeAppConfig"] + psep + psep.join(resource_path_list)

View File

@ -3,11 +3,11 @@
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
###
# Geometry: an assembly of a box, a cylinder and a truncated cone

View File

@ -2,7 +2,7 @@ import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
# This script demonstrates generation of 3D mesh basing on a modified 2D mesh
#
@ -31,7 +31,7 @@ Sph_Face = geompy.GetInPlace(Cut_1, Sph_Face, isNewImplementation=True, theName=
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Cut_1)
@ -59,4 +59,4 @@ Mesh_1.Tetrahedron()
Mesh_1.Compute()
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import salome_notebook
@ -22,23 +22,23 @@ mesh = smesh.Mesh( sphere )
cartAlgo = mesh.BodyFitted()
# define a cartesian grid using Coordinates
coords = range(-100,100,10)
coords = list(range(-100,100,10))
cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000)
# compute the mesh
mesh.Compute()
print "nb hexahedra",mesh.NbHexas()
print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons()
print
print("nb hexahedra",mesh.NbHexas())
print("nb tetrahedra",mesh.NbTetras())
print("nb polyhedra",mesh.NbPolyhedrons())
print()
# define the grid by setting constant spacing
cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000)
mesh.Compute()
print "nb hexahedra",mesh.NbHexas()
print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons()
print("nb hexahedra",mesh.NbHexas())
print("nb tetrahedra",mesh.NbTetras())
print("nb polyhedra",mesh.NbPolyhedrons())
# define the grid by setting different spacing in 2 sub-ranges of geometry
@ -46,10 +46,10 @@ spaceFuns = ["5","10+10*t"]
cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 )
mesh.Compute()
print "nb hexahedra",mesh.NbHexas()
print "nb tetrahedra",mesh.NbTetras()
print "nb polyhedra",mesh.NbPolyhedrons()
print
print("nb hexahedra",mesh.NbHexas())
print("nb tetrahedra",mesh.NbTetras())
print("nb polyhedra",mesh.NbPolyhedrons())
print()
# Example of customization of dirtections of the grid axes
@ -67,23 +67,23 @@ mesh = smesh.Mesh( box, "custom axes")
algo = mesh.BodyFitted()
algo.SetGrid( spc, spc, spc, 10000 )
mesh.Compute()
print "Default axes"
print " nb hex:",mesh.NbHexas()
print("Default axes")
print(" nb hex:",mesh.NbHexas())
# set axes using edges of the box
algo.SetAxesDirs( xDir, [-0.1,1,0], zDir )
mesh.Compute()
print "Manual axes"
print " nb hex:",mesh.NbHexas()
print("Manual axes")
print(" nb hex:",mesh.NbHexas())
# set optimal orthogonal axes
algo.SetOptimalAxesDirs( isOrthogonal=True )
mesh.Compute()
print "Optimal orthogonal axes"
print " nb hex:",mesh.NbHexas()
print("Optimal orthogonal axes")
print(" nb hex:",mesh.NbHexas())
# set optimal non-orthogonal axes
algo.SetOptimalAxesDirs( isOrthogonal=False )
mesh.Compute()
print "Optimal non-orthogonal axes"
print " nb hex:",mesh.NbHexas()
print("Optimal non-orthogonal axes")
print(" nb hex:",mesh.NbHexas())

View File

@ -4,12 +4,11 @@ import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
smesh = smeshBuilder.New()
unPentaBiQuad = smesh.Mesh()
nodeID = unPentaBiQuad.AddNode( 0, 0, 0 )
nodeID = unPentaBiQuad.AddNode( 10, 0, 0 )
@ -32,7 +31,7 @@ nodeID = unPentaBiQuad.AddNode( -1, 5, 5 )
volID = unPentaBiQuad.AddVolume( [ 4, 5, 6, 1, 2, 3, 10, 11, 12, 7, 8, 9, 13, 14, 15, 16, 17, 18 ] )
infos = unPentaBiQuad.GetMeshInfo()
print "Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta]
print("Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta])
if (infos[SMESH.Entity_BiQuad_Penta] != 1):
raise RuntimeError("Bad number of biquadratic pentahedrons: should be 1")
@ -40,4 +39,4 @@ if (infos[SMESH.Entity_BiQuad_Penta] != 1):
smesh.SetName(unPentaBiQuad.GetMesh(), 'unPentaBiQuad')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
@ -29,7 +29,7 @@ algo3D.MaxElementVolume(900.)
# compute the mesh
ret = tetra.Compute()
if ret == 0:
print "problem when computing the mesh"
print("problem when computing the mesh")
else:
print "mesh computed"
print("mesh computed")
pass

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
@ -45,15 +45,15 @@ SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
# check existing sub-mesh priority order
[ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder()
isDone = Mesh_1.Compute()
print "Nb elements at initial order of sub-meshes:", Mesh_1.NbElements()
print("Nb elements at initial order of sub-meshes:", Mesh_1.NbElements())
# set new sub-mesh order
isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ])
# compute mesh
isDone = Mesh_1.Compute()
print "Nb elements at new order of sub-meshes:", Mesh_1.NbElements()
print("Nb elements at new order of sub-meshes:", Mesh_1.NbElements())
# compute with other sub-mesh order
isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ])
isDone = Mesh_1.Compute()
print "Nb elements at another order of sub-meshes:", Mesh_1.NbElements()
print("Nb elements at another order of sub-meshes:", Mesh_1.NbElements())

View File

@ -4,19 +4,19 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
def PrintMeshInfo(theMesh):
aMesh = theMesh.GetMesh()
print "Information about mesh:"
print "Number of nodes : ", aMesh.NbNodes()
print "Number of edges : ", aMesh.NbEdges()
print "Number of faces : ", aMesh.NbFaces()
print "Number of volumes : ", aMesh.NbVolumes()
print("Information about mesh:")
print("Number of nodes : ", aMesh.NbNodes())
print("Number of edges : ", aMesh.NbEdges())
print("Number of faces : ", aMesh.NbFaces())
print("Number of volumes : ", aMesh.NbVolumes())
pass
# create a box

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
@ -47,12 +47,12 @@ import MEDLoader, os
# on XOY plane, and autoDimension=True by default
mesh2D.ExportMED( medFile )
medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0)
print "autoDimension==True, exported mesh is in %sD"%medMesh.getSpaceDimension()
print("autoDimension==True, exported mesh is in %sD"%medMesh.getSpaceDimension())
# exported mesh is in 3D space, same as in Mesh module,
# thanks to autoDimension=False
mesh2D.ExportMED( medFile, autoDimension=False )
medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0)
print "autoDimension==False, exported mesh is in %sD"%medMesh.getSpaceDimension()
print("autoDimension==False, exported mesh is in %sD"%medMesh.getSpaceDimension())
os.remove( medFile )

View File

@ -8,11 +8,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import math
@ -84,7 +84,7 @@ geompy.DifferenceList(group_1, [group_1_box])
# Mesh the blocks with hexahedral
# -------------------------------
smesh.SetCurrentStudy(salome.myStudy)
smesh.UpdateStudy()
def discretize(x, y, z, nbSeg, shape=blocks):
vert = geompy.MakeVertex( x, y, z )

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
## create a bottom box
Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
@ -39,7 +39,7 @@ geompy.addToStudy(Box_sup, "Box_sup")
geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup")
geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
smesh.SetCurrentStudy(salome.myStudy)
smesh.UpdateStudy()
## create a bottom mesh
Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
@ -78,4 +78,4 @@ Compound2 = smesh.Concatenate([Mesh_inf, Mesh_sup], 1, 0, 1e-05, True,
name='Compound with UniteGrps and GrpsOfAllElems')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# make geometry of a box
box = geompy.MakeBoxDXDYDZ(100,100,100)

View File

@ -1,9 +1,9 @@
import salome, math
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
box = geompy.MakeBoxDXDYDZ( 100, 100, 100 )

View File

@ -4,10 +4,10 @@ import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a face from arc and straight segment
px = geompy.MakeVertex(100., 0. , 0. )

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a face
px = geompy.MakeVertex(100., 0. , 0. )

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a cylinder
cyl = geompy.MakeCylinderRH(30., 50.)
@ -32,6 +32,6 @@ algo3D.MaxElementVolume(200.)
# compute the mesh
ret = tetra.Compute()
if ret == 0:
print "problem when computing the mesh"
print("problem when computing the mesh")
else:
print "Computation succeeded"
print("Computation succeeded")

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create sketchers
sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
base = geompy.MakeSketcher("Sketcher:F 0 0:TT 10 0:TT 20 10:TT 0 10:WF", theName="F")

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)

View File

@ -6,11 +6,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# Prepare geometry

View File

@ -6,11 +6,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# Prepare geometry

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
# Create face and explode it on edges

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# Create face from the wire and add to study
Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# Get 1/4 part from the disk face.
Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
# Make quadrangle face and explode it on edges.

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# Make a patritioned box

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
X = geompy.MakeVectorDXDYDZ( 1,0,0 )
O = geompy.MakeVertex( 100,50,50 )

View File

@ -34,4 +34,4 @@ Mesh_1.MakePolyLine( segments, "1D group")
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -4,14 +4,13 @@ import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New(theStudy)
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@ -27,7 +26,7 @@ geompy.addToStudy( Divided_Disk_1, 'Divided Disk_1' )
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
smesh = smeshBuilder.New()
aFilterManager = smesh.CreateFilterManager()
Mesh_1 = smesh.Mesh(Divided_Disk_1)
Regular_1D = Mesh_1.Segment()
@ -40,7 +39,7 @@ Mesh_1.ExtrusionSweepObjects( [ Mesh_1 ], [ Mesh_1 ], [ Mesh_1 ], [ 0, 0, 50 ],
Mesh_1.ConvertToQuadratic(0, Mesh_1,True)
infos = Mesh_1.GetMeshInfo()
print "Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta]
print("Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta])
if (infos[SMESH.Entity_BiQuad_Penta] != 1080):
raise RuntimeError("Bad number of biquadratic pentahedrons: should be 1080")
@ -52,4 +51,4 @@ smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -2,11 +2,11 @@
# create mesh
from SMESH_mechanic import *
print
print()
# create a group of all faces (quadrangles) generated on sub_face3
quads_on_face3 = mesh.MakeGroup("quads_on_face3", SMESH.FACE, SMESH.FT_BelongToGeom,'=',sub_face3)
print "There are %s quadrangles generated on '%s' and included in the group '%s'" % ( quads_on_face3.Size(), sub_face3.GetName(), quads_on_face3.GetName() )
print("There are %s quadrangles generated on '%s' and included in the group '%s'" % ( quads_on_face3.Size(), sub_face3.GetName(), quads_on_face3.GetName() ))
# create a group of all the rest quadrangles, generated on other faces by combining 2 criteria:
# - negated FT_BelongToMeshGroup to select elements not included in quads_on_face3
@ -15,5 +15,5 @@ not_on_face3 = smesh.GetCriterion( SMESH.FACE, SMESH.FT_BelongToMeshGroup,'=',qu
quadrangles = smesh.GetCriterion( SMESH.FACE, SMESH.FT_ElemGeomType,'=',SMESH.Geom_QUADRANGLE )
rest_quads = mesh.MakeGroupByCriteria("rest_quads", [ not_on_face3, quadrangles ])
print "'%s' group includes all the rest %s quadrangles" % ( rest_quads.GetName(), rest_quads.Size() )
print("'%s' group includes all the rest %s quadrangles" % ( rest_quads.GetName(), rest_quads.Size() ))

View File

@ -7,38 +7,38 @@ from SMESH_mechanic import *
# get faces with aspect ratio > 2.5
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 2.5)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with aspect ratio > 2.5:", len(ids)
print("Number of faces with aspect ratio > 2.5:", len(ids))
# get faces with aspect ratio > 1.5
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, '>', 1.5, mesh=mesh)
ids = filter.GetIDs()
print "Number of faces with aspect ratio > 1.5:", len(ids)
print("Number of faces with aspect ratio > 1.5:", len(ids))
# copy the faces with aspect ratio > 1.5 to another mesh;
# this demonstrates that a filter can be used where usually a group or sub-mesh is acceptable
filter.SetMesh( mesh.GetMesh() ) # - actually non necessary as mesh is set at filter creation
mesh2 = smesh.CopyMesh( filter, "AR > 1.5" )
print "Number of copied faces with aspect ratio > 1.5:", mesh2.NbFaces()
print("Number of copied faces with aspect ratio > 1.5:", mesh2.NbFaces())
# create a group (Group on Filter) of faces with Aspect Ratio < 1.5
group = mesh.MakeGroup("AR < 1.5", SMESH.FACE, SMESH.FT_AspectRatio, '<', 1.5)
print "Number of faces with aspect ratio < 1.5:", group.Size()
print("Number of faces with aspect ratio < 1.5:", group.Size())
# combine several criteria to Create a Group of only Triangular faces with Aspect Ratio < 1.5;
# note that contents of a GroupOnFilter is dynamically updated as the mesh changes
crit = [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_AspectRatio, '<', 1.5, BinaryOp=SMESH.FT_LogicalAND ),
smesh.GetCriterion( SMESH.FACE, SMESH.FT_ElemGeomType,'=', SMESH.Geom_TRIANGLE ) ]
triaGroup = mesh.MakeGroupByCriteria( "Tria AR < 1.5", crit )
print "Number of triangles with aspect ratio < 1.5:", triaGroup.Size()
print("Number of triangles with aspect ratio < 1.5:", triaGroup.Size())
# get range of values of Aspect Ratio of all faces in the mesh
aspects = mesh.GetMinMax( SMESH.FT_AspectRatio )
print "MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] )
print("MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] ))
# get max value of Aspect Ratio of faces in triaGroup
grAspects = mesh.GetMinMax( SMESH.FT_AspectRatio, triaGroup )
print "GROUP: Max aspect = %s" % grAspects[1]
print("GROUP: Max aspect = %s" % grAspects[1])
# get Aspect Ratio of an element
aspect = mesh.FunctorValue( SMESH.FT_AspectRatio, ids[0] )
print "Aspect ratio of the face %s = %s" % ( ids[0], aspect )
print("Aspect ratio of the face %s = %s" % ( ids[0], aspect ))

View File

@ -7,4 +7,4 @@ mesh.Compute()
# get volumes with aspect ratio < 2.0
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_LessThan, 2.0)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with aspect ratio < 2.0:", len(ids)
print("Number of volumes with aspect ratio < 2.0:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, "=", 2.0e-13, Tolerance=5.0e-14)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
print("Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get faces with minimum angle > 75
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle,">", 75)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with minimum angle > 75:", len(ids)
print("Number of faces with minimum angle > 75:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get faces with taper < 1.e-15
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_LessThan, 1.e-15)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with taper < 1.e-15:", len(ids)
print("Number of faces with taper < 1.e-15:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get faces with skew > 50
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 50)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with skew > 50:", len(ids)
print("Number of faces with skew > 50:", len(ids))

View File

@ -7,4 +7,4 @@ criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60
criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90)
filter = smesh.GetFilterFromCriteria([criterion1,criterion2], SMESH.FT_LogicalAND)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with area in range (60,90):", len(ids)
print("Number of faces with area in range (60,90):", len(ids))

View File

@ -7,4 +7,4 @@ mesh.Compute()
# get volumes faces with volume > 100
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_MoreThan, 100)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with volume > 100:", len(ids)
print("Number of volumes with volume > 100:", len(ids))

View File

@ -4,9 +4,9 @@
import salome, SMESH
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create mesh
face = geompy.MakeFaceHW(100, 100, 1, theName="quadrangle")
@ -18,4 +18,4 @@ mesh.Compute()
# get all free borders
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
ids = mesh.GetIdsFromFilter(filter)
print "Number of edges on free borders:", len(ids)
print("Number of edges on free borders:", len(ids))

View File

@ -4,9 +4,9 @@
import salome, SMESH
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create mesh
face = geompy.MakeFaceHW(100, 100, 1)
@ -19,4 +19,4 @@ mesh.Compute()
# get all faces with free edges
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeEdges)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with free edges:", len(ids)
print("Number of faces with free edges:", len(ids))

View File

@ -7,4 +7,4 @@ mesh.AddNode(0,0,0)
# get all free nodes
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
ids = mesh.GetIdsFromFilter(filter)
print "Number of free nodes:", len(ids)
print("Number of free nodes:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get all free faces
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces)
ids = mesh.GetIdsFromFilter(filter)
print "Number of free faces:", len(ids)
print("Number of free faces:", len(ids))

View File

@ -7,4 +7,4 @@ mesh.RemoveElements( mesh.GetElementsByType(SMESH.FACE)[0:5] )
# get all faces with bare borders
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BareBorderFace)
ids = mesh.GetIdsFromFilter(filter)
print "Faces with bare borders:", ids
print("Faces with bare borders:", ids)

View File

@ -6,4 +6,4 @@ faceID = mesh.GetElementsByType(SMESH.FACE)[0]
# get all faces co-planar to the first face with tolerance 5 degrees
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_CoplanarFaces,faceID,Tolerance=5.0)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces coplanar with the first one:", len(ids)
print("Number of faces coplanar with the first one:", len(ids))

View File

@ -4,4 +4,4 @@ from SMESH_mechanic import *
# get all over-constrained faces
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_OverConstrainedFace)
ids = mesh.GetIdsFromFilter(filter)
print "Over-constrained faces:", ids
print("Over-constrained faces:", ids)

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import salome_notebook
# make a mesh on a box
@ -27,6 +27,6 @@ equalEdgesFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges)
equalFacesFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_EqualFaces)
equalVolumesFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes)
# get equal elements
print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter ))
print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter ))
print "Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter ))
print("Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter )))
print("Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter )))
print("Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter )))

View File

@ -3,10 +3,10 @@
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# make a mesh on a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
@ -20,4 +20,4 @@ mesh.TranslateObject( mesh, [10,0,0], Copy=True )
# create a filter to find nodes equal within tolerance of 1e-5
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_EqualNodes, Tolerance=1e-5)
# get equal nodes
print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
print("Number of equal nodes:", len( mesh.GetIdsFromFilter( filter )))

View File

@ -3,10 +3,10 @@
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# make a mesh on a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
@ -22,4 +22,4 @@ mesh.MergeNodes( mesh.FindCoincidentNodes( 1e-5 ))
# get mesh edges with number of connected elements (faces and volumes) == 3
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, 3)
ids = mesh.GetIdsFromFilter(filter)
print "Number of border edges with 3 faces connected:", len(ids)
print("Number of border edges with 3 faces connected:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get faces which consist of edges belonging to 2 mesh elements
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, 2)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces consisting of edges belonging to 2 faces:", len(ids)
print("Number of faces consisting of edges belonging to 2 faces:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get edges with length > 14
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, 14)
ids = mesh.GetIdsFromFilter(filter)
print "Number of edges with length > 14:", len(ids)
print("Number of edges with length > 14:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get all faces that have edges with length > 14
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, 14)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum edge length > 14:", len(ids)
print("Number of faces with maximum edge length > 14:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get all faces that have elements with length > 10
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum element length > 10:", len(ids)
print("Number of faces with maximum element length > 10:", len(ids))

View File

@ -7,4 +7,4 @@ mesh.Compute()
# get all volumes that have elements with length > 10
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, 10)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with maximum element length > 10:", len(ids)
print("Number of volumes with maximum element length > 10:", len(ids))

View File

@ -5,8 +5,8 @@ from SMESH_mechanic import *
mesh.Tetrahedron()
mesh.Compute()
# remove some volumes to have volumes with bare borders
mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
mesh.RemoveElements(mesh.GetElementsByType(SMESH.VOLUME)[0:5])
# get all volumes with bare borders
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BareBorderVolume)
ids = mesh.GetIdsFromFilter(filter)
print "Volumes with bare borders:", ids
print("Volumes with bare borders:", ids)

View File

@ -7,4 +7,4 @@ mesh.Compute()
# get all over-constrained volumes
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_OverConstrainedVolume)
ids = mesh.GetIdsFromFilter(filter)
print "Over-constrained volumes:", ids
print("Over-constrained volumes:", ids)

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get all faces which nodes lie on the face sub_face3
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces which nodes lie on sub_face3:", len(ids)
print("Number of faces which nodes lie on sub_face3:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get all faces at least one node of each lies on the face sub_face3
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_LyingOnGeom, sub_face3)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces at least one node of each lies on sub_face3:", len(ids)
print("Number of faces at least one node of each lies on sub_face3:", len(ids))

View File

@ -8,4 +8,4 @@ geompy.addToStudy(plane_1, "plane_1")
# get all nodes which lie on the plane \a plane_1
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToPlane, plane_1)
ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes which lie on the plane plane_1:", len(ids)
print("Number of nodes which lie on the plane plane_1:", len(ids))

View File

@ -5,4 +5,4 @@ from SMESH_mechanic import *
# get all faces which lie on the cylindrical face \a sub_face1
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToCylinder, sub_face1)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)
print("Number of faces which lie on the cylindrical surface sub_face1:", len(ids))

View File

@ -9,4 +9,4 @@ geompy.addToStudy(surface_1, "surface_1")
# get all nodes which lie on the surface \a surface_1
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToGenSurface, surface_1)
ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes which lie on the surface surface_1:", len(ids)
print("Number of nodes which lie on the surface surface_1:", len(ids))

View File

@ -9,4 +9,4 @@ criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-3
filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes in ranges [5-10] and [15-30]:", len(ids)
print("Number of nodes in ranges [5-10] and [15-30]:", len(ids))

View File

@ -7,4 +7,4 @@ mesh.Compute()
# get all badly oriented volumes
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BadOrientedVolume)
ids = mesh.GetIdsFromFilter(filter)
print "Number of badly oriented volumes:", len(ids)
print("Number of badly oriented volumes:", len(ids))

View File

@ -8,13 +8,13 @@ filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic)
filter_quadratic = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic, SMESH.FT_LogicalNOT)
ids_linear = mesh.GetIdsFromFilter(filter_linear)
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
print("Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic))
# convert mesh to quadratic
print "Convert to quadratic..."
print("Convert to quadratic...")
mesh.ConvertToQuadratic()
# get linear and quadratic edges
ids_linear = mesh.GetIdsFromFilter(filter_linear)
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
print("Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic))

View File

@ -4,11 +4,11 @@
from SMESH_mechanic import *
# create group of edges
all_edges = mesh.GetElementsByType(SMESH.EDGE)
grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges)/4])
grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges) // 4])
import SALOMEDS
c = SALOMEDS.Color(0.1, 0.5, 1.0)
grp.SetColor(c)
# get number of the edges not belonging to the group with the given color
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_GroupColor, c, SMESH.FT_LogicalNOT)
ids = mesh.GetIdsFromFilter(filter)
print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)
print("Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids))

View File

@ -13,7 +13,7 @@ ids_tri = mesh.GetIdsFromFilter(filter_tri)
ids_qua = mesh.GetIdsFromFilter(filter_qua)
ids_tet = mesh.GetIdsFromFilter(filter_tet)
ids_pyr = mesh.GetIdsFromFilter(filter_pyr)
print "Number of triangles:", len(ids_tri)
print "Number of quadrangles:", len(ids_qua)
print "Number of tetrahedrons:", len(ids_tet)
print "Number of pyramids:", len(ids_pyr)
print("Number of triangles:", len(ids_tri))
print("Number of quadrangles:", len(ids_qua))
print("Number of tetrahedrons:", len(ids_tet))
print("Number of pyramids:", len(ids_pyr))

View File

@ -6,10 +6,10 @@ from SMESH_mechanic import *
# make the mesh quadratic
mesh.ConvertToQuadratic()
# make some elements bi-quadratic
for face in SubFaceL[: len(SubFaceL)/2]:
for face in SubFaceL[: len(SubFaceL) // 2]:
mesh.ConvertToQuadratic( theSubMesh=mesh.Group( face ), theToBiQuad=True )
# get triangles with 7 nodes
filter_tri = smesh.GetFilter(SMESH.FACE, SMESH.FT_EntityType,'=', SMESH.Entity_BiQuad_Triangle )
ids_tri = mesh.GetIdsFromFilter(filter_tri)
print "Number of bi-quadratic triangles:", len(ids_tri)
print("Number of bi-quadratic triangles:", len(ids_tri))

View File

@ -12,4 +12,4 @@ for i in range(1,10):
# get balls with diameter > 5.
diam_filter = smesh.GetFilter(SMESH.BALL, SMESH.FT_BallDiameter,'>', 5. )
ids = mesh.GetIdsFromFilter( diam_filter )
print "Number of balls with diameter > 5:", len(ids)
print("Number of balls with diameter > 5:", len(ids))

View File

@ -3,9 +3,9 @@
import salome, SMESH
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create two boxes to have two domains in the mesh
@ -29,17 +29,17 @@ mesh.Compute()
# using point coordinates in box_1
nodeFilter = smesh.GetFilter( SMESH.NODE, SMESH.FT_ConnectedElements, "=", "1.,2,10", mesh=mesh )
print "Nb. nodes in box_1:", len( nodeFilter.GetIDs())
print("Nb. nodes in box_1:", len( nodeFilter.GetIDs()))
# using point coordinates in box_2
edgeFilter = smesh.GetFilter( SMESH.EDGE, SMESH.FT_ConnectedElements, "=", [202,1,1 ], mesh=mesh )
print "Nb. segments in box_2:", len( edgeFilter.GetIDs())
print("Nb. segments in box_2:", len( edgeFilter.GetIDs()))
# using a geom vertex of box_1
faceFilter = smesh.GetFilter( SMESH.FACE, SMESH.FT_ConnectedElements, "=", vertex, mesh=mesh )
print "Nb. faces in box_1:", len( edgeFilter.GetIDs())
print("Nb. faces in box_1:", len( edgeFilter.GetIDs()))
# using node ID in box_2
voluFilter = smesh.GetFilter( SMESH.VOLUME, SMESH.FT_ConnectedElements, "=", 10, mesh=mesh )
print "Nb. volumes in box_2:", len( voluFilter.GetIDs())
print("Nb. volumes in box_2:", len( voluFilter.GetIDs()))

View File

@ -6,4 +6,4 @@ from SMESH_mechanic import *
# get nodes connected to more than 6 tetrahedra
conn_nb_filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_NodeConnectivityNumber,'>', 6 )
ids = mesh.GetIdsFromFilter( conn_nb_filter )
print "Number of nodes connected to more than 6 tetrahedra:", len(ids)
print("Number of nodes connected to more than 6 tetrahedra:", len(ids))

View File

@ -8,11 +8,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# geometry

View File

@ -28,37 +28,37 @@ aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "aGroup")
# set/get group name
aGroup.SetName( "new name" )
print "name", aGroup.GetName()
print("name", aGroup.GetName())
# get group type (type of entities in the group, SMESH.NODE in our case)
print "type", aGroup.GetType()
print("type", aGroup.GetType())
# get number of entities (nodes in our case) in the group
print "size", aGroup.Size()
print("size", aGroup.Size())
# check of emptiness
print "is empty", aGroup.IsEmpty()
print("is empty", aGroup.IsEmpty())
# check of presence of an entity in the group
aGroup.Add([1,2]) # Add() method is specific to the standalone group
print "contains node 2", aGroup.Contains(2)
print("contains node 2", aGroup.Contains(2))
# get an entity by index
print "1st node", aGroup.GetID(1)
print("1st node", aGroup.GetID(1))
# get all entities
print "all", aGroup.GetIDs()
print("all", aGroup.GetIDs())
# get number of nodes (actual for groups of elements)
print "nb nodes", aGroup.GetNumberOfNodes()
print("nb nodes", aGroup.GetNumberOfNodes())
# get underlying nodes (actual for groups of elements)
print "nodes", aGroup.GetNodeIDs()
print("nodes", aGroup.GetNodeIDs())
# set/get color
import SALOMEDS
aGroup.SetColor( SALOMEDS.Color(1.,1.,0.));
print "color", aGroup.GetColor()
print("color", aGroup.GetColor())
# ----------------------------------------------------------------------------
# methods specific to the standalone group and not present in GroupOnGeometry
@ -77,4 +77,4 @@ aGroup.Remove( [2,3,4] )
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
@ -43,4 +43,4 @@ aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1")
# create SMESH group on <aGeomGroupE> with default name
aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE)
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import salome_notebook
@ -28,22 +28,22 @@ critaria = [ \
]
filt = smesh.GetFilterFromCriteria( critaria )
filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt )
print "Group on filter contains %s elements" % filtGroup.Size()
print("Group on filter contains %s elements" % filtGroup.Size())
# group on filter is updated if the mesh is modified
hyp1D.SetStartLength( 2.5 )
hyp1D.SetEndLength( 2.5 )
mesh.Compute()
print "After mesh change, group on filter contains %s elements" % filtGroup.Size()
print("After mesh change, group on filter contains %s elements" % filtGroup.Size())
# set a new filter defining the group
filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds, "1-50" )
filtGroup.SetFilter( filt2 )
print "With a new filter, group on filter contains %s elements" % filtGroup.Size()
print("With a new filter, group on filter contains %s elements" % filtGroup.Size())
# group is updated at modification of the filter
filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )])
filtIDs3 = filtGroup.GetIDs()
print "After filter modification, group on filter contains %s elements" % filtGroup.Size()
print("After filter modification, group on filter contains %s elements" % filtGroup.Size())
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 35, Nb = ", len(anIds)
print("Criterion: Area > 35, Nb = ", len(anIds))
# create a group by adding elements with area > 35
aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 35")
@ -23,7 +23,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 40, Nb = ", len(anIds)
print("Criterion: Area > 40, Nb = ", len(anIds))
# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
aGroup.Remove(anIds)
@ -32,14 +32,14 @@ aGroup.SetName("35 < Area < 40")
# print the result
aGroupElemIDs = aGroup.GetListOfID()
print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)
print("Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs))
j = 1
for i in range(len(aGroupElemIDs)):
if j > 20: j = 1; print ""
print aGroupElemIDs[i],
if j > 20: j = 1; print("")
print(aGroupElemIDs[i], end=' ')
j = j + 1
pass
print ""
print("")
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len( anIds )
print("Criterion: Area > 20, Nb = ", len( anIds ))
# create a group by adding elements with area > 20
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
@ -23,7 +23,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area = 20, Nb = ", len( anIds )
print("Criterion: Area = 20, Nb = ", len( anIds ))
# create a group by adding elements with area = 20
aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" )
@ -33,7 +33,7 @@ aGroup2.Add(anIds)
# create union group : area >= 20
aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
aGroup3.SetColor( SALOMEDS.Color(1.,1.,0.));
print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
print("Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID()))
# Please note that also there is UnionGroups() method which works with two groups only
# Criterion : AREA < 20
@ -41,7 +41,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 20, Nb = ", len(anIds)
print("Criterion: Area < 20, Nb = ", len(anIds))
# create a group by adding elements with area < 20
aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20")
@ -50,6 +50,6 @@ aGroup4.SetColor( SALOMEDS.Color(1.,0.,0.));
# create union group : area >= 20 and area < 20
aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
print("Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID()))
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds)
print("Criterion: Area > 20, Nb = ", len(anIds))
# create a group by adding elements with area > 20
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
@ -23,7 +23,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds)
print("Criterion: Area < 60, Nb = ", len(anIds))
# create a group by adding elements with area < 60
aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
@ -31,7 +31,7 @@ aGroup2.Add(anIds)
# create an intersection of groups : 20 < area < 60
aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
print("Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID()))
# Please note that also there is IntersectGroups() method which works with two groups only
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds)
print("Criterion: Area > 20, Nb = ", len(anIds))
# create a group by adding elements with area > 20
aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds)
@ -22,14 +22,14 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds)
print("Criterion: Area < 60, Nb = ", len(anIds))
# create a group by adding elements with area < 60
aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds)
# create a cut of groups : area >= 60
aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
print("Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID()))
# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -13,7 +13,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
# create a group by adding elements with area > 100
aSrcGroup1 = mesh.GroupOnFilter(SMESH.FACE, "Area > 100", aFilter)
aSrcGroup1.SetColor( SALOMEDS.Color(1.,1.,0.))
print "Criterion: Area > 100, Nb = ", aSrcGroup1.Size()
print("Criterion: Area > 100, Nb = ", aSrcGroup1.Size())
# Criterion : AREA < 30
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.)
@ -21,7 +21,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.)
# create a group by adding elements with area < 30
aSrcGroup2 = mesh.GroupOnFilter(SMESH.FACE, "Area < 30", aFilter)
aSrcGroup2.SetColor( SALOMEDS.Color(1.,0.,0.))
print "Criterion: Area < 30, Nb = ", aSrcGroup2.Size()
print("Criterion: Area < 30, Nb = ", aSrcGroup2.Size())
# Create group of edges using source groups of faces
@ -30,4 +30,4 @@ aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.EDGE, "Edges" )
# Create group of nodes using source groups of faces
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.NODE, "Nodes" )
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -4,11 +4,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import salome_notebook
from SMESH_mechanic import mesh as mesh1

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import salome_notebook
from SMESH_mechanic import mesh as mesh1

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
@ -29,51 +29,51 @@ group_2d = mesh.Group(face)
# compute basic properties
print "Get basic properties: approach 1 (via measurements tool) ----"
print("Get basic properties: approach 1 (via measurements tool) ----")
measure = smesh.CreateMeasurements()
print "* for mesh:"
print " length:", measure.Length(mesh.mesh)
print " area:", measure.Area(mesh.mesh)
print " volume:", measure.Volume(mesh.mesh)
print("* for mesh:")
print(" length:", measure.Length(mesh.mesh))
print(" area:", measure.Area(mesh.mesh))
print(" volume:", measure.Volume(mesh.mesh))
print "* for group (2d):"
print " length:", measure.Length(group_2d)
print " area:", measure.Area(group_2d)
print " volume:", measure.Volume(group_2d)
print("* for group (2d):")
print(" length:", measure.Length(group_2d))
print(" area:", measure.Area(group_2d))
print(" volume:", measure.Volume(group_2d))
print "* for submesh (2d):"
print " length:", measure.Length(submesh_2d_face.GetSubMesh())
print " area:", measure.Area(submesh_2d_face.GetSubMesh())
print " volume:", measure.Volume(submesh_2d_face.GetSubMesh())
print("* for submesh (2d):")
print(" length:", measure.Length(submesh_2d_face.GetSubMesh()))
print(" area:", measure.Area(submesh_2d_face.GetSubMesh()))
print(" volume:", measure.Volume(submesh_2d_face.GetSubMesh()))
measure.UnRegister()
print "Get basic properties: approach 2 (via smeshBuilder) ----"
print("Get basic properties: approach 2 (via smeshBuilder) ----")
print "* for mesh:"
print " length:", smesh.GetLength(mesh)
print " area:", smesh.GetArea(mesh)
print " volume:", smesh.GetVolume(mesh)
print("* for mesh:")
print(" length:", smesh.GetLength(mesh))
print(" area:", smesh.GetArea(mesh))
print(" volume:", smesh.GetVolume(mesh))
print "* for group (2d):"
print " length:", smesh.GetLength(group_2d)
print " area:", smesh.GetArea(group_2d)
print " volume:", smesh.GetVolume(group_2d)
print("* for group (2d):")
print(" length:", smesh.GetLength(group_2d))
print(" area:", smesh.GetArea(group_2d))
print(" volume:", smesh.GetVolume(group_2d))
print "* for submesh (2d):"
print " length:", smesh.GetLength(submesh_2d_face)
print " area:", smesh.GetArea(submesh_2d_face)
print " volume:", smesh.GetVolume(submesh_2d_face)
print("* for submesh (2d):")
print(" length:", smesh.GetLength(submesh_2d_face))
print(" area:", smesh.GetArea(submesh_2d_face))
print(" volume:", smesh.GetVolume(submesh_2d_face))
print "Get basic properties: approach 3 (via smeshBuilder.Mesh) ----"
print("Get basic properties: approach 3 (via smeshBuilder.Mesh) ----")
print "* for mesh:"
print " length:", mesh.GetLength()
print " area:", mesh.GetArea()
print " volume:", mesh.GetVolume()
print("* for mesh:")
print(" length:", mesh.GetLength())
print(" area:", mesh.GetArea())
print(" volume:", mesh.GetVolume())
print "* for group (2d): unsupported"
print("* for group (2d): unsupported")
print "* for submesh (2d): unsupported"
print("* for submesh (2d): unsupported")

View File

@ -4,13 +4,13 @@ import salome
salome.salome_init()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
mesh = smesh.Mesh()
# add node
new_id = mesh.AddNode(50, 10, 0)
print ""
if new_id == 0: print "KO node addition."
else: print "New Node has been added with ID ", new_id
print("")
if new_id == 0: print("KO node addition.")
else: print("New Node has been added with ID ", new_id)

View File

@ -4,7 +4,7 @@ import salome
salome.salome_init()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
mesh = smesh.Mesh()
@ -15,6 +15,6 @@ node_id = mesh.AddNode(50, 10, 0)
# add 0D Element
new_id = mesh.Add0DElement(node_id)
print ""
if new_id == 0: print "KO node addition."
else: print "New 0D Element has been added with ID ", new_id
print("")
if new_id == 0: print("KO node addition.")
else: print("New 0D Element has been added with ID ", new_id)

View File

@ -5,11 +5,11 @@ import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
geompy = geomBuilder.New()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create a geometry
@ -48,5 +48,5 @@ res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
# create 0D elements on some nodes
nodes = range(1,10)
nodes = list(range(1,10))
res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))

View File

@ -3,13 +3,13 @@
import SMESH_mechanic
mesh = SMESH_mechanic.mesh
print ""
print("")
# add node
n1 = mesh.AddNode(50, 10, 0)
if n1 == 0: print "KO node addition."
if n1 == 0: print("KO node addition.")
# add edge
e1 = mesh.AddEdge([n1, 38])
if e1 == 0: print "KO edge addition."
else: print "New Edge has been added with ID ", e1
if e1 == 0: print("KO edge addition.")
else: print("New Edge has been added with ID ", e1)

View File

@ -3,13 +3,13 @@
import SMESH_mechanic
mesh = SMESH_mechanic.mesh
print ""
print("")
# add node
n1 = mesh.AddNode(50, 10, 0)
if n1 == 0: print "KO node addition."
if n1 == 0: print("KO node addition.")
# add triangle
t1 = mesh.AddFace([n1, 38, 39])
if t1 == 0: print "KO triangle addition."
else: print "New Triangle has been added with ID ", t1
if t1 == 0: print("KO triangle addition.")
else: print("New Triangle has been added with ID ", t1)

View File

@ -3,16 +3,16 @@
import SMESH_mechanic
mesh = SMESH_mechanic.mesh
print ""
print("")
# add node
n1 = mesh.AddNode(50, 10, 0)
if n1 == 0: print "KO node addition."
if n1 == 0: print("KO node addition.")
n2 = mesh.AddNode(40, 20, 0)
if n2 == 0: print "KO node addition."
if n2 == 0: print("KO node addition.")
# add quadrangle
q1 = mesh.AddFace([n2, n1, 38, 39])
if q1 == 0: print "KO quadrangle addition."
else: print "New Quadrangle has been added with ID ", q1
if q1 == 0: print("KO quadrangle addition.")
else: print("New Quadrangle has been added with ID ", q1)

View File

@ -3,13 +3,13 @@
import SMESH_mechanic
mesh = SMESH_mechanic.mesh
print ""
print("")
# add node
n1 = mesh.AddNode(50, 10, 0)
if n1 == 0: print "KO node addition."
if n1 == 0: print("KO node addition.")
# add tetrahedron
t1 = mesh.AddVolume([n1, 38, 39, 246])
if t1 == 0: print "KO tetrahedron addition."
else: print "New Tetrahedron has been added with ID ", t1
if t1 == 0: print("KO tetrahedron addition.")
else: print("New Tetrahedron has been added with ID ", t1)

View File

@ -3,7 +3,7 @@
import SMESH_mechanic
mesh = SMESH_mechanic.mesh
print ""
print("")
# add nodes
nId1 = mesh.AddNode(50, 10, 0)
@ -11,9 +11,9 @@ nId2 = mesh.AddNode(47, 12, 0)
nId3 = mesh.AddNode(50, 10, 10)
nId4 = mesh.AddNode(47, 12, 10)
if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print "KO node addition."
if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print("KO node addition.")
# add hexahedron
vId = mesh.AddVolume([nId2, nId1, 38, 39, nId4, nId3, 245, 246])
if vId == 0: print "KO Hexahedron addition."
else: print "New Hexahedron has been added with ID ", vId
if vId == 0: print("KO Hexahedron addition.")
else: print("New Hexahedron has been added with ID ", vId)

View File

@ -7,7 +7,7 @@ salome.salome_init()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
# create an empty mesh structure
@ -34,4 +34,4 @@ f1 = MakePolygon(mesh, 0, 0, 0, 30, 13)
f2 = MakePolygon(mesh, 0, 0, 10, 21, 9)
f3 = MakePolygon(mesh, 0, 0, 20, 13, 6)
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -5,7 +5,7 @@ import salome
salome.salome_init()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
smesh = smeshBuilder.New()
import math
@ -60,4 +60,4 @@ mesh.AddPolyhedralVolume([dd[0], dd[1], dd[2], dd[3], dd[4], # top
[5,5,5,5,5,5,5,5,5,5,5,5])
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
salome.sg.updateObjBrowser()

View File

@ -6,5 +6,5 @@ mesh = SMESH_mechanic.mesh
# remove nodes #246 and #255
res = mesh.RemoveNodes([246, 255])
if res == 1: print "Nodes removing is OK!"
else: print "KO nodes removing."
if res == 1: print("Nodes removing is OK!")
else: print("KO nodes removing.")

View File

@ -6,5 +6,5 @@ mesh = SMESH_mechanic.mesh
# remove three elements: #850, #859 and #814
res = mesh.RemoveElements([850, 859, 814])
if res == 1: print "Elements removing is OK!"
else: print "KO Elements removing."
if res == 1: print("Elements removing is OK!")
else: print("KO Elements removing.")

View File

@ -9,5 +9,5 @@ mesh.AddNode(0,0,0)
mesh.AddNode(1,1,1)
# remove just created orphan nodes
res = mesh.RemoveOrphanNodes()
if res == 1: print "Removed %d nodes!" % res
else: print "KO nodes removing."
if res == 1: print("Removed %d nodes!" % res)
else: print("KO nodes removing.")

Some files were not shown because too many files have changed in this diff Show More