From: prascle Date: Thu, 21 Mar 2013 16:50:22 +0000 (+0000) Subject: PR: examples adaptation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ab477cd54e8fb68efeb6c5e5b8b06e08bc289e9a;p=modules%2Fsmesh.git PR: examples adaptation --- diff --git a/doc/salome/examples/cartesian_algo.py b/doc/salome/examples/cartesian_algo.py index b15455f28..dc0dc23cf 100644 --- a/doc/salome/examples/cartesian_algo.py +++ b/doc/salome/examples/cartesian_algo.py @@ -1,14 +1,24 @@ # Usage of Body Fitting algorithm -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create a sphere sphere = geompy.MakeSphereR( 50 ) geompy.addToStudy( sphere, "sphere" ) # create a mesh and assign a "Body Fitting" algo -mesh = Mesh( sphere ) +mesh = smesh.Mesh( sphere ) cartAlgo = mesh.BodyFitted() # define a cartesian grid using Coordinates diff --git a/doc/salome/examples/filters_ex01.py b/doc/salome/examples/filters_ex01.py index 986904774..86be38182 100644 --- a/doc/salome/examples/filters_ex01.py +++ b/doc/salome/examples/filters_ex01.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get faces with aspect ratio > 6.5 -filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5) ids = mesh.GetIdsFromFilter(filter) print "Number of faces with aspect ratio > 6.5:", len(ids) diff --git a/doc/salome/examples/filters_ex02.py b/doc/salome/examples/filters_ex02.py index f69217398..5709ef4b0 100644 --- a/doc/salome/examples/filters_ex02.py +++ b/doc/salome/examples/filters_ex02.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get volumes with aspect ratio < 2.0 -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 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) diff --git a/doc/salome/examples/filters_ex03.py b/doc/salome/examples/filters_ex03.py index 5afe3a44e..c9313bceb 100644 --- a/doc/salome/examples/filters_ex03.py +++ b/doc/salome/examples/filters_ex03.py @@ -3,7 +3,7 @@ # create mesh from SMESH_mechanic import * # get faces with warping angle = 2.0e-13 with tolerance 5.0e-14 -criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13) +criterion = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_EqualTo, 2.0e-13) criterion.Tolerance = 5.0e-14 filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion]) diff --git a/doc/salome/examples/filters_ex04.py b/doc/salome/examples/filters_ex04.py index d4d31a76c..fef619c80 100644 --- a/doc/salome/examples/filters_ex04.py +++ b/doc/salome/examples/filters_ex04.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get faces with minimum angle > 75 -filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle,">", 75) ids = mesh.GetIdsFromFilter(filter) print "Number of faces with minimum angle > 75:", len(ids) diff --git a/doc/salome/examples/filters_ex05.py b/doc/salome/examples/filters_ex05.py index b15225194..c1c185275 100644 --- a/doc/salome/examples/filters_ex05.py +++ b/doc/salome/examples/filters_ex05.py @@ -3,6 +3,6 @@ # create mesh 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) +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) diff --git a/doc/salome/examples/filters_ex06.py b/doc/salome/examples/filters_ex06.py index 0f609a569..610a9a9e8 100644 --- a/doc/salome/examples/filters_ex06.py +++ b/doc/salome/examples/filters_ex06.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get faces with skew > 50 -filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 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) diff --git a/doc/salome/examples/filters_ex07.py b/doc/salome/examples/filters_ex07.py index 723d8d282..6c42d5217 100644 --- a/doc/salome/examples/filters_ex07.py +++ b/doc/salome/examples/filters_ex07.py @@ -3,9 +3,9 @@ # create mesh from SMESH_mechanic import * # get faces with area > 60 and < 90 -criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\ - smesh.FT_Undefined, smesh.FT_LogicalAND) -criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90) +criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60,\ + SMESH.FT_Undefined, SMESH.FT_LogicalAND) +criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90) filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion1,criterion2]) ids = mesh.GetIdsFromFilter(filter) diff --git a/doc/salome/examples/filters_ex08.py b/doc/salome/examples/filters_ex08.py index 2bc96b672..d87f97453 100644 --- a/doc/salome/examples/filters_ex08.py +++ b/doc/salome/examples/filters_ex08.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get volumes faces with volume > 100 -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 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) diff --git a/doc/salome/examples/filters_ex09.py b/doc/salome/examples/filters_ex09.py index 0d045b7b7..9efa00871 100644 --- a/doc/salome/examples/filters_ex09.py +++ b/doc/salome/examples/filters_ex09.py @@ -1,7 +1,17 @@ # Free borders # create mesh -import geompy, smesh, StdMeshers + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + face = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( face, "quadrangle" ) mesh = smesh.Mesh(face) @@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(25) mesh.Compute() # get all free borders -filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) +filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) ids = mesh.GetIdsFromFilter(filter) print "Number of edges on free borders:", len(ids) diff --git a/doc/salome/examples/filters_ex10.py b/doc/salome/examples/filters_ex10.py index bbbdd9889..423b91029 100644 --- a/doc/salome/examples/filters_ex10.py +++ b/doc/salome/examples/filters_ex10.py @@ -1,7 +1,17 @@ # Free edges # create mesh -import geompy, smesh, StdMeshers + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + face = geompy.MakeFaceHW(100, 100, 1) geompy.addToStudy( face, "quadrangle" ) mesh = smesh.Mesh(face) @@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(25) mesh.Compute() # get all faces with free edges -filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeEdges) ids = mesh.GetIdsFromFilter(filter) print "Number of faces with free edges:", len(ids) diff --git a/doc/salome/examples/filters_ex11.py b/doc/salome/examples/filters_ex11.py index 4d754bc00..5f1bf4c68 100644 --- a/doc/salome/examples/filters_ex11.py +++ b/doc/salome/examples/filters_ex11.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * # add node mesh.AddNode(0,0,0) # get all free nodes -filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) +filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes) ids = mesh.GetIdsFromFilter(filter) print "Number of free nodes:", len(ids) diff --git a/doc/salome/examples/filters_ex12.py b/doc/salome/examples/filters_ex12.py index dfb0f40ba..a1f20dcf3 100644 --- a/doc/salome/examples/filters_ex12.py +++ b/doc/salome/examples/filters_ex12.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get all free faces -filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces) ids = mesh.GetIdsFromFilter(filter) print "Number of free faces:", len(ids) diff --git a/doc/salome/examples/filters_ex13.py b/doc/salome/examples/filters_ex13.py index e20937d1b..f56d39f84 100644 --- a/doc/salome/examples/filters_ex13.py +++ b/doc/salome/examples/filters_ex13.py @@ -3,8 +3,8 @@ # create mesh from SMESH_mechanic import * # remove some faces to have faces with bare borders -mesh.RemoveElements( mesh.GetElementsByType(smesh.FACE)[0:5] ) +mesh.RemoveElements( mesh.GetElementsByType(SMESH.FACE)[0:5] ) # get all faces bare borders -filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BareBorderFace) ids = mesh.GetIdsFromFilter(filter) print "Faces with bare borders:", ids diff --git a/doc/salome/examples/filters_ex14.py b/doc/salome/examples/filters_ex14.py index 01ea27ab9..a9021f98c 100644 --- a/doc/salome/examples/filters_ex14.py +++ b/doc/salome/examples/filters_ex14.py @@ -2,8 +2,8 @@ # create mesh from SMESH_mechanic import * -faceID = mesh.GetElementsByType(smesh.FACE)[0] +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) +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) diff --git a/doc/salome/examples/filters_ex15.py b/doc/salome/examples/filters_ex15.py index 2044c6048..3f1344704 100644 --- a/doc/salome/examples/filters_ex15.py +++ b/doc/salome/examples/filters_ex15.py @@ -2,6 +2,6 @@ # create mesh from SMESH_mechanic import * # get all over-constrained faces -filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_OverConstrainedFace) ids = mesh.GetIdsFromFilter(filter) print "Over-constrained faces:", ids diff --git a/doc/salome/examples/filters_ex16.py b/doc/salome/examples/filters_ex16.py index 3c7159d9f..b7d8b2b1c 100644 --- a/doc/salome/examples/filters_ex16.py +++ b/doc/salome/examples/filters_ex16.py @@ -1,6 +1,17 @@ # Double edges, Double faces, Double volumes -from smesh import * + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # make a mesh on a box box = geompy.MakeBoxDXDYDZ(100,100,100) mesh = Mesh( box, "Box" ) @@ -12,9 +23,9 @@ mesh.Compute() mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True ) mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) ) # create filters to find equal elements -equalEdgesFilter = GetFilter(SMESH.EDGE, FT_EqualEdges) -equalFacesFilter = GetFilter(SMESH.FACE, FT_EqualFaces) -equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes) +equalEdgesFilter = GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges) +equalFacesFilter = GetFilter(SMESH.FACE, SMESH.FT_EqualFaces) +equalVolumesFilter = 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 )) diff --git a/doc/salome/examples/filters_ex17.py b/doc/salome/examples/filters_ex17.py index b79f4a74d..716feef50 100644 --- a/doc/salome/examples/filters_ex17.py +++ b/doc/salome/examples/filters_ex17.py @@ -1,6 +1,17 @@ # Double nodes -from smesh import * + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # make a mesh on a box box = geompy.MakeBoxDXDYDZ(100,100,100) mesh = Mesh( box, "Box" ) diff --git a/doc/salome/examples/filters_ex18.py b/doc/salome/examples/filters_ex18.py index 30158e28b..805f54e06 100644 --- a/doc/salome/examples/filters_ex18.py +++ b/doc/salome/examples/filters_ex18.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get border edges with number of connected faces = 5 -filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 5) +filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, 5) ids = mesh.GetIdsFromFilter(filter) print "Number of border edges with 5 faces connected:", len(ids) diff --git a/doc/salome/examples/filters_ex19.py b/doc/salome/examples/filters_ex19.py index 41b7cc762..3ac78794f 100644 --- a/doc/salome/examples/filters_ex19.py +++ b/doc/salome/examples/filters_ex19.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get faces which consist of edges belonging to 2 mesh elements -filter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, 2) +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) diff --git a/doc/salome/examples/filters_ex20.py b/doc/salome/examples/filters_ex20.py index 37227c49d..1bdc00b53 100644 --- a/doc/salome/examples/filters_ex20.py +++ b/doc/salome/examples/filters_ex20.py @@ -3,6 +3,6 @@ # create mesh from SMESH_mechanic import * # get edges with length > 14 -filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 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) diff --git a/doc/salome/examples/filters_ex21.py b/doc/salome/examples/filters_ex21.py index 0882fe294..79c88434b 100644 --- a/doc/salome/examples/filters_ex21.py +++ b/doc/salome/examples/filters_ex21.py @@ -3,6 +3,6 @@ # create mesh 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) +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) diff --git a/doc/salome/examples/filters_ex22.py b/doc/salome/examples/filters_ex22.py index f65421786..0271110fe 100644 --- a/doc/salome/examples/filters_ex22.py +++ b/doc/salome/examples/filters_ex22.py @@ -3,6 +3,6 @@ # create mesh 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) +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) diff --git a/doc/salome/examples/filters_ex23.py b/doc/salome/examples/filters_ex23.py index 848f8d92c..49569dfe8 100644 --- a/doc/salome/examples/filters_ex23.py +++ b/doc/salome/examples/filters_ex23.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get all volumes that have elements with length > 10 -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 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) diff --git a/doc/salome/examples/filters_ex24.py b/doc/salome/examples/filters_ex24.py index 036ba037e..bab47e2a7 100644 --- a/doc/salome/examples/filters_ex24.py +++ b/doc/salome/examples/filters_ex24.py @@ -7,6 +7,6 @@ mesh.Compute() # remove some volumes to have volumes with bare borders mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] ) # get all volumes with bare borders -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume) +filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BareBorderVolume) ids = mesh.GetIdsFromFilter(filter) print "Volumes with bare borders:", ids diff --git a/doc/salome/examples/filters_ex25.py b/doc/salome/examples/filters_ex25.py index 7e4489848..06862c75f 100644 --- a/doc/salome/examples/filters_ex25.py +++ b/doc/salome/examples/filters_ex25.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get all over-constrained volumes -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume) +filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_OverConstrainedVolume) ids = mesh.GetIdsFromFilter(filter) print "Over-constrained volumes:", ids diff --git a/doc/salome/examples/filters_ex26.py b/doc/salome/examples/filters_ex26.py index 3c5ce2965..d544466e4 100644 --- a/doc/salome/examples/filters_ex26.py +++ b/doc/salome/examples/filters_ex26.py @@ -3,6 +3,6 @@ # create mesh 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) +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) diff --git a/doc/salome/examples/filters_ex27.py b/doc/salome/examples/filters_ex27.py index 10067ea07..4c38bd92f 100644 --- a/doc/salome/examples/filters_ex27.py +++ b/doc/salome/examples/filters_ex27.py @@ -3,6 +3,6 @@ # create mesh 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) +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) diff --git a/doc/salome/examples/filters_ex28.py b/doc/salome/examples/filters_ex28.py index 032b966a5..12da64cc7 100644 --- a/doc/salome/examples/filters_ex28.py +++ b/doc/salome/examples/filters_ex28.py @@ -3,10 +3,9 @@ # create mesh from SMESH_mechanic import * # create plane -import geompy plane_1 = geompy.MakePlane(p3,seg1,2000) 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) +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) diff --git a/doc/salome/examples/filters_ex29.py b/doc/salome/examples/filters_ex29.py index c256724b3..b4a454ad7 100644 --- a/doc/salome/examples/filters_ex29.py +++ b/doc/salome/examples/filters_ex29.py @@ -3,6 +3,6 @@ # create mesh 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) +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) diff --git a/doc/salome/examples/filters_ex30.py b/doc/salome/examples/filters_ex30.py index 19c213810..9d161a763 100644 --- a/doc/salome/examples/filters_ex30.py +++ b/doc/salome/examples/filters_ex30.py @@ -7,6 +7,6 @@ spline_1 = geompy.MakeInterpol([p4,p6,p3,p1]) surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 ) 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) +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) diff --git a/doc/salome/examples/filters_ex31.py b/doc/salome/examples/filters_ex31.py index 4a2acbfa8..ea9b99e0e 100644 --- a/doc/salome/examples/filters_ex31.py +++ b/doc/salome/examples/filters_ex31.py @@ -3,9 +3,9 @@ # create mesh from SMESH_mechanic import * # get nodes with identifiers [5-10] and [15-30] -criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="5-10",\ - BinaryOp=smesh.FT_LogicalOR) -criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="15-30") +criterion1 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="5-10",\ + BinaryOp=SMESH.FT_LogicalOR) +criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-30") filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion1,criterion2]) ids = mesh.GetIdsFromFilter(filter) diff --git a/doc/salome/examples/filters_ex32.py b/doc/salome/examples/filters_ex32.py index 726ca153f..5ce64d625 100644 --- a/doc/salome/examples/filters_ex32.py +++ b/doc/salome/examples/filters_ex32.py @@ -5,6 +5,6 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get all badly oriented volumes -filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume) +filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BadOrientedVolume) ids = mesh.GetIdsFromFilter(filter) print "Number of badly oriented volumes:", len(ids) diff --git a/doc/salome/examples/filters_ex33.py b/doc/salome/examples/filters_ex33.py index 2fbaab03e..c844e9063 100644 --- a/doc/salome/examples/filters_ex33.py +++ b/doc/salome/examples/filters_ex33.py @@ -3,8 +3,8 @@ # create mesh from SMESH_mechanic import * # get number of linear and quadratic edges -filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic) -filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT) +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) diff --git a/doc/salome/examples/filters_ex34.py b/doc/salome/examples/filters_ex34.py index 8e63056b4..980509dbe 100644 --- a/doc/salome/examples/filters_ex34.py +++ b/doc/salome/examples/filters_ex34.py @@ -3,12 +3,12 @@ # create mesh 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]) +all_edges = mesh.GetElementsByType(SMESH.EDGE) +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) +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) diff --git a/doc/salome/examples/filters_ex35.py b/doc/salome/examples/filters_ex35.py index 369d7323a..4a3c2bd3c 100644 --- a/doc/salome/examples/filters_ex35.py +++ b/doc/salome/examples/filters_ex35.py @@ -5,10 +5,10 @@ from SMESH_mechanic import * mesh.Tetrahedron() mesh.Compute() # get all triangles, quadrangles, tetrahedrons, pyramids -filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE) -filter_qua = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE) -filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA) -filter_pyr = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_PYRAMID) +filter_tri = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_TRIANGLE) +filter_qua = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_QUADRANGLE) +filter_tet = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_TETRA) +filter_pyr = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_PYRAMID) ids_tri = mesh.GetIdsFromFilter(filter_tri) ids_qua = mesh.GetIdsFromFilter(filter_qua) ids_tet = mesh.GetIdsFromFilter(filter_tet) diff --git a/doc/salome/examples/filters_ex36.py b/doc/salome/examples/filters_ex36.py index 7675bc9f6..9e3e1dd77 100644 --- a/doc/salome/examples/filters_ex36.py +++ b/doc/salome/examples/filters_ex36.py @@ -3,11 +3,11 @@ # create mesh from SMESH_mechanic import * # get all the quadrangle faces ... -criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE, smesh.FT_LogicalAND) +criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_QUADRANGLE, SMESH.FT_LogicalAND) # ... AND do NOT get those from sub_face3 -criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_BelongToGeom, sub_face3, smesh.FT_LogicalNOT) +criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3, SMESH.FT_LogicalNOT) filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion1,criterion2]) ids = mesh.GetIdsFromFilter(filter) -myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids) +myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",SMESH.FACE,ids) diff --git a/doc/salome/examples/generate_flat_elements.py b/doc/salome/examples/generate_flat_elements.py index a23c200a4..df187188b 100644 --- a/doc/salome/examples/generate_flat_elements.py +++ b/doc/salome/examples/generate_flat_elements.py @@ -3,9 +3,17 @@ # This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder). # The big cylinder is defined by two geometric volumes. -import geompy -import smesh -import SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + # geometry @@ -21,22 +29,22 @@ Vertex_3 = geompy.MakeVertex(250, 200, 200) Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3) Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2) Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) -[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN) -[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN) +[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN) +[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN) Vertex_4 = geompy.MakeVertex(450, 0, 0) Vertex_5 = geompy.MakeVertex(500, 0, 0) Vertex_6 = geompy.MakeVertex(550, 0, 0) vec1 = geompy.MakeVector(Vertex_4, Vertex_5) vec2 = geompy.MakeVector(Vertex_5, Vertex_6) -[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON) -[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON) +[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, GEOM.ST_ON) +[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON) # meshing (we have linear tetrahedrons here, but other elements are OK) Mesh_1 = smesh.Mesh(Partition_1) Regular_1D = Mesh_1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(15) -MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO) +MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO) Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges() ALGO3D = Mesh_1.Tetrahedron() isDone = Mesh_1.Compute() diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py index d0971d621..4ed2abe9d 100644 --- a/doc/salome/examples/grouping_elements_ex01.py +++ b/doc/salome/examples/grouping_elements_ex01.py @@ -7,15 +7,15 @@ mesh = SMESH_mechanic.mesh salome = SMESH_mechanic.salome # Get ids of all faces with area > 100 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.) anIds = mesh.GetIdsFromFilter(aFilter) # create a group consisting of faces with area > 100 -aGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds) +aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds) # create a group that contains all nodes from the mesh -aGroup2 = mesh.CreateEmptyGroup(smesh.NODE, "all nodes") +aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes") aGroup2.AddFrom(mesh.mesh) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/grouping_elements_ex02.py b/doc/salome/examples/grouping_elements_ex02.py index 228248d7f..909a9b482 100644 --- a/doc/salome/examples/grouping_elements_ex02.py +++ b/doc/salome/examples/grouping_elements_ex02.py @@ -1,8 +1,15 @@ # Create a Group on Geometry + import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBox(0., 0., 0., 100., 100., 100.) diff --git a/doc/salome/examples/grouping_elements_ex03.py b/doc/salome/examples/grouping_elements_ex03.py index 05fb69d57..b6e536a35 100644 --- a/doc/salome/examples/grouping_elements_ex03.py +++ b/doc/salome/examples/grouping_elements_ex03.py @@ -1,7 +1,17 @@ # Create a Group on Filter -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(10,10,10) diff --git a/doc/salome/examples/grouping_elements_ex04.py b/doc/salome/examples/grouping_elements_ex04.py index 730a2ca6b..85f9cd757 100644 --- a/doc/salome/examples/grouping_elements_ex04.py +++ b/doc/salome/examples/grouping_elements_ex04.py @@ -7,18 +7,18 @@ mesh = SMESH_mechanic.mesh salome = SMESH_mechanic.salome # Get ids of all faces with area > 35 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area > 35, Nb = ", len(anIds) # create a group by adding elements with area > 35 -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35") +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 35") aGroup.Add(anIds) # Get ids of all faces with area > 40 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.) anIds = mesh.GetIdsFromFilter(aFilter) diff --git a/doc/salome/examples/grouping_elements_ex05.py b/doc/salome/examples/grouping_elements_ex05.py index 90453fed1..360eb5055 100644 --- a/doc/salome/examples/grouping_elements_ex05.py +++ b/doc/salome/examples/grouping_elements_ex05.py @@ -7,25 +7,25 @@ mesh = SMESH_mechanic.mesh salome = SMESH_mechanic.salome # Criterion : AREA > 20 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area > 20, Nb = ", len( anIds ) # create a group by adding elements with area > 20 -aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20") +aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20") aGroup1.Add(anIds) # Criterion : AREA = 20 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area = 20, Nb = ", len( anIds ) # create a group by adding elements with area = 20 -aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" ) +aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" ) aGroup2.Add(anIds) @@ -35,14 +35,14 @@ 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 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area < 20, Nb = ", len(anIds) # create a group by adding elements with area < 20 -aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20") +aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20") aGroup4.Add(anIds) # create union group : area >= 20 and area < 20 diff --git a/doc/salome/examples/grouping_elements_ex06.py b/doc/salome/examples/grouping_elements_ex06.py index cc8146fb9..126660b54 100644 --- a/doc/salome/examples/grouping_elements_ex06.py +++ b/doc/salome/examples/grouping_elements_ex06.py @@ -7,25 +7,25 @@ mesh = SMESH_mechanic.mesh salome = SMESH_mechanic.salome # Criterion : AREA > 20 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area > 20, Nb = ", len(anIds) # create a group by adding elements with area > 20 -aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20") +aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20") aGroup1.Add(anIds) # Criterion : AREA < 60 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area < 60, Nb = ", len(anIds) # create a group by adding elements with area < 60 -aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60") +aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60") aGroup2.Add(anIds) # create an intersection of groups : 20 < area < 60 diff --git a/doc/salome/examples/grouping_elements_ex07.py b/doc/salome/examples/grouping_elements_ex07.py index 5bcccd0c7..cfb882f8f 100644 --- a/doc/salome/examples/grouping_elements_ex07.py +++ b/doc/salome/examples/grouping_elements_ex07.py @@ -7,24 +7,24 @@ mesh = SMESH_mechanic.mesh salome = SMESH_mechanic.salome # Criterion : AREA > 20 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area > 20, Nb = ", len(anIds) # create a group by adding elements with area > 20 -aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds) +aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds) # Criterion : AREA < 60 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area < 60, Nb = ", len(anIds) # create a group by adding elements with area < 60 -aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds) +aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds) # create a cut of groups : area >= 60 aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60") diff --git a/doc/salome/examples/grouping_elements_ex08.py b/doc/salome/examples/grouping_elements_ex08.py index a86ec6317..d5f489cd5 100644 --- a/doc/salome/examples/grouping_elements_ex08.py +++ b/doc/salome/examples/grouping_elements_ex08.py @@ -7,29 +7,29 @@ mesh = SMESH_mechanic.mesh salome = SMESH_mechanic.salome # Criterion : AREA > 100 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area > 100, Nb = ", len(anIds) # create a group by adding elements with area > 100 -aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds) +aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds) # Criterion : AREA < 30 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.) anIds = mesh.GetIdsFromFilter(aFilter) print "Criterion: Area < 30, Nb = ", len(anIds) # create a group by adding elements with area < 30 -aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds) +aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", SMESH.FACE, anIds) # Create group of edges using source groups of faces -aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" ) +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" ) +aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.NODE, "Nodes" ) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/measurements_ex01.py b/doc/salome/examples/measurements_ex01.py index 967754709..d8a5bd71c 100644 --- a/doc/salome/examples/measurements_ex01.py +++ b/doc/salome/examples/measurements_ex01.py @@ -1,6 +1,16 @@ # Minimum Distance -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + from SMESH_mechanic import mesh as mesh1 from SMESH_test1 import mesh as mesh2 diff --git a/doc/salome/examples/measurements_ex02.py b/doc/salome/examples/measurements_ex02.py index 3333bc0e5..b5fbf8b1f 100644 --- a/doc/salome/examples/measurements_ex02.py +++ b/doc/salome/examples/measurements_ex02.py @@ -1,6 +1,17 @@ # Bounding Box -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + from SMESH_mechanic import mesh as mesh1 from SMESH_test1 import mesh as mesh2 diff --git a/doc/salome/examples/modifying_meshes_ex01.py b/doc/salome/examples/modifying_meshes_ex01.py index ee183d708..434cc1a7e 100644 --- a/doc/salome/examples/modifying_meshes_ex01.py +++ b/doc/salome/examples/modifying_meshes_ex01.py @@ -1,6 +1,17 @@ # Add Node -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex02.py b/doc/salome/examples/modifying_meshes_ex02.py index c99bf2aff..563295c54 100644 --- a/doc/salome/examples/modifying_meshes_ex02.py +++ b/doc/salome/examples/modifying_meshes_ex02.py @@ -1,6 +1,17 @@ # Add 0D Element -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex03.py b/doc/salome/examples/modifying_meshes_ex03.py index 19b423e03..beefe20ce 100644 --- a/doc/salome/examples/modifying_meshes_ex03.py +++ b/doc/salome/examples/modifying_meshes_ex03.py @@ -1,6 +1,17 @@ # Add 0D Element on Element Nodes -import smesh, SMESH, geompy + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create a geometry box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) diff --git a/doc/salome/examples/modifying_meshes_ex09.py b/doc/salome/examples/modifying_meshes_ex09.py index 2fd91114d..476ebbbdc 100644 --- a/doc/salome/examples/modifying_meshes_ex09.py +++ b/doc/salome/examples/modifying_meshes_ex09.py @@ -1,9 +1,18 @@ # Add Polygon import math + import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook -import smesh # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex10.py b/doc/salome/examples/modifying_meshes_ex10.py index 1d1af1942..894fe9d4c 100644 --- a/doc/salome/examples/modifying_meshes_ex10.py +++ b/doc/salome/examples/modifying_meshes_ex10.py @@ -1,7 +1,17 @@ # Add Polyhedron + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + import math # create an empty mesh structure diff --git a/doc/salome/examples/modifying_meshes_ex15.py b/doc/salome/examples/modifying_meshes_ex15.py index 49676d0ee..7fd1e8681 100644 --- a/doc/salome/examples/modifying_meshes_ex15.py +++ b/doc/salome/examples/modifying_meshes_ex15.py @@ -1,7 +1,17 @@ # Moving Nodes -from geompy import * -from smesh import * + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = MakeBoxDXDYDZ(200, 200, 200) diff --git a/doc/salome/examples/modifying_meshes_ex16.py b/doc/salome/examples/modifying_meshes_ex16.py index 6567dff19..076cebf6c 100644 --- a/doc/salome/examples/modifying_meshes_ex16.py +++ b/doc/salome/examples/modifying_meshes_ex16.py @@ -1,7 +1,17 @@ # Diagonal Inversion + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex17.py b/doc/salome/examples/modifying_meshes_ex17.py index 732953ab2..c45fd2829 100644 --- a/doc/salome/examples/modifying_meshes_ex17.py +++ b/doc/salome/examples/modifying_meshes_ex17.py @@ -1,7 +1,17 @@ # Uniting two Triangles + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex18.py b/doc/salome/examples/modifying_meshes_ex18.py index 9f7393022..60b395af9 100644 --- a/doc/salome/examples/modifying_meshes_ex18.py +++ b/doc/salome/examples/modifying_meshes_ex18.py @@ -1,7 +1,17 @@ # Uniting a Set of Triangles + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() @@ -37,7 +47,7 @@ ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) # unite a set of triangles print "\nUnite a set of triangles ... ", -res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], smesh.FT_MinimumAngle, 60.) +res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], SMESH.FT_MinimumAngle, 60.) if not res: print "failed!" else: print "done." diff --git a/doc/salome/examples/modifying_meshes_ex19.py b/doc/salome/examples/modifying_meshes_ex19.py index c3eaf4977..7223fb099 100644 --- a/doc/salome/examples/modifying_meshes_ex19.py +++ b/doc/salome/examples/modifying_meshes_ex19.py @@ -1,7 +1,17 @@ # Orientation + import salome -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create an empty mesh structure mesh = smesh.Mesh() diff --git a/doc/salome/examples/modifying_meshes_ex20.py b/doc/salome/examples/modifying_meshes_ex20.py index aa52da784..3b81983df 100644 --- a/doc/salome/examples/modifying_meshes_ex20.py +++ b/doc/salome/examples/modifying_meshes_ex20.py @@ -6,4 +6,4 @@ smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # cut two quadrangles: 405 and 406 -mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle) +mesh.QuadToTri([405, 406], SMESH.FT_MinimumAngle) diff --git a/doc/salome/examples/modifying_meshes_ex21.py b/doc/salome/examples/modifying_meshes_ex21.py index ece705c7d..50355fd8b 100644 --- a/doc/salome/examples/modifying_meshes_ex21.py +++ b/doc/salome/examples/modifying_meshes_ex21.py @@ -1,11 +1,19 @@ # Smoothing + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import SMESH_mechanic -smesh = SMESH_mechanic.smesh +#smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # select the top face @@ -14,7 +22,7 @@ face = faces[3] geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole") # create a group of faces to be smoothed -GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", smesh.FACE) +GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE) # perform smoothing diff --git a/doc/salome/examples/modifying_meshes_ex22.py b/doc/salome/examples/modifying_meshes_ex22.py index e9dcb3c96..e867a35c1 100644 --- a/doc/salome/examples/modifying_meshes_ex22.py +++ b/doc/salome/examples/modifying_meshes_ex22.py @@ -1,11 +1,19 @@ # Extrusion + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import SMESH_mechanic -smesh = SMESH_mechanic.smesh +#smesh = SMESH_mechanic.smesh mesh = SMESH_mechanic.mesh # select the top face @@ -18,7 +26,7 @@ point = smesh.PointStruct(0., 0., 5.) vector = smesh.DirStruct(point) # create a group to be extruded -GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", smesh.FACE) +GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", SMESH.FACE) # perform extrusion of the group mesh.ExtrusionSweepObject(GroupTri, vector, 5) diff --git a/doc/salome/examples/modifying_meshes_ex23.py b/doc/salome/examples/modifying_meshes_ex23.py index a789b76f0..cd1be2252 100644 --- a/doc/salome/examples/modifying_meshes_ex23.py +++ b/doc/salome/examples/modifying_meshes_ex23.py @@ -1,10 +1,16 @@ # Extrusion along a Path import math + import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -# Geometry -import geompy +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # 1. Create points points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]] @@ -36,7 +42,6 @@ for ii in range(len(Wire_polyline_edges)): pass # Mesh -import smesh # Mesh the given shape with the given 1d hypothesis def Mesh1D(shape1d, nbSeg, name): diff --git a/doc/salome/examples/modifying_meshes_ex25.py b/doc/salome/examples/modifying_meshes_ex25.py index e8801e003..e58eed696 100644 --- a/doc/salome/examples/modifying_meshes_ex25.py +++ b/doc/salome/examples/modifying_meshes_ex25.py @@ -1,7 +1,15 @@ # Pattern Mapping -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # define the geometry Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.) diff --git a/doc/salome/examples/modifying_meshes_ex26.py b/doc/salome/examples/modifying_meshes_ex26.py index aa8cb4379..4a8eba75e 100644 --- a/doc/salome/examples/modifying_meshes_ex26.py +++ b/doc/salome/examples/modifying_meshes_ex26.py @@ -1,7 +1,15 @@ # Convert mesh to/from quadratic -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create sphere of radius 100 diff --git a/doc/salome/examples/notebook_smesh.py b/doc/salome/examples/notebook_smesh.py index 9cccc7b5b..084a43665 100644 --- a/doc/salome/examples/notebook_smesh.py +++ b/doc/salome/examples/notebook_smesh.py @@ -1,7 +1,15 @@ # Using SALOME NoteBook -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import salome_notebook # set variables diff --git a/doc/salome/examples/quality_controls_ex01.py b/doc/salome/examples/quality_controls_ex01.py index f411d2e61..0f73a5619 100644 --- a/doc/salome/examples/quality_controls_ex01.py +++ b/doc/salome/examples/quality_controls_ex01.py @@ -1,9 +1,15 @@ # Free Borders + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -21,7 +27,7 @@ algo.MaxElementArea(20.) mesh.Compute() # criterion : free borders -aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) +aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) anIds = mesh.GetIdsFromFilter(aFilter) # print the result @@ -35,7 +41,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Free borders") +aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders") aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex02.py b/doc/salome/examples/quality_controls_ex02.py index 5373c4d6f..491c81eb4 100644 --- a/doc/salome/examples/quality_controls_ex02.py +++ b/doc/salome/examples/quality_controls_ex02.py @@ -1,10 +1,15 @@ # Borders at Multiconnection + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh -import SMESH +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -24,7 +29,7 @@ mesh.Compute() # Criterion : Borders at multi-connection nb_conn = 2 -aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn) +aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn) anIds = mesh.GetIdsFromFilter(aFilter) # print the result @@ -38,7 +43,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Borders at multi-connections") +aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Borders at multi-connections") aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex03.py b/doc/salome/examples/quality_controls_ex03.py index eaa607b94..b1da190f5 100644 --- a/doc/salome/examples/quality_controls_ex03.py +++ b/doc/salome/examples/quality_controls_ex03.py @@ -1,9 +1,15 @@ # Length 1D + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -23,7 +29,7 @@ mesh.Compute() # Criterion : Length > 3. length_margin = 3. -aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin) +aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length_margin) anIds = mesh.GetIdsFromFilter(aFilter) # print the result @@ -37,7 +43,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Edges with length > " + `length_margin`) +aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex04.py b/doc/salome/examples/quality_controls_ex04.py index d26eb4d82..73fb7fbe5 100644 --- a/doc/salome/examples/quality_controls_ex04.py +++ b/doc/salome/examples/quality_controls_ex04.py @@ -12,7 +12,7 @@ aFilterMgr = smesh.CreateFilterManager() # Criterion : AREA > 95. area_margin = 95. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -22,8 +22,8 @@ mesh.RemoveElements(anIds) aBorders = mesh.GetFreeBorders() # create groups -aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges") -aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges") +aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges") +aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges") # fill groups with elements, corresponding to the criterion print "" diff --git a/doc/salome/examples/quality_controls_ex05.py b/doc/salome/examples/quality_controls_ex05.py index 90c7c0451..d76e41579 100644 --- a/doc/salome/examples/quality_controls_ex05.py +++ b/doc/salome/examples/quality_controls_ex05.py @@ -1,9 +1,15 @@ # Free Nodes + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create box box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) @@ -21,18 +27,18 @@ mesh.Compute() # Criterion : AREA < 80. area_margin = 80. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, area_margin) anIds = mesh.GetIdsFromFilter(aFilter) mesh.RemoveElements(anIds) # criterion : free nodes -aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) +aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes) anNodeIds = mesh.GetIdsFromFilter(aFilter) # create a group -aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes") +aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes") aGroup.Add(anNodeIds) # print the result diff --git a/doc/salome/examples/quality_controls_ex06.py b/doc/salome/examples/quality_controls_ex06.py index 2fe67abf6..861206bb3 100644 --- a/doc/salome/examples/quality_controls_ex06.py +++ b/doc/salome/examples/quality_controls_ex06.py @@ -1,7 +1,15 @@ # Free Faces + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) ####### GEOM part ######## @@ -30,9 +38,6 @@ geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" ) geompy.addToStudy( Plane_2, "Plane_2" ) ###### SMESH part ###### -import smesh - -import StdMeshers Mesh_1 = smesh.Mesh(Partition_1) Regular_1D = Mesh_1.Segment() @@ -42,10 +47,10 @@ Tetrahedronn = Mesh_1.Tetrahedron() isDone = Mesh_1.Compute() # create a group of free faces -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces ) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces ) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter) -aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces") +aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces") aGroup.Add(aFaceIds) # print the result @@ -59,15 +64,15 @@ for i in range(len(aFaceIds)): print "" #filter faces from plane 2 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_2) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter) aGroup.Remove(aFaceIds) # create a group of shared faces (located on partition boundary inside box) -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_1) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter) -aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces") +aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Shared_faces") aGroup.Add(aFaceIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex07.py b/doc/salome/examples/quality_controls_ex07.py index a2be02932..e8ef561a4 100644 --- a/doc/salome/examples/quality_controls_ex07.py +++ b/doc/salome/examples/quality_controls_ex07.py @@ -1,7 +1,17 @@ # Bare border faces -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(100, 100, 100) geompy.addToStudy( box, "box" ) diff --git a/doc/salome/examples/quality_controls_ex08.py b/doc/salome/examples/quality_controls_ex08.py index 77e7e4c94..4835135b6 100644 --- a/doc/salome/examples/quality_controls_ex08.py +++ b/doc/salome/examples/quality_controls_ex08.py @@ -1,7 +1,17 @@ # Bare border volumes -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(100, 30, 10) # the smallest face of the box diff --git a/doc/salome/examples/quality_controls_ex09.py b/doc/salome/examples/quality_controls_ex09.py index c4ca44e80..3bacd93ed 100644 --- a/doc/salome/examples/quality_controls_ex09.py +++ b/doc/salome/examples/quality_controls_ex09.py @@ -1,7 +1,17 @@ # Over-constrained faces -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + mesh = Mesh() faceFilter = GetFilter(FACE,FT_OverConstrainedFace) diff --git a/doc/salome/examples/quality_controls_ex10.py b/doc/salome/examples/quality_controls_ex10.py index 49ef2e72a..7896b83e7 100644 --- a/doc/salome/examples/quality_controls_ex10.py +++ b/doc/salome/examples/quality_controls_ex10.py @@ -1,7 +1,17 @@ # Over-constrained volumes -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + mesh = Mesh() volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume) diff --git a/doc/salome/examples/quality_controls_ex11.py b/doc/salome/examples/quality_controls_ex11.py index ca955b6ab..69352be34 100644 --- a/doc/salome/examples/quality_controls_ex11.py +++ b/doc/salome/examples/quality_controls_ex11.py @@ -1,9 +1,15 @@ # Length 2D + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create open shell: a box without one plane box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -23,7 +29,7 @@ mesh.Compute() # Criterion : Length 2D > 5.7 length_margin = 5.7 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, length_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -38,7 +44,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with length 2D > " + `length_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex12.py b/doc/salome/examples/quality_controls_ex12.py index 28a0192c5..4ddcc387d 100644 --- a/doc/salome/examples/quality_controls_ex12.py +++ b/doc/salome/examples/quality_controls_ex12.py @@ -1,9 +1,15 @@ # Borders at Multiconnection 2D + import salome -import geompy +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a compound of two glued boxes box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.) @@ -23,7 +29,7 @@ mesh.Compute() # Criterion : MULTI-CONNECTION 2D = 3 nb_conn = 3 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_EqualTo, nb_conn) anIds = mesh.GetIdsFromFilter(aFilter) @@ -38,7 +44,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Borders at multi-connection 2D = " + `nb_conn`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex13.py b/doc/salome/examples/quality_controls_ex13.py index 1673fc737..7390cc494 100644 --- a/doc/salome/examples/quality_controls_ex13.py +++ b/doc/salome/examples/quality_controls_ex13.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : AREA > 100. area_margin = 100. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > " + `area_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex14.py b/doc/salome/examples/quality_controls_ex14.py index 379affdbd..04c2fb806 100644 --- a/doc/salome/examples/quality_controls_ex14.py +++ b/doc/salome/examples/quality_controls_ex14.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : Taper > 3e-20 taper_margin = 3e-20 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, taper_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Taper > " + `taper_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex15.py b/doc/salome/examples/quality_controls_ex15.py index 5ca56db0b..9a8754610 100644 --- a/doc/salome/examples/quality_controls_ex15.py +++ b/doc/salome/examples/quality_controls_ex15.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : ASPECT RATIO > 1.8 ar_margin = 1.8 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, ar_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Aspect Ratio > " + `ar_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex16.py b/doc/salome/examples/quality_controls_ex16.py index a20f38f7b..ecf1edc16 100644 --- a/doc/salome/examples/quality_controls_ex16.py +++ b/doc/salome/examples/quality_controls_ex16.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : MINIMUM ANGLE < 35. min_angle = 35. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, min_angle) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + `min_angle`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex17.py b/doc/salome/examples/quality_controls_ex17.py index fcc596c75..72726a450 100644 --- a/doc/salome/examples/quality_controls_ex17.py +++ b/doc/salome/examples/quality_controls_ex17.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : WARP ANGLE > 1e-15 wa_margin = 1e-15 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, wa_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + `wa_margin`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex18.py b/doc/salome/examples/quality_controls_ex18.py index 42e4b30e8..3d6a0bda0 100644 --- a/doc/salome/examples/quality_controls_ex18.py +++ b/doc/salome/examples/quality_controls_ex18.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : Skew > 38. skew_margin = 38. -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, skew_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Skew > " + `skew_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex19.py b/doc/salome/examples/quality_controls_ex19.py index abe195200..ddf897a89 100644 --- a/doc/salome/examples/quality_controls_ex19.py +++ b/doc/salome/examples/quality_controls_ex19.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome # Criterion : ELEMENT DIAMETER 2D > 10 mel_2d_margin = 10 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, mel_2d_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 2D > " + `mel_2d_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/quality_controls_ex20.py b/doc/salome/examples/quality_controls_ex20.py index 9e332e0dc..0468b90d3 100644 --- a/doc/salome/examples/quality_controls_ex20.py +++ b/doc/salome/examples/quality_controls_ex20.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic_tetra.salome # Criterion : ASPECT RATIO 3D > 4.5 ar_margin = 4.5 -aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin) +aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreThan, ar_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Aspect Ratio 3D > " + `ar_margin`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex21.py b/doc/salome/examples/quality_controls_ex21.py index 833ffff81..96b22839f 100644 --- a/doc/salome/examples/quality_controls_ex21.py +++ b/doc/salome/examples/quality_controls_ex21.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic_tetra.salome # Criterion : VOLUME < 7. volume_margin = 7. -aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin) +aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, volume_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -25,7 +25,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + `volume_margin`) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex22.py b/doc/salome/examples/quality_controls_ex22.py index 5264b1ade..97dfe9c84 100644 --- a/doc/salome/examples/quality_controls_ex22.py +++ b/doc/salome/examples/quality_controls_ex22.py @@ -9,7 +9,7 @@ salome = SMESH_mechanic_tetra.salome # Criterion : ELEMENT DIAMETER 3D > 10 mel_3d_margin = 10 -aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin) +aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, mel_3d_margin) anIds = mesh.GetIdsFromFilter(aFilter) @@ -24,7 +24,7 @@ for i in range(len(anIds)): print "" # create a group -aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 3D > " + `mel_3d_margin`) aGroup.Add(anIds) salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/transforming_meshes_ex03.py b/doc/salome/examples/transforming_meshes_ex03.py index da8105a67..a6f7701f8 100644 --- a/doc/salome/examples/transforming_meshes_ex03.py +++ b/doc/salome/examples/transforming_meshes_ex03.py @@ -1,11 +1,18 @@ # Scale -import geompy +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + Box = geompy.MakeBoxDXDYDZ(200, 200, 200) f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) -import smesh,SMESH -import StdMeshers Mesh1 = smesh.Mesh(f[0]) Regular_1D = Mesh1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(3) diff --git a/doc/salome/examples/transforming_meshes_ex06.py b/doc/salome/examples/transforming_meshes_ex06.py index fe8c91db3..209ce2a68 100644 --- a/doc/salome/examples/transforming_meshes_ex06.py +++ b/doc/salome/examples/transforming_meshes_ex06.py @@ -1,8 +1,15 @@ # Merging Elements + import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a face to be meshed px = geompy.MakeVertex(100., 0. , 0. ) diff --git a/doc/salome/examples/transforming_meshes_ex07.py b/doc/salome/examples/transforming_meshes_ex07.py index bb42d33eb..227eb636e 100644 --- a/doc/salome/examples/transforming_meshes_ex07.py +++ b/doc/salome/examples/transforming_meshes_ex07.py @@ -1,7 +1,15 @@ # Sew Meshes Border to Side -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create two faces of a box box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.) diff --git a/doc/salome/examples/transforming_meshes_ex08.py b/doc/salome/examples/transforming_meshes_ex08.py index e028735a0..77042de99 100644 --- a/doc/salome/examples/transforming_meshes_ex08.py +++ b/doc/salome/examples/transforming_meshes_ex08.py @@ -1,7 +1,17 @@ # Sew Conform Free Borders -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create two faces of the box box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.) diff --git a/doc/salome/examples/transforming_meshes_ex09.py b/doc/salome/examples/transforming_meshes_ex09.py index 5f92fd1ad..62fea88d1 100644 --- a/doc/salome/examples/transforming_meshes_ex09.py +++ b/doc/salome/examples/transforming_meshes_ex09.py @@ -1,7 +1,15 @@ # Sew Free Borders -import geompy -import smesh + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create two faces of the box box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.) diff --git a/doc/salome/examples/transforming_meshes_ex10.py b/doc/salome/examples/transforming_meshes_ex10.py index c54aca660..426a011a6 100644 --- a/doc/salome/examples/transforming_meshes_ex10.py +++ b/doc/salome/examples/transforming_meshes_ex10.py @@ -1,7 +1,14 @@ # Sew Side Elements -import geompy -import smesh +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create two boxes box1 = geompy.MakeBox(0., 0., 0., 10., 10., 10.) diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py index f94aafeda..0c3bee898 100644 --- a/doc/salome/examples/transforming_meshes_ex11.py +++ b/doc/salome/examples/transforming_meshes_ex11.py @@ -1,8 +1,15 @@ # Duplicate nodes + import salome -import geompy -import smesh +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Create a box @@ -20,11 +27,11 @@ mesh.Compute() # Without the duplication of border elements # Nodes to duplicate -nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' ) +nodes1 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes1' ) nodes1.Add( [ 119, 125, 131, 137 ] ) # Group of faces to replace nodes with new ones -faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' ) +faces1 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces1' ) faces1.Add( [ 144, 151, 158 ] ) # Duplicate nodes @@ -44,15 +51,15 @@ print "Quadrangles : ", mesh.NbQuadrangles() # With the duplication of border elements # Edges to duplicate -edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' ) +edges = mesh.CreateEmptyGroup( SMESH.EDGE, 'edges' ) edges.Add( [ 32, 33, 34 ] ) # Nodes not to duplicate -nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' ) +nodes2 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes2' ) nodes2.Add( [ 35, 38 ] ) # Group of faces to replace nodes with new ones -faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' ) +faces2 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces2' ) faces2.Add( [ 141, 148, 155 ] ) # Duplicate nodes diff --git a/doc/salome/examples/transforming_meshes_ex12.py b/doc/salome/examples/transforming_meshes_ex12.py index 0380cc363..c25a2d033 100644 --- a/doc/salome/examples/transforming_meshes_ex12.py +++ b/doc/salome/examples/transforming_meshes_ex12.py @@ -1,7 +1,17 @@ # Create boundary elements -from smesh import * -SetCurrentStudy(salome.myStudy) + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + box = geompy.MakeBoxDXDYDZ(100, 100, 100) gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) diff --git a/doc/salome/examples/transforming_meshes_ex13.py b/doc/salome/examples/transforming_meshes_ex13.py index 0126b7108..fb56273ba 100644 --- a/doc/salome/examples/transforming_meshes_ex13.py +++ b/doc/salome/examples/transforming_meshes_ex13.py @@ -1,6 +1,17 @@ # Reorient faces by vector -import smesh, geompy, SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + # create a geometry consisting of two faces box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) diff --git a/doc/salome/examples/use_existing_faces.py b/doc/salome/examples/use_existing_faces.py index 12b5a9a56..631316444 100644 --- a/doc/salome/examples/use_existing_faces.py +++ b/doc/salome/examples/use_existing_faces.py @@ -1,6 +1,17 @@ # Use existing faces algorithm -import smesh, geompy + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook + import numpy as np # define my 2D algorithm diff --git a/doc/salome/examples/viewing_meshes_ex01.py b/doc/salome/examples/viewing_meshes_ex01.py index b2fa7df40..85bc69fbc 100644 --- a/doc/salome/examples/viewing_meshes_ex01.py +++ b/doc/salome/examples/viewing_meshes_ex01.py @@ -1,8 +1,15 @@ # Viewing Mesh Infos -import geompy -import smesh -import SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # create a box box = geompy.MakeBox(0., 0., 0., 20., 20., 20.) diff --git a/doc/salome/examples/viewing_meshes_ex02.py b/doc/salome/examples/viewing_meshes_ex02.py index cd096ca76..2ed0a214b 100644 --- a/doc/salome/examples/viewing_meshes_ex02.py +++ b/doc/salome/examples/viewing_meshes_ex02.py @@ -1,8 +1,15 @@ # Find Element by Point -import geompy -import smesh -import SMESH + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Create a geometry to mesh box = geompy.MakeBoxDXDYDZ(100,100,100) diff --git a/doc/salome/gui/SMESH/input/tui_filters.doc b/doc/salome/gui/SMESH/input/tui_filters.doc index eaf5d2803..9f8bff80d 100755 --- a/doc/salome/gui/SMESH/input/tui_filters.doc +++ b/doc/salome/gui/SMESH/input/tui_filters.doc @@ -23,8 +23,8 @@ Python scripts. \section filter_aspect_ratio Aspect ratio Filter 2D mesh elements (faces) according to the aspect ratio value: -- element type should be \a smesh.FACE -- functor type should be \a smesh.FT_AspectRatio +- element type should be \a SMESH.FACE +- functor type should be \a SMESH.FT_AspectRatio - threshold is floating point value (aspect ratio) \tui_script{filters_ex01.py} @@ -34,8 +34,8 @@ Filter 2D mesh elements (faces) according to the aspect ratio value: \section filter_aspect_ratio_3d Aspect ratio 3D Filter 3D mesh elements (volumes) according to the aspect ratio value: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_AspectRatio3D +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_AspectRatio3D - threshold is floating point value (aspect ratio) \tui_script{filters_ex02.py} @@ -45,8 +45,8 @@ Filter 3D mesh elements (volumes) according to the aspect ratio value: \section filter_warping_angle Warping angle Filter 2D mesh elements (faces) according to the warping angle value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Warping +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Warping - threshold is floating point value (warping angle) \tui_script{filters_ex03.py} @@ -56,8 +56,8 @@ Filter 2D mesh elements (faces) according to the warping angle value: \section filter_minimum_angle Minimum angle Filter 2D mesh elements (faces) according to the minimum angle value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_MinimumAngle +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_MinimumAngle - threshold is floating point value (minimum angle) \tui_script{filters_ex04.py} @@ -67,8 +67,8 @@ Filter 2D mesh elements (faces) according to the minimum angle value: \section filter_taper Taper Filter 2D mesh elements (faces) according to the taper value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Taper +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Taper - threshold is floating point value (taper) \tui_script{filters_ex05.py} @@ -78,8 +78,8 @@ Filter 2D mesh elements (faces) according to the taper value: \section filter_skew Skew Filter 2D mesh elements (faces) according to the skew value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Skew +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Skew - threshold is floating point value (skew) \tui_script{filters_ex06.py} @@ -89,8 +89,8 @@ Filter 2D mesh elements (faces) according to the skew value: \section filter_area Area Filter 2D mesh elements (faces) according to the area value: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_Area +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_Area - threshold is floating point value (area) \tui_script{filters_ex07.py} @@ -100,8 +100,8 @@ Filter 2D mesh elements (faces) according to the area value: \section filter_volume Volume Filter 3D mesh elements (volumes) according to the volume value: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_Volume3D +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_Volume3D - threshold is floating point value (volume) \tui_script{filters_ex08.py} @@ -111,8 +111,8 @@ Filter 3D mesh elements (volumes) according to the volume value: \section filter_free_borders Free borders Filter 1D mesh elements (edges) which represent free borders of a mesh: -- element type is \a smesh.EDGE -- functor type is \a smesh.FT_FreeBorders +- element type is \a SMESH.EDGE +- functor type is \a SMESH.FT_FreeBorders - threshold value is not required \tui_script{filters_ex09.py} @@ -123,8 +123,8 @@ Filter 1D mesh elements (edges) which represent free borders of a mesh: Filter 2D mesh elements (faces) consisting of edges belonging to one element of mesh only: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_FreeEdges +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_FreeEdges - threshold value is not required \tui_script{filters_ex10.py} @@ -134,8 +134,8 @@ element of mesh only: \section filter_free_nodes Free nodes Filter free nodes: -- element type is \a smesh.NODE -- functor type is \a smesh.FT_FreeNodes +- element type is \a SMESH.NODE +- functor type is \a SMESH.FT_FreeNodes - threshold value is not required \tui_script{filters_ex11.py} @@ -145,8 +145,8 @@ Filter free nodes: \section filter_free_faces Free faces Filter free faces: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_FreeFaces +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_FreeFaces - threshold value is not required \tui_script{filters_ex12.py} @@ -156,8 +156,8 @@ Filter free faces: \section filter_bare_border_faces Bare border faces Filter faces with bare borders: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_BareBorderFace +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_BareBorderFace - threshold value is not required \tui_script{filters_ex13.py} @@ -167,8 +167,8 @@ Filter faces with bare borders: \section filter_coplanar_faces Coplanar faces Filter faces with bare borders: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_CoplanarFaces +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_CoplanarFaces - threshold value is the face ID - tolerance is in degrees @@ -177,8 +177,8 @@ Filter faces with bare borders: \section filter_over_constrained_faces Over-constrained faces Filter over-constrained faces: -- element type is \a smesh.FACE -- functor type is \a smesh.FT_OverConstrainedFace +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_OverConstrainedFace - threshold value is not required \tui_script{filters_ex15.py} @@ -188,9 +188,9 @@ Filter over-constrained faces: \section filter_double_elements Double edges, Double faces, Double volumes filter mesh elements basing on the same set of nodes: -- element type is either \a smesh.EGDE, \a smesh.FACE or \a smesh.VOLUME -- functor type is either \a smesh.FT_EqualEdges, \a - smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes, +- element type is either \a smesh.EGDE, \a SMESH.FACE or \a SMESH.VOLUME +- functor type is either \a SMESH.FT_EqualEdges, \a + SMESH.FT_EqualFaces or \a SMESH.FT_EqualVolumes, - threshold value is not required \tui_script{filters_ex16.py} @@ -199,8 +199,8 @@ filter mesh elements basing on the same set of nodes: \section tui_double_nodes_control Double nodes filters mesh nodes which are coincident with other nodes (within a given tolerance): -- element type is \a smesh.NODE -- functor type is \a smesh.FT_EqualNodes +- element type is \a SMESH.NODE +- functor type is \a SMESH.FT_EqualNodes - threshold value is not required - default tolerance is 1.0e-7 @@ -211,8 +211,8 @@ filters mesh nodes which are coincident with other nodes (within a given toleran Filter border 1D mesh elements (edges) according to the specified number of connections (faces belonging the border edges) -- element type is \a smesh.EDGE -- functor type is \a smesh.FT_MultiConnection +- element type is \a SMESH.EDGE +- functor type is \a SMESH.FT_MultiConnection - threshold is integer value (number of connections) \tui_script{filters_ex18.py} @@ -223,8 +223,8 @@ connections (faces belonging the border edges) Filter 2D mesh elements (faces) which consist of edges belonging to the specified number of mesh elements -- element type is \a smesh.FACE -- functor type is \a smesh.FT_MultiConnection2D +- element type is \a SMESH.FACE +- functor type is \a SMESH.FT_MultiConnection2D - threshold is integer value (number of connections) \tui_script{filters_ex19.py} @@ -234,8 +234,8 @@ to the specified number of mesh elements \section filter_length Length Filter 1D mesh elements (edges) according to the edge length value: -- element type should be \a smesh.EDGE -- functor type should be \a smesh.FT_Length +- element type should be \a SMESH.EDGE +- functor type should be \a SMESH.FT_Length - threshold is floating point value (length) \tui_script{filters_ex20.py} @@ -246,8 +246,8 @@ Filter 1D mesh elements (edges) according to the edge length value: Filter 2D mesh elements (faces) corresponding to the maximum length. value of its edges: -- element type should be \a smesh.FACE -- functor type should be \a smesh.FT_Length2D +- element type should be \a SMESH.FACE +- functor type should be \a SMESH.FT_Length2D - threshold is floating point value (edge length) \tui_script{filters_ex21.py} @@ -258,8 +258,8 @@ value of its edges: Filter 2D mesh elements (faces) corresponding to the maximum length value of its edges and diagonals: -- element type should be \a smesh.FACE -- functor type should be \a smesh.FT_MaxElementLength2D +- element type should be \a SMESH.FACE +- functor type should be \a SMESH.FT_MaxElementLength2D - threshold is floating point value (edge/diagonal length) \tui_script{filters_ex22.py} @@ -270,8 +270,8 @@ value of its edges and diagonals: Filter 3D mesh elements (volumes) corresponding to the maximum length value of its edges and diagonals: -- element type should be \a smesh.VOLUME -- functor type should be \a smesh.FT_MaxElementLength3D +- element type should be \a SMESH.VOLUME +- functor type should be \a SMESH.FT_MaxElementLength3D - threshold is floating point value (edge/diagonal length) \tui_script{filters_ex23.py} @@ -281,8 +281,8 @@ value of its edges and diagonals: \section filter_bare_border_volumes Bare border volumes Filter 3D mesh elements with bare borders: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_BareBorderVolume +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_BareBorderVolume - threshold value is not required \tui_script{filters_ex24.py} @@ -292,8 +292,8 @@ Filter 3D mesh elements with bare borders: \section filter_over_constrained_volumes Over-constrained volumes Filter over-constrained volumes: -- element type is \a smesh.VOLUME -- functor type is \a smesh.FT_OverConstrainedVolume +- element type is \a SMESH.VOLUME +- functor type is \a SMESH.FT_OverConstrainedVolume - threshold value is not required \tui_script{filters_ex25.py} @@ -304,8 +304,8 @@ Filter over-constrained volumes: Filter mesh entities (nodes or elements) which all nodes lie on the shape defined by threshold value: -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type should be \a smesh.FT_BelongToGeom +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type should be \a SMESH.FT_BelongToGeom - threshold is geometrical object \tui_script{filters_ex26.py} @@ -314,8 +314,8 @@ shape defined by threshold value: Filter mesh entities (nodes or elements) at least one node of which lies on the shape defined by threshold value: -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type should be \a smesh.FT_LyingOnGeom +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type should be \a SMESH.FT_LyingOnGeom - threshold is geometrical object \tui_script{filters_ex27.py} @@ -324,8 +324,8 @@ shape defined by threshold value: Filter mesh entities (nodes or elements) which all nodes belong to the plane defined by threshold value with the given tolerance: -- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE -- functor type should be \a smesh.FT_BelongToPlane +- element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE +- functor type should be \a SMESH.FT_BelongToPlane - threshold is geometrical object (plane) - default tolerance is 1.0e-7 @@ -335,8 +335,8 @@ plane defined by threshold value with the given tolerance: Filter mesh entities (nodes or elements) which all nodes belong to the cylindrical face defined by threshold value with the given tolerance: -- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE -- functor type should be \a smesh.FT_BelongToCylinder +- element type can be: \a , \a SMESH.EDGE, \a SMESH.FACE +- functor type should be \a SMESH.FT_BelongToCylinder - threshold is geometrical object (cylindrical face) - default tolerance is 1.0e-7 @@ -346,8 +346,8 @@ cylindrical face defined by threshold value with the given tolerance: Filter mesh entities (nodes or elements) which all nodes belong to the arbitrary surface defined by threshold value with the given tolerance: -- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE -- functor type should be \a smesh.FT_BelongToGenSurface +- element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE +- functor type should be \a SMESH.FT_BelongToGenSurface - threshold is geometrical object (arbitrary surface) - default tolerance is 1.0e-7 @@ -357,8 +357,8 @@ arbitrary surface defined by threshold value with the given tolerance: Filter mesh entities elements (nodes or elements) according to the specified identifiers range: -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type is \a smesh.FT_RangeOfIds +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type is \a SMESH.FT_RangeOfIds - threshold is string listing required IDs and/or ranges of IDs, e.g."1,2,3,50-60,63,67,70-78" \tui_script{filters_ex31.py} @@ -367,8 +367,8 @@ specified identifiers range: Filter 3D mesh elements (volumes), which are incorrectly oriented from the point of view of MED convention. -- element type should be \a smesh.VOLUME -- functor type is \a smesh.FT_BadOrientedVolume +- element type should be \a SMESH.VOLUME +- functor type is \a SMESH.FT_BadOrientedVolume - threshold is not required \tui_script{filters_ex32.py} @@ -376,10 +376,10 @@ the point of view of MED convention. \section filter_linear_or_quadratic Linear / quadratic Filter linear / quadratic mesh elements: -- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME -- functor type is \a smesh.FT_LinearOrQuadratic +- element type should be any element type, e.g.: \a SMESH.EDGE, \a SMESH.FACE, \a SMESH.VOLUME +- functor type is \a SMESH.FT_LinearOrQuadratic - threshold is not required -- if unary operator is set to smesh.FT_LogicalNOT, the quadratic +- if unary operator is set to SMESH.FT_LogicalNOT, the quadratic elements are selected, otherwise (by default) linear elements are selected \tui_script{filters_ex33.py} @@ -387,8 +387,8 @@ elements are selected, otherwise (by default) linear elements are selected \section filter_group_color Group color Filter mesh entities, belonging to the group with the color defined by the threshold value. -- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME -- functor type is \a smesh.FT_GroupColor +- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME +- functor type is \a SMESH.FT_GroupColor - threshold should be of SALOMEDS.Color type \tui_script{filters_ex34.py} @@ -398,8 +398,8 @@ Filter mesh entities, belonging to the group with the color defined by the thres Filter mesh elements by the geometric type defined with the threshold value. The list of available geometric types depends on the element entity type. -- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME -- functor type should be \a smesh.FT_ElemGeomType +- element type should be any element type, e.g.: \a SMESH.EDGE, \a SMESH.FACE, \a SMESH.VOLUME +- functor type should be \a SMESH.FT_ElemGeomType - threshold is of smesh.GeometryType value \tui_script{filters_ex35.py}