6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
16 aGroup1 = mesh.MakeGroupByIds(
"Area > 100", SMESH.FACE, anIds)
19 aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE,
"all nodes")
20 aGroup2.AddFrom(mesh.mesh)
27 aGroup = mesh.CreateEmptyGroup(SMESH.NODE,
"aGroup")
30 aGroup.SetName(
"new name" )
31 print "name", aGroup.GetName()
34 print "type", aGroup.GetType()
37 print "size", aGroup.Size()
40 print "is empty", aGroup.IsEmpty()
44 print "contains node 2", aGroup.Contains(2)
47 print "1st node", aGroup.GetID(1)
50 print "all", aGroup.GetIDs()
53 print "nb nodes", aGroup.GetNumberOfNodes()
56 print "nodes", aGroup.GetNodeIDs()
60 aGroup.SetColor( SALOMEDS.Color(1.,1.,0.));
61 print "color", aGroup.GetColor()
72 aGroup.AddFrom( aGroup2 )
75 aGroup.Remove( [2,3,4] )
80 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
15 box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
16 geompy.addToStudy(box,
"box")
19 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType[
"FACE"])
20 face = subShapeList[0]
21 geompy.addToStudyInFather(box, face,
"face 1")
24 aGeomGroupE = geompy.CreateGroup(face, geompy.ShapeType[
"EDGE"])
25 geompy.AddObject(aGeomGroupE, 3)
26 geompy.AddObject(aGeomGroupE, 6)
27 geompy.AddObject(aGeomGroupE, 8)
28 geompy.AddObject(aGeomGroupE, 10)
29 geompy.addToStudyInFather(face, aGeomGroupE,
"Group of Edges")
32 quadra = smesh.Mesh(box,
"Box : quadrangle 2D mesh")
33 algo1D = quadra.Segment()
35 algo1D.NumberOfSegments(7)
41 aSmeshGroup1 = quadra.GroupOnGeom(face,
"SMESHGroup1")
44 aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE)
46 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
16 box = geompy.MakeBoxDXDYDZ(10,10,10)
19 mesh = smesh.Mesh(box,
"Quad mesh")
26 smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area,
">", 1.1, BinaryOp=SMESH.FT_LogicalAND ),
27 smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area,
"<", 15.0 )
29 filt = smesh.GetFilterFromCriteria( critaria )
30 filtGroup = mesh.GroupOnFilter( SMESH.FACE,
"group on filter", filt )
31 print "Group on filter contains %s elemens" % filtGroup.Size()
34 hyp1D.SetStartLength( 2.5 )
35 hyp1D.SetEndLength( 2.5 )
37 print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
40 filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds,
"1-50" )
41 filtGroup.SetFilter( filt2 )
42 print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
45 filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds,
"1-70" )])
46 filtIDs3 = filtGroup.GetIDs()
47 print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
49 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
15 print "Criterion: Area > 35, Nb = ", len(anIds)
18 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Area > 35")
22 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.)
24 anIds = mesh.GetIdsFromFilter(aFilter)
26 print "Criterion: Area > 40, Nb = ", len(anIds)
30 aGroup.SetName(
"35 < Area < 40")
33 aGroupElemIDs = aGroup.GetListOfID()
35 print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)
38 for i
in range(len(aGroupElemIDs)):
39 if j > 20: j = 1;
print ""
40 print aGroupElemIDs[i],
45 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
15 print "Criterion: Area > 20, Nb = ", len( anIds )
18 aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE,
"Area > 20")
22 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.)
24 anIds = mesh.GetIdsFromFilter(aFilter)
26 print "Criterion: Area = 20, Nb = ", len( anIds )
29 aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE,
"Area = 20" )
34 aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2],
"Area >= 20")
35 aGroup3.SetColor( SALOMEDS.Color(1.,1.,0.));
36 print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
40 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.)
42 anIds = mesh.GetIdsFromFilter(aFilter)
44 print "Criterion: Area < 20, Nb = ", len(anIds)
47 aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE,
"Area < 20")
49 aGroup4.SetColor( SALOMEDS.Color(1.,0.,0.));
52 aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4],
"Any Area")
53 print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
55 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
15 print "Criterion: Area > 20, Nb = ", len(anIds)
18 aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE,
"Area > 20")
22 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
24 anIds = mesh.GetIdsFromFilter(aFilter)
26 print "Criterion: Area < 60, Nb = ", len(anIds)
29 aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE,
"Area < 60")
33 aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2],
"20 < Area < 60")
34 print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())
37 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
15 print "Criterion: Area > 20, Nb = ", len(anIds)
18 aGroupMain = mesh.MakeGroupByIds(
"Area > 20", SMESH.FACE, anIds)
21 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
23 anIds = mesh.GetIdsFromFilter(aFilter)
25 print "Criterion: Area < 60, Nb = ", len(anIds)
28 aGroupTool = mesh.MakeGroupByIds(
"Area < 60", SMESH.FACE, anIds)
31 aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool,
"Area >= 60")
32 print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
35 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
14 aSrcGroup1 = mesh.GroupOnFilter(SMESH.FACE,
"Area > 100", aFilter)
15 aSrcGroup1.SetColor( SALOMEDS.Color(1.,1.,0.))
16 print "Criterion: Area > 100, Nb = ", aSrcGroup1.Size()
19 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.)
22 aSrcGroup2 = mesh.GroupOnFilter(SMESH.FACE,
"Area < 30", aFilter)
23 aSrcGroup2.SetColor( SALOMEDS.Color(1.,0.,0.))
24 print "Criterion: Area < 30, Nb = ", aSrcGroup2.Size()
28 aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.EDGE,
"Edges" )
31 aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.NODE,
"Nodes" )
33 salome.sg.updateObjBrowser(
True)