6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
9 from salome.smesh
import smeshBuilder
10 smesh = smeshBuilder.New(salome.myStudy)
13 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
14 geompy.addToStudy(box,
"Box")
17 hexa = smesh.Mesh(box,
"Box : hexahedrical mesh")
20 algo1D = hexa.Segment()
23 allEdges = geompy.SubShapeAllSorted( box, geompy.ShapeType[
"EDGE"])
24 reversedEdges = [ allEdges[0], allEdges[4] ]
27 algo1D.Arithmetic1D(1, 4, reversedEdges)
30 gpAlgo = hexa.Segment( allEdges[1] )
31 gpAlgo.GeometricProgression( 1, 1.2 )
34 gpAlgo.PropagationOfDistribution()
3 from salome.geom
import geomBuilder
4 geompy = geomBuilder.New(salome.myStudy)
5 from salome.smesh
import smeshBuilder
6 smesh = smeshBuilder.New(salome.myStudy)
9 box = geompy.MakeBoxDXDYDZ( 100, 100, 100 )
10 tool = geompy.MakeTranslation( box, 50, 0, 10 )
11 axis = geompy.MakeVector( geompy.MakeVertex( 100, 0, 100 ),geompy.MakeVertex( 100, 10, 100 ),)
12 tool = geompy.Rotate( tool, axis, math.pi * 25 / 180. )
13 shape = geompy.MakeCut( box, tool )
14 cyl = geompy.MakeCylinder( geompy.MakeVertex( -10,5, 95 ), geompy.MakeVectorDXDYDZ(1,0,0), 2, 90)
15 shape = geompy.MakeCut( shape, cyl )
16 tool = geompy.MakeBoxTwoPnt( geompy.MakeVertex( -10, 2, 15 ), geompy.MakeVertex( 90, 5, 16 ))
17 shape = geompy.MakeCut( shape, tool, theName=
"shape" )
26 mesh = smesh.Mesh( shape )
27 mesh.Segment().
Adaptive( minSize, maxSize, deflection )
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 px = geompy.MakeVertex(100., 0. , 0. )
15 py = geompy.MakeVertex(0. , 100., 0. )
16 pz = geompy.MakeVertex(0. , 0. , 100.)
18 exy = geompy.MakeEdge(px, py)
19 arc = geompy.MakeArc(py, pz, px)
21 wire = geompy.MakeWire([exy, arc])
24 face1 = geompy.MakeFace(wire, isPlanarFace)
25 geompy.addToStudy(face1,
"Face1")
28 e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType[
"EDGE"])
29 geompy.addToStudyInFather(face1, e_arc,
"Arc Edge")
32 hexa = smesh.Mesh(face1,
"Face : triangle mesh")
35 algo1D = hexa.Segment()
36 algo1D.NumberOfSegments(6)
39 algo2D = hexa.Triangle()
40 algo2D.MaxElementArea(70.0)
43 algo_local = hexa.Segment(e_arc)
44 algo_local.Deflection1D(1.0)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
15 geompy.addToStudy(box,
"Box")
18 p5 = geompy.MakeVertex(5., 0., 0.)
19 EdgeX = geompy.GetEdgeNearPoint(box, p5)
20 geompy.addToStudyInFather(box, EdgeX,
"Edge [0,0,0 - 10,0,0]")
23 hexa = smesh.Mesh(box,
"Box : hexahedrical mesh")
26 algo1D = hexa.Segment()
31 algo1D.NumberOfSegments(4)
34 algo_local = hexa.Segment(EdgeX)
37 algo_local.StartEndLength(1, 6)
41 algo_local.Propagation()
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
15 geompy.addToStudy(box,
"Box")
18 p5 = geompy.MakeVertex(5., 0., 0.)
19 EdgeX = geompy.GetEdgeNearPoint(box, p5)
20 geompy.addToStudyInFather(box, EdgeX,
"Edge [0,0,0 - 10,0,0]")
23 hexa = smesh.Mesh(box,
"Box : hexahedrical mesh")
26 algo1D = hexa.Segment()
31 algo1D.NumberOfSegments(4)
34 algo_local = hexa.Segment(EdgeX)
37 algo_local.LocalLength(2.)
41 algo_local.Propagation()
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 px = geompy.MakeVertex(100., 0. , 0. )
15 py = geompy.MakeVertex(0. , 100., 0. )
16 pz = geompy.MakeVertex(0. , 0. , 100.)
18 vxy = geompy.MakeVector(px, py)
19 arc = geompy.MakeArc(py, pz, px)
20 wire = geompy.MakeWire([vxy, arc])
23 face = geompy.MakeFace(wire, isPlanarFace)
26 id_face = geompy.addToStudy(face,
"Face to be meshed")
29 tria_mesh = smesh.Mesh(face,
"Face : triangulation")
32 algo = tria_mesh.Segment()
33 algo.NumberOfSegments(20)
38 algo = tria_mesh.Triangle()
41 algo.MaxElementArea(100)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 cyl = geompy.MakeCylinderRH(30., 50.)
15 geompy.addToStudy(cyl,
"cyl")
18 tetra = smesh.Mesh(cyl,
"Cylinder : tetrahedrical mesh")
21 algo1D = tetra.Segment()
22 algo2D = tetra.Triangle()
23 algo3D = tetra.Tetrahedron()
26 algo1D.NumberOfSegments(7)
27 algo2D.MaxElementArea(150.)
30 algo3D.MaxElementVolume(200.)
35 print "problem when computing the mesh"
37 print "Computation succeeded"
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 sketcher1 = geompy.MakeSketcher(
"Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
15 sketcher2 = geompy.MakeSketcher(
"Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
19 face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
20 geompy.addToStudy(face1,
"Face1")
23 tria = smesh.Mesh(face1,
"Face : triangle 2D mesh")
26 algo1D = tria.Segment()
27 algo1D.LocalLength(3.)
30 algo2D = tria.Triangle()
34 algo2D.LengthFromEdges()
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 base = geompy.MakeSketcher(
"Sketcher:F 0 0:TT 10 0:TT 20 10:TT 0 10:WF", theName=
"F")
15 box = geompy.MakePrismDXDYDZ( base, 0,0,10 )
16 geompy.addToStudy(box,
"Box")
19 p5 = geompy.MakeVertex(5., 0., 0.)
20 EdgeX = geompy.GetEdgeNearPoint(box, p5)
21 geompy.addToStudyInFather(box, EdgeX,
"Edge [0,0,0 - 10,0,0]")
24 hexa = smesh.Mesh(box,
"Propagation of hypothesis")
27 algo1D = hexa.Segment()
30 algo1D.NumberOfSegments(4)
33 algo_local = hexa.Segment(EdgeX)
36 algo_local.Arithmetic1D(1, 4)
40 algo_local.Propagation()
47 mesh = smesh.Mesh(box,
"Propagation of distribution of nodes")
50 algo1D = mesh.Segment()
53 algo1D.NumberOfSegments(4)
56 algo_local = mesh.Segment(EdgeX)
57 algo_local.Arithmetic1D(1, 4)
62 algo_local.PropagationOfDistribution()
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
15 geompy.addToStudy(box,
"Box")
18 hexa = smesh.Mesh(box,
"Box : hexahedrical mesh")
21 algo1D = hexa.Segment()
24 algo2D = hexa.Quadrangle()
27 algo3D = hexa.Hexahedron()
30 algo1D.Arithmetic1D(1, 4)
36 tetra = smesh.Mesh(box,
"Box : tetrahedrical mesh")
39 algo1D = tetra.Segment()
42 algo2D = tetra.Triangle()
45 algo3D = tetra.Tetrahedron()
48 algo1D.Arithmetic1D(1, 4)
49 algo2D.LengthFromEdges()
8 from salome.geom
import geomBuilder
9 geompy = geomBuilder.New(salome.myStudy)
11 import SMESH, SALOMEDS
12 from salome.smesh
import smeshBuilder
13 smesh = smeshBuilder.New(salome.myStudy)
18 box = geompy.MakeBoxDXDYDZ(200, 100, 70)
19 geompy.addToStudy( box,
"box" )
22 faces = geompy.SubShapeAll(box, geompy.ShapeType[
"FACE"])
27 f2opp = geompy.GetOppositeFace( box, f2 )
30 [v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType[
"VERTEX"])[:2]
31 [v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType[
"VERTEX"])[:2]
32 geompy.addToStudyInFather( box, v1F1,
"v1F1" )
33 geompy.addToStudyInFather( box, v2F1,
"v2F1" )
34 geompy.addToStudyInFather( box, v1F2,
"v1F2" )
35 geompy.addToStudyInFather( box, v2F2,
"v2F2" )
38 edgesF1 = geompy.CreateGroup(f1, geompy.ShapeType[
"EDGE"])
39 geompy.UnionList( edgesF1, geompy.SubShapeAll(f1, geompy.ShapeType[
"EDGE"])[:3])
40 edgesF2 = geompy.CreateGroup(f2, geompy.ShapeType[
"EDGE"])
41 geompy.UnionList( edgesF2, geompy.SubShapeAll(f2, geompy.ShapeType[
"EDGE"])[:3])
42 geompy.addToStudyInFather( box, edgesF1,
"edgesF1" )
43 geompy.addToStudyInFather( box, edgesF2,
"edgesF2" )
47 src_mesh = smesh.Mesh(box,
"Source mesh")
58 tgt_mesh = smesh.Mesh(box,
"Target mesh")
64 proj1D = tgt_mesh.Projection1D( edgesF1 )
66 proj1D.SourceEdge( edgesF2, src_mesh, v2F1, v2F2 )
70 proj2D = tgt_mesh.Projection2D( f2 )
71 proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 )
75 proj2D = tgt_mesh.Projection2D( f2opp )
76 proj2D.SourceFace( f2 )
79 proj3D = tgt_mesh.Projection3D()
80 proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
84 src_mesh.TranslateObject( src_mesh, smesh.MakeDirStruct( 210, 0, 0 ), Copy=
False)
8 from salome.geom
import geomBuilder
9 geompy = geomBuilder.New(salome.myStudy)
11 import SMESH, SALOMEDS
12 from salome.smesh
import smeshBuilder
13 smesh = smeshBuilder.New(salome.myStudy)
18 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
21 faces = geompy.SubShapeAll(box, geompy.ShapeType[
"FACE"])
26 geompy.addToStudy( box,
'box' )
27 geompy.addToStudyInFather( box, Face_1,
'Face_1' )
28 geompy.addToStudyInFather( box, Face_2,
'Face_2' )
32 src_mesh = smesh.Mesh(Face_1,
"Source mesh")
38 tgt_mesh = smesh.Mesh(Face_2,
"Target mesh")
39 tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
12 from salome.StdMeshers
import StdMeshersBuilder
15 face = geompy.MakeFaceHW(100, 100, 1)
16 edges = geompy.SubShapeAllSorted(face, geompy.ShapeType[
"EDGE"])
17 geompy.addToStudy( face,
"Face" )
20 edge1 = geompy.GetSubShapeID(face, edges[0])
23 Mesh_1 = smesh.Mesh(face)
32 Fixed_points_1D_1 = smesh.CreateHypothesis(
'FixedPoints1D')
33 Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
34 Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
35 Fixed_points_1D_1.SetReversedEdges( [edge1] )
38 Mesh_1.AddHypothesis(Fixed_points_1D_1)
39 Regular_1D = Mesh_1.Segment()
40 Quadrangle_2D = Mesh_1.Quadrangle()
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 Face = geompy.MakeSketcher(
"Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
15 geompy.addToStudy(Face,
"Face")
16 circle, radius1, radius2 = geompy.SubShapeAllSorted(Face, geompy.ShapeType[
"EDGE"])
17 geompy.addToStudyInFather(Face, radius1,
"radius1")
18 geompy.addToStudyInFather(Face, radius2,
"radius2")
19 geompy.addToStudyInFather(Face, circle,
"circle")
23 mesh = smesh.Mesh(Face)
24 radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.RADIAL_QUAD)
38 radial_Quad_algo.NumberOfLayers( 4 )
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
15 Disk_1 = geompy.MakeDiskR(100, 1)
16 Common_1 = geompy.MakeCommon(Disk_1, Box_1)
17 geompy.addToStudy( Disk_1,
"Disk_1" )
18 geompy.addToStudy( Box_1,
"Box_1" )
19 geompy.addToStudy( Common_1,
"Common_1" )
22 Mesh_1 = smesh.Mesh(Common_1)
26 Regular_1D = Mesh_1.Segment()
27 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
28 Nb_Segments_1.SetDistrType( 0 )
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
12 from salome.StdMeshers
import StdMeshersBuilder
15 Vertex_1 = geompy.MakeVertex(0, 0, 0)
16 Vertex_2 = geompy.MakeVertex(40, 0, 0)
17 Vertex_3 = geompy.MakeVertex(40, 30, 0)
18 Vertex_4 = geompy.MakeVertex(0, 30, 0)
19 Quadrangle_Face_1 = geompy.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
20 [Edge_1,Edge_2,Edge_3,Edge_4] = geompy.SubShapeAllSorted(Quadrangle_Face_1, geompy.ShapeType[
"EDGE"])
21 geompy.addToStudy( Vertex_1,
"Vertex_1" )
22 geompy.addToStudy( Vertex_2,
"Vertex_2" )
23 geompy.addToStudy( Vertex_3,
"Vertex_3" )
24 geompy.addToStudy( Vertex_4,
"Vertex_4" )
25 geompy.addToStudy( Quadrangle_Face_1,
"Quadrangle Face_1" )
26 geompy.addToStudyInFather( Quadrangle_Face_1, Edge_2,
"Edge_2" )
29 Mesh_1 = smesh.Mesh(Quadrangle_Face_1)
33 Quadrangle_Parameters_1 = smesh.CreateHypothesis(
'QuadrangleParams')
34 Quadrangle_Parameters_1.SetQuadType( StdMeshersBuilder.QUAD_QUADRANGLE_PREF )
37 Regular_1D = Mesh_1.Segment()
38 Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
39 Nb_Segments_1.SetDistrType( 0 )
40 status = Mesh_1.AddHypothesis(Quadrangle_Parameters_1)
41 Quadrangle_2D = Mesh_1.Quadrangle()
44 Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
45 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
46 Nb_Segments_2.SetDistrType( 0 )
47 SubMesh_1 = Regular_1D_1.GetSubMesh()
50 isDone = Mesh_1.Compute()
53 Quadrangle_Parameters_1.SetQuadType( StdMeshersBuilder.QUAD_REDUCED )
54 isDone = Mesh_1.Compute()
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
15 box = geompy.MakeBoxDXDYDZ(100,100,100)
17 N = geompy.MakeVectorDXDYDZ( 1,0,0 )
18 O = geompy.MakeVertex( 50,0,0 )
19 plane = geompy.MakePlane( O, N, 200 )
21 shape2boxes = geompy.MakeHalfPartition( box, plane )
22 boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType[
"SOLID"])
24 geompy.addToStudy( boxes[0],
"boxes[0]")
25 geompy.addToStudy( boxes[1],
"boxes[1]")
26 midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType[
"FACE"])[5]
27 geompy.addToStudyInFather( boxes[0], midFace0,
"middle Face")
28 midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType[
"FACE"])[0]
29 geompy.addToStudyInFather( boxes[1], midFace1,
"middle Face")
33 srcMesh = smesh.Mesh(boxes[0],
"source mesh")
37 srcFaceGroup = srcMesh.GroupOnGeom( midFace0,
"src faces", SMESH.FACE )
41 tgtMesh = smesh.Mesh(boxes[1],
"target mesh")
42 importAlgo = tgtMesh.UseExisting2DElements(midFace1)
43 import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
49 import2hyp.SetCopySourceMesh(
True,
True)
6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh
import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
13 X = geompy.MakeVectorDXDYDZ( 1,0,0 )
14 O = geompy.MakeVertex( 100,50,50 )
15 plane = geompy.MakePlane( O, X, 200 )
17 box = geompy.MakeBoxDXDYDZ(200,100,100)
19 shape = geompy.MakeHalfPartition( box, plane )
21 faces = geompy.SubShapeAllSorted(shape, geompy.ShapeType[
"FACE"])
23 ignoreFaces = [ faces[0], faces[-1]]
25 geompy.addToStudy( shape,
"shape" )
26 geompy.addToStudyInFather( shape, face1,
"face1")
30 mesh = smesh.Mesh(shape,
"CFD")
35 mesh.Quadrangle(face1)
37 algo3D = mesh.Tetrahedron()
42 layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces)
46 mesh.MakeGroup(
"Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,
"=",SMESH.Geom_TETRA)
47 mesh.MakeGroup(
"Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,
"=",SMESH.Geom_PYRAMID)
48 mesh.MakeGroup(
"Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,
"=",SMESH.Geom_PENTA)
53 edgeIds = geompy.SubShapeAllIDs( face1, geompy.ShapeType[
"EDGE"])[:-1]
55 mesh = smesh.Mesh(face1,
"VicsousLayers2D")
59 vlHyp = mesh.Triangle().
ViscousLayers2D( 2, 3, 1.5, edgeIds, isEdgesToIgnore=
True )
64 vlHyp.SetEdges( edgeIds,
False )