def RebuildData(theStudy): smesh.SetCurrentStudy(theStudy) import StdMeshers import NETGENPlugin Mesh_1 = smesh.Mesh(Cut_1) Regular_1D = Mesh_1.Segment() Max_Size_1 = Regular_1D.MaxSize(20.2301) MEFISTO_2D = Mesh_1.Triangle() Tetrahedron_Netgen = Mesh_1.Tetrahedron(algo=smesh.NETGEN) isDone = Mesh_1.Compute() Mesh_1.Clear() isDone = Mesh_1.Compute() Mesh_2 = smesh.Mesh(Y) Regular_1D_1 = Mesh_2.Segment() ns_1 = Regular_1D_1.NumberOfSegments(50, 10, []) isDone = Mesh_2.Compute() Mesh_2.ExtrusionSweepObject1D( Mesh_2, SMESH.DirStruct(SMESH.PointStruct(0, 0, 100)), 5) Mesh_2.RotationSweepObject1D(Mesh_2, SMESH.AxisStruct(0, 0, 0, 0, 0, 10), 0.0872665, 6, 1e-05) ## set object names smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') smesh.SetName(Max_Size_1, 'Max Size_1') smesh.SetName(MEFISTO_2D.GetAlgorithm(), 'MEFISTO_2D') smesh.SetName(Tetrahedron_Netgen.GetAlgorithm(), 'Tetrahedron (Netgen)') smesh.SetName(Mesh_2.GetMesh(), 'Mesh_2') smesh.SetName(ns_1, 'ns_1') if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0) ### Store presentation parameters of displayed objects import iparameters ipar = iparameters.IParameters( theStudy.GetModuleParameters("Interface Applicative", "SMESH", 1)) #Set up entries: # set up entry SMESH_4 (Mesh_2) parameters ipar.setParameter("SMESH_4", "VTKViewer_0_Visibility", "On") ipar.setParameter("SMESH_4", "VTKViewer_0_Representation", "2") ipar.setParameter("SMESH_4", "VTKViewer_0_IsShrunk", "0") ipar.setParameter("SMESH_4", "VTKViewer_0_Entities", "e:1:f:1:v:0") ipar.setParameter( "SMESH_4", "VTKViewer_0_Colors", "surface:0:0.666667:1:backsurface:0:0:1:edge:0:0.666667:1:node:1:0:0") ipar.setParameter("SMESH_4", "VTKViewer_0_Sizes", "line:1:shrink:0.75") ipar.setParameter("SMESH_4", "VTKViewer_0_PointMarker", "std:1:9") ipar.setParameter("SMESH_4", "VTKViewer_0_Opacity", "1") ipar.setParameter("SMESH_4", "VTKViewer_0_ClippingPlane", "Off") pass
geompy.addToStudy(Face_1, 'Face_1') geompy.addToStudy(Face_2, 'Face_2') geompy.addToStudy(Plaque, 'Plaque') geompy.addToStudyInFather(Plaque, gauche, 'gauche') geompy.addToStudyInFather(Plaque, droite, 'droite') geompy.addToStudyInFather(Plaque, Fin, 'Fin') geompy.addToStudyInFather(Plaque, centre, 'centre') geompy.addToStudyInFather(Plaque, ext, 'ext') ### ### SMESH component ### import smesh, SMESH, SALOMEDS smesh.SetCurrentStudy(theStudy) import StdMeshers import NETGENPlugin Maillage_1 = smesh.Mesh(Plaque) NETGEN_2D = Maillage_1.Triangle(algo=smesh.NETGEN_1D2D) NETGEN_2D_Parameters = NETGEN_2D.Parameters() NETGEN_2D_Parameters.SetMaxSize(50) NETGEN_2D_Parameters.SetSecondOrder(0) NETGEN_2D_Parameters.SetOptimize(1) NETGEN_2D_Parameters.SetFineness(2) NETGEN_2D_Parameters.SetMinSize(1) NETGEN_2D_Parameters.SetQuadAllowed(0) Regular_1D = Maillage_1.Segment(geom=centre) Nb_Segments_1 = Regular_1D.NumberOfSegments(250) Nb_Segments_1.SetDistrType(0)
## Geometry part ## salome.salome_init() geompy.init_geom(salome.myStudy) cooler = geompy.MakeBoxDXDYDZ(30, 20, 70) group = geompy.CreateGroup(cooler, geompy.ShapeType["FACE"]) geompy.addToStudy(cooler, 'cooler') groups = [] counter = 0 for each_face in geompy.SubShapeAllSortedCentres(cooler, geompy.ShapeType["FACE"]): groups.append(geompy.CreateGroup(cooler, geompy.ShapeType["FACE"])) geompy.AddObject(groups[counter], geompy.GetSubShapeID(cooler, each_face)) geompy.addToStudyInFather(cooler, groups[counter], 'face_' + str(counter + 1)) counter += 1 update_screen() ## Mesh part ## smesh.SetCurrentStudy(salome.myStudy) cooler_mesh = smesh.CreateMesh(cooler) #update_screen() for geom_group in groups: mesh_group = cooler_mesh.CreateGroupFromGEOM(SMESH.FACE, geom_group.GetName(), geom_group) update_screen()