Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 from geompy import *
00031 from math import *
00032
00033 import smesh
00034
00035
00036
00037
00038
00039
00040
00041
00042 Radius = 100.
00043 Dist = Radius / 2.
00044 Factor = 2.5
00045 Angle90 = pi / 2.
00046 NbSeg = 10
00047
00048 PointsList = []
00049 ShapesList = []
00050
00051
00052 P0 = MakeVertex(0., 0., 0.)
00053 P1 = MakeVertex(-Dist, -Dist, -Dist)
00054 P2 = MakeVertex(-Dist, -Dist, Dist)
00055 P3 = MakeVertex(-Dist, Dist, Dist)
00056 P4 = MakeVertex(-Dist, Dist, -Dist)
00057
00058 VZ = MakeVectorDXDYDZ(0., 0., 1.)
00059
00060
00061 PointsList.append(P1)
00062 PointsList.append(P2)
00063 PointsList.append(P3)
00064 PointsList.append(P4)
00065 PointsList.append(P1)
00066
00067 PolyLine = MakePolyline(PointsList)
00068
00069 Face1 = MakeFace(PolyLine, 1)
00070 Face2 = MakeScaleTransform(Face1, P0, Factor)
00071 Face3 = MakeScaleTransform(Face1, P0, -1.)
00072
00073
00074 Sphere = MakeSphereR(Radius)
00075
00076 Block = MakeHexa2Faces(Face1, Face2)
00077 Cube = MakeHexa2Faces(Face1, Face3)
00078
00079 Common1 = MakeBoolean(Sphere, Block, 1)
00080 Common2 = MakeRotation(Common1, VZ, Angle90)
00081
00082 MultiBlock1 = MakeMultiTransformation1D(Common1, 20, -1, 3)
00083 MultiBlock2 = MakeMultiTransformation1D(Common2, 30, -1, 3)
00084
00085
00086 ShapesList.append(Cube)
00087 ShapesList.append(MultiBlock1)
00088 ShapesList.append(MultiBlock2)
00089 Compound = MakeCompound(ShapesList)
00090
00091 Result = MakeGlueFaces(Compound, 0.1)
00092
00093
00094 Id_Sphere = addToStudy(Sphere, "Sphere")
00095 Id_Cube = addToStudy(Cube, "Cube")
00096
00097 Id_Common1 = addToStudy(Common1, "Common1")
00098 Id_Common2 = addToStudy(Common2, "Common2")
00099
00100 Id_MultiBlock1 = addToStudy(MultiBlock1, "MultiBlock1")
00101 Id_MultiBlock2 = addToStudy(MultiBlock2, "MultiBlock2")
00102
00103 Id_Result = addToStudy(Result, "Result")
00104
00105
00106
00107 smesh.SetCurrentStudy(salome.myStudy)
00108 my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
00109 algo = my_hexa.Segment()
00110 algo.NumberOfSegments(NbSeg)
00111 my_hexa.Quadrangle()
00112 my_hexa.Hexahedron()
00113 my_hexa.Compute()