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
17 # create an empty mesh structure
20 # Create nodes for 12-hedron with pentagonal faces
21 al = 2 * math.pi / 5.0
24 rr = aa / (2.0 * math.sin(al/2.0))
27 dh = rr * math.sqrt(2.0 * (1.0 - cosal * (1.0 + 2.0 * cosal)))
28 hh = 2.0 * dh - dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh
32 bb = [] # above bottom
36 cos_bot = math.cos(i*al)
37 sin_bot = math.sin(i*al)
39 cos_top = math.cos(i*al + al/2.0)
40 sin_top = math.sin(i*al + al/2.0)
42 nd = mesh.AddNode(rr * cos_top, rr * sin_top, hh ) # top
43 nc = mesh.AddNode(r1 * cos_top, r1 * sin_top, hh - dh) # below top
44 nb = mesh.AddNode(r1 * cos_bot, r1 * sin_bot, dh) # above bottom
45 na = mesh.AddNode(rr * cos_bot, rr * sin_bot, 0) # bottom
47 cc.append(nc) # below top
48 bb.append(nb) # above bottom
49 aa.append(na) # bottom
52 # Create a polyhedral volume (12-hedron with pentagonal faces)
53 mesh.GetMeshEditor().AddPolyhedralVolume([dd[0], dd[1], dd[2], dd[3], dd[4], # top
54 dd[0], cc[0], bb[1], cc[1], dd[1], # -
55 dd[1], cc[1], bb[2], cc[2], dd[2], # -
56 dd[2], cc[2], bb[3], cc[3], dd[3], # - below top
57 dd[3], cc[3], bb[4], cc[4], dd[4], # -
58 dd[4], cc[4], bb[0], cc[0], dd[0], # -
59 aa[4], bb[4], cc[4], bb[0], aa[0], # .
60 aa[3], bb[3], cc[3], bb[4], aa[4], # .
61 aa[2], bb[2], cc[2], bb[3], aa[3], # . above bottom
62 aa[1], bb[1], cc[1], bb[2], aa[2], # .
63 aa[0], bb[0], cc[0], bb[1], aa[1], # .
64 aa[0], aa[1], aa[2], aa[3], aa[4]], # bottom
65 [5,5,5,5,5,5,5,5,5,5,5,5])
67 salome.sg.updateObjBrowser(1)