4 salome.salome_init_without_session()
7 from salome.geom import geomBuilder
8 from salome.smesh import smeshBuilder
10 geom_builder = geomBuilder.New()
11 smesh_builder = smeshBuilder.New()
13 # fuse a box and a sphere
14 Sphere_1 = geom_builder.MakeSphereR(100)
15 Box_1 = geom_builder.MakeBoxDXDYDZ(200, 200, 200)
16 Fuse = geom_builder.MakeFuse( Sphere_1, Box_1, theName="box + sphere" )
19 mesh = smesh_builder.Mesh( Fuse, "Deflection_2D")
22 algo = mesh.Triangle()
23 if not mesh.Compute(): raise Exception("Error when computing Mesh")
25 # get min and max deflection
26 minMax = mesh.GetMinMax( SMESH.FT_Deflection2D )
27 print("min and max deflection: ", minMax)
29 # get deflection of a certain face
30 faceID = mesh.NbEdges() + mesh.NbFaces()
31 defl = mesh.FunctorValue( SMESH.FT_Deflection2D, faceID )
32 print("deflection of face %s = %s" % ( faceID, defl ))
34 margin = minMax[1] / 2
36 # get all faces with deflection LESS than the margin
37 aFilter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_Deflection2D, '<', margin, mesh=mesh)
38 anIds = aFilter.GetIDs()
39 print("%s faces have deflection less than %s" %( len(anIds), margin ))
41 # create a group of faces with deflection MORE than the margin
42 aGroup = mesh.MakeGroup("Deflection > " + repr(margin), SMESH.FACE, SMESH.FT_Deflection2D,'>',margin)
43 print("%s faces have deflection more than %s: %s ..." %( aGroup.Size(), margin, aGroup.GetIDs()[:10] ))