Performing 3rd direction
This commit is contained in:
parent
c5cc6d0549
commit
f5013d8d0c
5
TODO.md
5
TODO.md
@ -1,5 +1,10 @@
|
|||||||
|
## Usefull utils
|
||||||
|
- createPatch
|
||||||
|
- polyDualMesh
|
||||||
- fvSolution: cellLimited
|
- fvSolution: cellLimited
|
||||||
- collapseDict: collapseEdges
|
- collapseDict: collapseEdges
|
||||||
|
- renumberMesh
|
||||||
|
- processorField
|
||||||
|
|
||||||
## 1.03.21
|
## 1.03.21
|
||||||
- [x] boundary type (wall or symetryPlane)
|
- [x] boundary type (wall or symetryPlane)
|
||||||
|
4
run.py
4
run.py
@ -110,13 +110,13 @@ def calculate(tasks):
|
|||||||
|
|
||||||
foam_utils.createPatch(casepath)
|
foam_utils.createPatch(casepath)
|
||||||
|
|
||||||
|
foam_utils.checkMesh(casepath)
|
||||||
|
|
||||||
scale = (1e-5, 1e-5, 1e-5)
|
scale = (1e-5, 1e-5, 1e-5)
|
||||||
foam_utils.transformPoints(casepath, "{}".format(scale).replace(",", ""))
|
foam_utils.transformPoints(casepath, "{}".format(scale).replace(",", ""))
|
||||||
logging.info("""transformPoints:
|
logging.info("""transformPoints:
|
||||||
scale:\t{}""".format(scale))
|
scale:\t{}""".format(scale))
|
||||||
|
|
||||||
foam_utils.checkMesh(casepath)
|
|
||||||
|
|
||||||
foam_utils.decomposePar(casepath)
|
foam_utils.decomposePar(casepath)
|
||||||
|
|
||||||
foam_utils.potentialFoam(casepath)
|
foam_utils.potentialFoam(casepath)
|
||||||
|
@ -19,45 +19,62 @@ def bodyCenteredCubic(alpha):
|
|||||||
V_2 = geompy.MakeVectorDXDYDZ(1, -1, 0)
|
V_2 = geompy.MakeVectorDXDYDZ(1, -1, 0)
|
||||||
|
|
||||||
L = 1.0
|
L = 1.0
|
||||||
L2 = L/2
|
|
||||||
r0 = L*math.sqrt(3)/4
|
r0 = L*math.sqrt(3)/4
|
||||||
a = L*math.sqrt(2)
|
d1 = L*math.sqrt(2)
|
||||||
a2 = a/2
|
|
||||||
h4 = L/4
|
|
||||||
Pi_4 = 45*math.pi/180.0
|
Pi_4 = 45*math.pi/180.0
|
||||||
|
n = 3
|
||||||
|
|
||||||
sk = geompy.Sketcher3D()
|
sk = geompy.Sketcher3D()
|
||||||
sk.addPointsAbsolute(0, 0, 2*L) #Vertex_1 of Rombus
|
sk.addPointsAbsolute(0, 0, 2*L) # Vertex_1 of Rombus
|
||||||
sk.addPointsAbsolute(L, 0, L) #Vertex_2 of Rombus
|
sk.addPointsAbsolute(L, 0, L) # Vertex_2 of Rombus
|
||||||
sk.addPointsAbsolute(L, L, 0) #Vertex_3 of Rombus
|
sk.addPointsAbsolute(L, L, 0) # Vertex_3 of Rombus
|
||||||
sk.addPointsAbsolute(0, L, L) #Vertex_4 of Rombus
|
sk.addPointsAbsolute(0, L, L) # Vertex_4 of Rombus
|
||||||
sk.addPointsAbsolute(0, 0, 2*L) #Vertex_1 of Rombus
|
sk.addPointsAbsolute(0, 0, 2*L) # Vertex_1 of Rombus
|
||||||
a3D_Sketcher_1 = sk.wire()
|
a3D_Sketcher_1 = sk.wire()
|
||||||
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
||||||
Extrusion_1 = geompy.MakePrismDXDYDZ(Face_1, L2, L2, L2)
|
Extrusion_1 = geompy.MakePrismDXDYDZ(Face_1, L/2, L/2, L/2)
|
||||||
|
|
||||||
sk2 = geompy.Sketcher3D()
|
sk2 = geompy.Sketcher3D()
|
||||||
sk2.addPointsAbsolute(L/3, L/3, 4*L/3) #Vertex_1 of Rombus
|
sk2.addPointsAbsolute(L/3, L/3, 4*L/3) # Vertex_1 of Triangle
|
||||||
sk2.addPointsAbsolute(L, 0, L) #Vertex_2 of Rombus
|
sk2.addPointsAbsolute(L, 0, L) # Vertex_2 of Triangle
|
||||||
sk2.addPointsAbsolute(2*L/3, 2*L/3, 2*L/3) #Vertex_3 of Rombus
|
sk2.addPointsAbsolute(2*L/3, 2*L/3, 2*L/3) # Vertex_3 of Triangle
|
||||||
#sk2.addPointsAbsolute(0, L, L) #Vertex_4 of Rombus
|
sk2.addPointsAbsolute(L/3, L/3, 4*L/3) # Vertex_1 of Triangle
|
||||||
sk2.addPointsAbsolute(L/3, L/3, 4*L/3) #Vertex_1 of Rombus
|
|
||||||
a3D_Sketcher_2 = sk2.wire()
|
a3D_Sketcher_2 = sk2.wire()
|
||||||
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
||||||
Extrusion_2 = geompy.MakePrismDXDYDZ(Face_2, L2, L2, L2)
|
Extrusion_2 = geompy.MakePrismDXDYDZ(Face_2, L/2, L/2, L/2)
|
||||||
|
|
||||||
Box_1 = geompy.MakeBoxDXDYDZ(a, a, L)
|
sk3 = geompy.Sketcher3D()
|
||||||
|
sk3.addPointsAbsolute(L/3, L/3, 4*L/3) # Vertex_1 of Hexagon
|
||||||
|
sk3.addPointsAbsolute(L, 0, L) # Vertex_2 of Hexagon
|
||||||
|
sk3.addPointsAbsolute(4*L/3, L/3, L/3) # Vertex_3 of Hexagon
|
||||||
|
#sk3.addPointsAbsolute(2*L/3, 2*L/3, 2*L/3) # Vertex_3 of Hexagon
|
||||||
|
sk3.addPointsAbsolute(L, L, 0) # Vertex_4 of Hexagon
|
||||||
|
sk3.addPointsAbsolute(L/3, 4*L/3, L/3) # Vertex_5 of Hexagon
|
||||||
|
sk3.addPointsAbsolute(0, L, L) # Vertex_6 of Hexagon
|
||||||
|
sk3.addPointsAbsolute(L/3, L/3, 4*L/3) # Vertex_1 of Hexagon
|
||||||
|
a3D_Sketcher_3 = sk3.wire()
|
||||||
|
Face_3 = geompy.MakeFaceWires([a3D_Sketcher_3], 1)
|
||||||
|
Extrusion_3 = geompy.MakePrismDXDYDZ(Face_3, L/2, L/2, L/2)
|
||||||
|
|
||||||
|
a3D_Sketcher_4 = geompy.MakeTranslation(a3D_Sketcher_3, -L/4, -L/4, -L/4)
|
||||||
|
Face_4 = geompy.MakeFaceWires([a3D_Sketcher_4], 1)
|
||||||
|
#Extrusion_4 = geompy.MakePrismDXDYDZ(Face_4, (n-1.5)*L, (n-1.5)*L, (n-1.5)*L) # Extrusion_3Direction
|
||||||
|
Vector_1 = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
||||||
|
#Extrusion_4 = geompy.MakePrismVecH(Face_4, Vector_1, 4*(n-1.5)*r0) # Extrusion_3Direction
|
||||||
|
Extrusion_4 = geompy.MakePrismVecH(Face_4, Vector_1, 4*(n-2.0)*r0) # Extrusion_3Direction
|
||||||
|
|
||||||
|
Box_1 = geompy.MakeBoxDXDYDZ(d1, d1, L)
|
||||||
Rotation_1 = geompy.MakeRotation(Box_1, OZ, Pi_4)
|
Rotation_1 = geompy.MakeRotation(Box_1, OZ, Pi_4)
|
||||||
Translation_1 = geompy.MakeTranslation(Rotation_1, L, 0, 0)
|
Translation_1 = geompy.MakeTranslation(Rotation_1, L, 0, 0)
|
||||||
Translation_2 = geompy.MakeTranslation(Translation_1, 0, 0, h4)
|
Translation_2 = geompy.MakeTranslation(Translation_1, 0, 0, L/4)
|
||||||
|
|
||||||
Box_2 = geompy.MakeBoxDXDYDZ(a2, a2, L)
|
Box_2 = geompy.MakeBoxDXDYDZ(d1/2, d1/2, L)
|
||||||
Rotation_2 = geompy.MakeRotation(Box_2, OZ, Pi_4)
|
Rotation_2 = geompy.MakeRotation(Box_2, OZ, Pi_4)
|
||||||
Translation_3 = geompy.MakeTranslation(Rotation_2, L, 0, h4)
|
Translation_3 = geompy.MakeTranslation(Rotation_2, L, 0, L/4)
|
||||||
|
|
||||||
Box_3 = geompy.MakeBoxDXDYDZ(a2, a2, L2)
|
Box_3 = geompy.MakeBoxDXDYDZ(d1/2, d1/2, L/2)
|
||||||
Rotation_3 = geompy.MakeRotation(Box_3, OZ, Pi_4)
|
Rotation_3 = geompy.MakeRotation(Box_3, OZ, Pi_4)
|
||||||
Translation_4 = geompy.MakeTranslation(Rotation_3, L, 0, h4)
|
Translation_4 = geompy.MakeTranslation(Rotation_3, L, 0, L/4)
|
||||||
|
|
||||||
geompy.addToStudy( O, 'O' )
|
geompy.addToStudy( O, 'O' )
|
||||||
geompy.addToStudy( OX, 'OX' )
|
geompy.addToStudy( OX, 'OX' )
|
||||||
@ -78,43 +95,54 @@ def bodyCenteredCubic(alpha):
|
|||||||
#geompy.addToStudy( a3D_Sketcher_1, 'a3D_Sketcher_1' )
|
#geompy.addToStudy( a3D_Sketcher_1, 'a3D_Sketcher_1' )
|
||||||
#geompy.addToStudy( Face_1, 'Face_1' )
|
#geompy.addToStudy( Face_1, 'Face_1' )
|
||||||
geompy.addToStudy( Extrusion_1, 'Extrusion_1' )
|
geompy.addToStudy( Extrusion_1, 'Extrusion_1' )
|
||||||
#geompy.addToStudy( a3D_Sketcher_2, 'a3D_Sketcher_1' )
|
geompy.addToStudy( a3D_Sketcher_2, 'a3D_Sketcher_2' )
|
||||||
#geompy.addToStudy( Face_2, 'Face_2' )
|
#geompy.addToStudy( Face_2, 'Face_2' )
|
||||||
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
||||||
|
geompy.addToStudy( a3D_Sketcher_3, 'a3D_Sketcher_3' )
|
||||||
|
#geompy.addToStudy( Face_3, 'Face_3' )
|
||||||
|
#geompy.addToStudy( Extrusion_3, 'Extrusion_3' )
|
||||||
|
geompy.addToStudy( a3D_Sketcher_4, 'a3D_Sketcher_4' )
|
||||||
|
#geompy.addToStudy( Face_4, 'Face_4' )
|
||||||
|
geompy.addToStudy( Extrusion_4, 'Extrusion_4' )
|
||||||
|
|
||||||
|
|
||||||
Radius = r0/(1-alpha)
|
Radius = r0/(1-alpha)
|
||||||
Sphere_1 = geompy.MakeSphereR(Radius)
|
Sphere_1 = geompy.MakeSphereR(Radius)
|
||||||
Down = geompy.MakeMultiTranslation2D(Sphere_1, OX, L, 3, OY, L, 3)
|
Down = geompy.MakeMultiTranslation2D(Sphere_1, OX, L, n, OY, L, n)
|
||||||
Up = geompy.MakeTranslation(Down, 0, 0, 2*L)
|
Up = geompy.MakeTranslation(Down, 0, 0, (n-1)*L)
|
||||||
Up_Down = geompy.MakeMultiTranslation1D(Down, OZ, L, 3)
|
Up_Down = geompy.MakeMultiTranslation1D(Down, OZ, L, n)
|
||||||
Cut_1a = geompy.MakeCutList(Translation_1, [Up_Down])
|
Cut_1a = geompy.MakeCutList(Translation_1, [Up_Down])
|
||||||
Cut_1b = geompy.MakeCutList(Translation_2, [Up_Down])
|
Cut_1b = geompy.MakeCutList(Translation_2, [Up_Down])
|
||||||
Cut_2a = geompy.MakeCutList(Translation_3, [Up_Down])
|
Cut_2a = geompy.MakeCutList(Translation_3, [Up_Down])
|
||||||
Cut_2b = geompy.MakeCutList(Translation_4, [Up_Down])
|
Cut_2b = geompy.MakeCutList(Translation_4, [Up_Down])
|
||||||
Cut_3a = geompy.MakeCutList(Extrusion_1, [Up_Down])
|
Cut_3a = geompy.MakeCutList(Extrusion_1, [Up_Down])
|
||||||
Cut_3b = geompy.MakeCutList(Extrusion_2, [Up_Down])
|
Cut_3b = geompy.MakeCutList(Extrusion_2, [Up_Down])
|
||||||
Middle = geompy.MakeTranslation(Up_Down, L2, L2, L2)
|
Cut_3c = geompy.MakeCutList(Extrusion_4, [Up_Down])
|
||||||
|
Middle = geompy.MakeTranslation(Up_Down, L/2, L/2, L/2)
|
||||||
Pore_1a = geompy.MakeCutList(Cut_1a, [Middle])
|
Pore_1a = geompy.MakeCutList(Cut_1a, [Middle])
|
||||||
Pore_1b = geompy.MakeCutList(Cut_1b, [Middle])
|
Pore_1b = geompy.MakeCutList(Cut_1b, [Middle])
|
||||||
Pore_2a = geompy.MakeCutList(Cut_2a, [Middle])
|
Pore_2a = geompy.MakeCutList(Cut_2a, [Middle])
|
||||||
Pore_2b = geompy.MakeCutList(Cut_2b, [Middle])
|
Pore_2b = geompy.MakeCutList(Cut_2b, [Middle])
|
||||||
Pore_3a = geompy.MakeCutList(Cut_3a, [Middle])
|
Pore_3a = geompy.MakeCutList(Cut_3a, [Middle])
|
||||||
Pore_3b = geompy.MakeCutList(Cut_3b, [Middle])
|
Pore_3b = geompy.MakeCutList(Cut_3b, [Middle])
|
||||||
|
Pore_3c = geompy.MakeCutList(Cut_3c, [Middle])
|
||||||
|
|
||||||
geompy.addToStudy( Sphere_1, 'Sphere_' )
|
geompy.addToStudy( Sphere_1, 'Sphere_'+str(i+1) )
|
||||||
geompy.addToStudy( Down, 'Down_' )
|
geompy.addToStudy( Down, 'Down_'+str(i+1) )
|
||||||
geompy.addToStudy( Up, 'Up_' )
|
geompy.addToStudy( Up, 'Up_'+str(i+1) )
|
||||||
geompy.addToStudy( Up_Down, 'Up_Down_' )
|
geompy.addToStudy( Up_Down, 'Up_Down_'+str(i+1) )
|
||||||
geompy.addToStudy( Cut_1a, 'Cut_1a_' )
|
geompy.addToStudy( Cut_1a, 'Cut_1a_'+str(i+1) )
|
||||||
geompy.addToStudy( Cut_1b, 'Cut_1b_' )
|
geompy.addToStudy( Cut_1b, 'Cut_1b_'+str(i+1) )
|
||||||
geompy.addToStudy( Middle, 'Middle_' )
|
geompy.addToStudy( Middle, 'Middle_'+str(i+1) )
|
||||||
geompy.addToStudy( Pore_1a, 'Pore_1a_' )
|
geompy.addToStudy( Pore_1a, 'Pore_1a_'+str(i+1) )
|
||||||
geompy.addToStudy( Pore_1b, 'Pore_1b_' )
|
geompy.addToStudy( Pore_1b, 'Pore_1b_'+str(i+1) )
|
||||||
geompy.addToStudy( Pore_2a, 'Pore_2a_' )
|
geompy.addToStudy( Pore_2a, 'Pore_2a_'+str(i+1) )
|
||||||
geompy.addToStudy( Pore_2b, 'Pore_2b_' )
|
geompy.addToStudy( Pore_2b, 'Pore_2b_'+str(i+1) )
|
||||||
geompy.addToStudy( Pore_3a, 'Pore_3a_' )
|
geompy.addToStudy( Pore_3a, 'Pore_3a_'+str(i+1) )
|
||||||
geompy.addToStudy( Pore_3b, 'Pore_3b_' )
|
geompy.addToStudy( Pore_3b, 'Pore_3b_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Pore_3c, 'Pore_3c_'+str(i+1) )
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
if salome.sg.hasDesktop():
|
if salome.sg.hasDesktop():
|
||||||
salome.sg.updateObjBrowser()
|
salome.sg.updateObjBrowser()
|
||||||
|
|
||||||
@ -124,4 +152,4 @@ def bodyCenteredCubic(alpha):
|
|||||||
|
|
||||||
grains = geompy.MakeFuseList(grains, False, False)
|
grains = geompy.MakeFuseList(grains, False, False)
|
||||||
|
|
||||||
return grains, Pore_1a, Pore_3a
|
return grains, Pore_1a, Pore_3c
|
||||||
|
@ -24,47 +24,54 @@ def faceCenteredCubic(alpha):
|
|||||||
a=2*r0
|
a=2*r0
|
||||||
b=L/2
|
b=L/2
|
||||||
#c=b/2
|
#c=b/2
|
||||||
h=L/math.sqrt(3)
|
d = L*math.sqrt(3)
|
||||||
|
h = d/3
|
||||||
Pi_4 = 45*math.pi/180.0
|
Pi_4 = 45*math.pi/180.0
|
||||||
|
n = 3 # number of cubes in line
|
||||||
|
|
||||||
Vertex_1 = geompy.MakeVertex(-a, -a, -b)
|
Vertex_1 = geompy.MakeVertex(-a, -a, -b)
|
||||||
Vertex_2 = geompy.MakeVertex(a, a, b)
|
Vertex_2 = geompy.MakeVertex(a, a, b)
|
||||||
Vertex_3 = geompy.MakeVertex(-1, 0, -b) # Center of Sphere_1
|
Vertex_3 = geompy.MakeVertex(-b*(n-1), 0, -b*(n-2)) # Center of Sphere_1
|
||||||
Vertex_4 = geompy.MakeVertex(-b, 0, -0)
|
Vertex_4 = geompy.MakeVertex(-b*n, 0, -b*(n-3)) # Center of Sphere_2
|
||||||
Vertex_5 = geompy.MakeVertex(0, 0, -b)
|
Vertex_5 = geompy.MakeVertex(0, 0, -b)
|
||||||
|
|
||||||
sk = geompy.Sketcher3D() # Rombus
|
sk = geompy.Sketcher3D() # Rombus
|
||||||
sk.addPointsAbsolute(-b, -b, b) #Vertex_1 of Rombus
|
sk.addPointsAbsolute(-b, -b, b) # Vertex_1 of Rombus
|
||||||
sk.addPointsAbsolute(0, -b, 0) #Vertex_2 of Rombus
|
sk.addPointsAbsolute(0, -b, 0) # Vertex_2 of Rombus
|
||||||
sk.addPointsAbsolute(0, 0, -b) #Vertex_3 of Rombus
|
sk.addPointsAbsolute(0, 0, -b) # Vertex_3 of Rombus
|
||||||
sk.addPointsAbsolute(-b, 0, 0) #Vertex_4 of Rombus
|
sk.addPointsAbsolute(-b, 0, 0) # Vertex_4 of Rombus
|
||||||
sk.addPointsAbsolute(-b, -b, b) #Vertex_1 of Rombus
|
sk.addPointsAbsolute(-b, -b, b) # Vertex_1 of Rombus
|
||||||
a3D_Sketcher_1 = sk.wire()
|
a3D_Sketcher_1 = sk.wire()
|
||||||
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
||||||
Face_1_Up = geompy.MakeTranslation(Face_1, b, b, 0)
|
Face_1_Up = geompy.MakeTranslation(Face_1, b, b, 0)
|
||||||
Rhombohedron = geompy.MakeHexa2Faces(Face_1, Face_1_Up)
|
Rhombohedron = geompy.MakeHexa2Faces(Face_1, Face_1_Up)
|
||||||
|
|
||||||
sk_2 = geompy.Sketcher3D() # Triangle
|
sk_2 = geompy.Sketcher3D() # Triangle
|
||||||
sk_2.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Triangle
|
sk_2.addPointsAbsolute(-2*b/3, -2*b/3, b/3) # Vertex_1 of Triangle
|
||||||
sk_2.addPointsAbsolute(0, -b, 0) #Vertex_2 of Triangle
|
sk_2.addPointsAbsolute(0, -b, 0) # Vertex_2 of Triangle
|
||||||
sk_2.addPointsAbsolute(-b/3, -b/3, -b/3) #Vertex_3 of Triangle
|
sk_2.addPointsAbsolute(-b/3, -b/3, -b/3) # Vertex_3 of Triangle
|
||||||
sk_2.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Triangle
|
sk_2.addPointsAbsolute(-2*b/3, -2*b/3, b/3) # Vertex_1 of Triangle
|
||||||
a3D_Sketcher_2 = sk_2.wire()
|
a3D_Sketcher_2 = sk_2.wire()
|
||||||
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
||||||
Extrusion_2 = geompy.MakePrismVecH(Face_2, V, h)
|
Extrusion_2 = geompy.MakePrismVecH(Face_2, V, h)
|
||||||
|
|
||||||
sk_3 = geompy.Sketcher3D() # Hexagon
|
sk_3 = geompy.Sketcher3D() # Hexagon
|
||||||
sk_3.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Hexagon
|
sk_3.addPointsAbsolute(-2*b/3, -2*b/3, b/3) # Vertex_1 of Hexagon
|
||||||
sk_3.addPointsAbsolute(0, -b, 0) #Vertex_2 of Hexagon
|
sk_3.addPointsAbsolute(0, -b, 0) # Vertex_2 of Hexagon
|
||||||
sk_3.addPointsAbsolute(b/3, -2*b/3, -2*b/3) #Vertex_3 of Hexagon
|
sk_3.addPointsAbsolute(b/3, -2*b/3, -2*b/3) # Vertex_3 of Hexagon
|
||||||
sk_3.addPointsAbsolute(0, 0, -b) #Vertex_4 of Hexagon
|
sk_3.addPointsAbsolute(0, 0, -b) # Vertex_4 of Hexagon
|
||||||
sk_3.addPointsAbsolute(-2*b/3, b/3, -2*b/3) #Vertex_5 of Hexagon
|
sk_3.addPointsAbsolute(-2*b/3, b/3, -2*b/3) # Vertex_5 of Hexagon
|
||||||
sk_3.addPointsAbsolute(-b, 0, 0) #Vertex_6 of Hexagon
|
sk_3.addPointsAbsolute(-b, 0, 0) # Vertex_6 of Hexagon
|
||||||
sk_3.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Hexagon
|
sk_3.addPointsAbsolute(-2*b/3, -2*b/3, b/3) # Vertex_1 of Hexagon
|
||||||
a3D_Sketcher_3 = sk_3.wire()
|
a3D_Sketcher_3 = sk_3.wire()
|
||||||
Face_3 = geompy.MakeFaceWires([a3D_Sketcher_3], 1)
|
Face_3 = geompy.MakeFaceWires([a3D_Sketcher_3], 1)
|
||||||
Extrusion_3 = geompy.MakePrismVecH(Face_3, V, h)
|
Extrusion_3 = geompy.MakePrismVecH(Face_3, V, h)
|
||||||
|
|
||||||
|
Translation_1 = geompy.MakeTranslation(a3D_Sketcher_3, -(n-2)*L/3, -(n-2)*L/3, -(n-2)*L/3)
|
||||||
|
Face_4 = geompy.MakeFaceWires([Translation_1], 1)
|
||||||
|
Vector_1 = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
||||||
|
Extrusion_4 = geompy.MakePrismVecH(Face_4, Vector_1, (2*n-3)/3.0*d) # Extrusion_3Direction
|
||||||
|
|
||||||
Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
|
Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
|
||||||
Rotation_1 = geompy.MakeRotation(Box_1, OZ, Pi_4)
|
Rotation_1 = geompy.MakeRotation(Box_1, OZ, Pi_4)
|
||||||
Box_2 = geompy.MakeBoxTwoPnt(Vertex_5, Vertex_2)
|
Box_2 = geompy.MakeBoxTwoPnt(Vertex_5, Vertex_2)
|
||||||
@ -91,45 +98,53 @@ def faceCenteredCubic(alpha):
|
|||||||
geompy.addToStudy( a3D_Sketcher_3, 'a3D_Sketcher_3' )
|
geompy.addToStudy( a3D_Sketcher_3, 'a3D_Sketcher_3' )
|
||||||
geompy.addToStudy( Face_3, 'Face_3' )
|
geompy.addToStudy( Face_3, 'Face_3' )
|
||||||
geompy.addToStudy( Extrusion_3, 'Extrusion_3' )
|
geompy.addToStudy( Extrusion_3, 'Extrusion_3' )
|
||||||
|
geompy.addToStudy( Face_4, 'Face_4' )
|
||||||
|
geompy.addToStudy( Extrusion_4, 'Extrusion_4' )
|
||||||
|
|
||||||
|
|
||||||
Radius = r0/(1-alpha)
|
Radius = r0/(1-alpha)
|
||||||
Sphere_1 = geompy.MakeSpherePntR(Vertex_3, Radius)
|
Sphere_1 = geompy.MakeSpherePntR(Vertex_3, Radius)
|
||||||
Down = geompy.MakeMultiTranslation2D(Sphere_1, V_1, a, 3, V_2, a, 3)
|
Down = geompy.MakeMultiTranslation2D(Sphere_1, V_1, a, n, V_2, a, n)
|
||||||
Up_Down = geompy.MakeMultiTranslation1D(Down, OZ, 1, 2)
|
Up_Down = geompy.MakeMultiTranslation1D(Down, OZ, 1, n-1)
|
||||||
Cut_1 = geompy.MakeCutList(Rotation_1, [Up_Down], True)
|
Cut_1 = geompy.MakeCutList(Rotation_1, [Up_Down], True)
|
||||||
|
|
||||||
Sphere_2 = geompy.MakeSpherePntR(Vertex_4, Radius)
|
Sphere_2 = geompy.MakeSpherePntR(Vertex_4, Radius)
|
||||||
Middle = geompy.MakeMultiTranslation2D(Sphere_2, V_1, a, 2, V_2, a, 2)
|
Middle = geompy.MakeMultiTranslation2D(Sphere_2, V_1, a, n+1, V_2, a, n+1)
|
||||||
Cut_2 = geompy.MakeCutList(Cut_1, [Middle], True)
|
Middle_Up = geompy.MakeMultiTranslation1D(Middle, OZ, 1, n-2)
|
||||||
|
Cut_2 = geompy.MakeCutList(Cut_1, [Middle_Up], True)
|
||||||
|
|
||||||
Common = geompy.MakeCommonList([Cut_2, Rotation_2], True)
|
Common = geompy.MakeCommonList([Cut_2, Rotation_2], True)
|
||||||
Pore_3 = geompy.MakeCommonList([Rhombohedron, Cut_2], True)
|
Pore_3 = geompy.MakeCommonList([Rhombohedron, Cut_2], True)
|
||||||
|
|
||||||
Cut_3 = geompy.MakeCutList(Extrusion_2, [Up_Down], True)
|
Cut_3 = geompy.MakeCutList(Extrusion_2, [Up_Down], True)
|
||||||
Cut_4 = geompy.MakeCutList(Cut_3, [Middle], True)
|
Cut_4 = geompy.MakeCutList(Cut_3, [Middle_Up], True)
|
||||||
|
|
||||||
Cut_5 = geompy.MakeCutList(Extrusion_3, [Up_Down], True)
|
Cut_5 = geompy.MakeCutList(Extrusion_3, [Up_Down], True)
|
||||||
Cut_6 = geompy.MakeCutList(Cut_5, [Middle], True)
|
Cut_6 = geompy.MakeCutList(Cut_5, [Middle_Up], True)
|
||||||
|
|
||||||
#geompy.addToStudy( Sphere_1, 'Sphere_' )
|
Cut_7 = geompy.MakeCutList(Extrusion_4, [Up_Down], True)
|
||||||
geompy.addToStudy( Down, 'Down_' )
|
Cut_8 = geompy.MakeCutList(Cut_7, [Middle_Up], True)
|
||||||
geompy.addToStudy( Up_Down, 'Up_Down_' )
|
|
||||||
geompy.addToStudy( Cut_1, 'Cut_1_' )
|
|
||||||
geompy.addToStudy( Middle, 'Middle_' )
|
|
||||||
geompy.addToStudy( Cut_2, 'Pore_' )
|
|
||||||
geompy.addToStudy( Common, 'Pore_2_' )
|
|
||||||
geompy.addToStudy( Pore_3, 'Pore_3_' )
|
|
||||||
geompy.addToStudy( Cut_4, 'Pore_3a_' )
|
|
||||||
geompy.addToStudy( Cut_6, 'Pore_3b_' )
|
|
||||||
|
|
||||||
|
#geompy.addToStudy( Sphere_1, 'Sphere_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Down, 'Down_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Up_Down, 'Up_Down_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Cut_1, 'Cut_1_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Middle_Up, 'Middle_Up_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Cut_2, 'Pore_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Common, 'Pore_2_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Pore_3, 'Pore_3_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Cut_4, 'Pore_3a_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Cut_6, 'Pore_3b_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Cut_8, 'Pore_3c_'+str(i+1) )
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
if salome.sg.hasDesktop():
|
if salome.sg.hasDesktop():
|
||||||
salome.sg.updateObjBrowser()
|
salome.sg.updateObjBrowser()
|
||||||
|
|
||||||
# Preparation
|
# Preparation
|
||||||
grains = geompy.ExtractShapes(Up_Down, geompy.ShapeType["SOLID"], True)
|
grains = geompy.ExtractShapes(Up_Down, geompy.ShapeType["SOLID"], True)
|
||||||
grains += geompy.ExtractShapes(Middle, geompy.ShapeType["SOLID"], True)
|
grains += geompy.ExtractShapes(Middle_Up, geompy.ShapeType["SOLID"], True)
|
||||||
|
|
||||||
grains = geompy.MakeFuseList(grains, False, False)
|
grains = geompy.MakeFuseList(grains, False, False)
|
||||||
|
|
||||||
return grains, Common, Pore_3
|
return grains, Common, Cut_8
|
||||||
|
@ -22,9 +22,10 @@ def simpleCubic(alpha):
|
|||||||
h2 = 2*h
|
h2 = 2*h
|
||||||
d1 = L*math.sqrt(2)
|
d1 = L*math.sqrt(2)
|
||||||
d2 = L*math.sqrt(3)
|
d2 = L*math.sqrt(3)
|
||||||
d = 1/math.sqrt(3)
|
d = r0/math.sqrt(3)
|
||||||
pi_4 = 45*math.pi/180.0
|
pi_4 = 45*math.pi/180.0
|
||||||
pi_2 = 90*math.pi/180.0
|
pi_2 = 90*math.pi/180.0
|
||||||
|
n = 3 # number of cubes in line
|
||||||
|
|
||||||
Box_1 = geompy.MakeBoxDXDYDZ(d1, d1, h)
|
Box_1 = geompy.MakeBoxDXDYDZ(d1, d1, h)
|
||||||
Rotation_1 = geompy.MakeRotation(Box_1, OZ, pi_4)
|
Rotation_1 = geompy.MakeRotation(Box_1, OZ, pi_4)
|
||||||
@ -35,30 +36,35 @@ def simpleCubic(alpha):
|
|||||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
|
Line_1 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
|
||||||
|
|
||||||
sk = geompy.Sketcher3D()
|
sk = geompy.Sketcher3D()
|
||||||
sk.addPointsAbsolute(0, 0, h2) #Vertex_1 of Rombus
|
sk.addPointsAbsolute(0, 0, h2) # Rombus
|
||||||
sk.addPointsAbsolute(h, 0, h) #Vertex_2 of Rombus
|
sk.addPointsAbsolute(h, 0, h) # Vertex_2 of Rombus
|
||||||
sk.addPointsAbsolute(h, h, 0) #Vertex_3 of Rombus
|
sk.addPointsAbsolute(h, h, 0) # Vertex_3 of Rombus
|
||||||
sk.addPointsAbsolute(0, h, h) #Vertex_4 of Rombus
|
sk.addPointsAbsolute(0, h, h) # Vertex_4 of Rombus
|
||||||
sk.addPointsAbsolute(0, 0, h2) #Vertex_1 of Rombus
|
sk.addPointsAbsolute(0, 0, h2) # Vertex_1 of Rombus
|
||||||
|
|
||||||
sk_2 = geompy.Sketcher3D()
|
|
||||||
sk_2.addPointsAbsolute(L, L, L) #Vertex_1 of Hexagon
|
|
||||||
sk_2.addPointsAbsolute(5*L/3, 2*L/3, 2*L/3) #Vertex_2 of Hexagon
|
|
||||||
sk_2.addPointsAbsolute(2*L, L, 0) #Vertex_3 of Hexagon
|
|
||||||
sk_2.addPointsAbsolute(5*L/3, 5*L/3, -L/3) #Vertex_4 of Hexagon
|
|
||||||
sk_2.addPointsAbsolute(L, 2*L, 0) #Vertex_5 of Hexagon
|
|
||||||
sk_2.addPointsAbsolute(2*L/3, 5*L/3, 2*L/3) #Vertex_6 of Hexagon
|
|
||||||
sk_2.addPointsAbsolute(L, L, L) #Vertex_1 of Hexagon
|
|
||||||
|
|
||||||
a3D_Sketcher_1 = sk.wire()
|
a3D_Sketcher_1 = sk.wire()
|
||||||
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
||||||
Vector_1 = geompy.MakeVectorDXDYDZ(1, 1, 0)
|
Vector_1 = geompy.MakeVectorDXDYDZ(1, 1, 0)
|
||||||
Extrusion_1 = geompy.MakePrismVecH(Face_1, Vector_1, d1)
|
Extrusion_1 = geompy.MakePrismVecH(Face_1, Vector_1, d1)
|
||||||
|
|
||||||
|
sk_2 = geompy.Sketcher3D() # Hexagon
|
||||||
|
sk_2.addPointsAbsolute(L, L, L) # Vertex_1 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(5*L/3, 2*L/3, 2*L/3) # Vertex_2 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(2*L, L, 0) # Vertex_3 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(5*L/3, 5*L/3, -L/3) # Vertex_4 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(L, 2*L, 0) # Vertex_5 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(2*L/3, 5*L/3, 2*L/3) # Vertex_6 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(L, L, L) # Vertex_1 of Hexagon
|
||||||
a3D_Sketcher_2 = sk_2.wire()
|
a3D_Sketcher_2 = sk_2.wire()
|
||||||
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
||||||
Vector_2 = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
Vector_2 = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
||||||
Extrusion_2 = geompy.MakePrismVecH(Face_2, Vector_2, d2/3)
|
Extrusion_2 = geompy.MakePrismVecH(Face_2, Vector_2, d2/3)
|
||||||
|
|
||||||
|
Translation_3 = geompy.MakeTranslation(a3D_Sketcher_2, -L-L/6, -L-L/6, 0-L/6)
|
||||||
|
Face_3 = geompy.MakeFaceWires([Translation_3], 1)
|
||||||
|
Vector_2 = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
||||||
|
#Extrusion_3 = geompy.MakePrismVecH(Face_3, Vector_2, (n-4.0/3)*d2) # Extrusion_3Direction
|
||||||
|
Extrusion_3 = geompy.MakePrismVecH(Face_3, Vector_2, (n-2.0)*d2) # Extrusion_3Direction
|
||||||
|
|
||||||
geompy.addToStudy( O, 'O' )
|
geompy.addToStudy( O, 'O' )
|
||||||
geompy.addToStudy( OX, 'OX' )
|
geompy.addToStudy( OX, 'OX' )
|
||||||
geompy.addToStudy( OY, 'OY' )
|
geompy.addToStudy( OY, 'OY' )
|
||||||
@ -79,32 +85,35 @@ def simpleCubic(alpha):
|
|||||||
geompy.addToStudy( Face_2, 'Face_2' )
|
geompy.addToStudy( Face_2, 'Face_2' )
|
||||||
geompy.addToStudy( Vector_2, 'Vector_2' )
|
geompy.addToStudy( Vector_2, 'Vector_2' )
|
||||||
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
||||||
|
geompy.addToStudy( Translation_3, 'a3D_Sketcher_3' )
|
||||||
|
geompy.addToStudy( Extrusion_3, 'Extrusion_3' )
|
||||||
|
|
||||||
Sphere_1 = geompy.MakeSphereR(r0/(1-alpha))
|
Sphere_1 = geompy.MakeSphereR(r0/(1-alpha))
|
||||||
Multi_Translation_2 = geompy.MakeMultiTranslation2D(Sphere_1, OX, 2, 3, OY, 2, 3)
|
Multi_Translation_2 = geompy.MakeMultiTranslation2D(Sphere_1, OX, L, n, OY, L, n)
|
||||||
Multi_Translation_3 = geompy.MakeMultiTranslation1D(Multi_Translation_2, OZ, 2, 3)
|
Multi_Translation_3 = geompy.MakeMultiTranslation1D(Multi_Translation_2, OZ, L, n)
|
||||||
Cut_1 = geompy.MakeCutList(Translation_2, [Multi_Translation_3])
|
Cut_1 = geompy.MakeCutList(Translation_2, [Multi_Translation_3])
|
||||||
Cut_2 = geompy.MakeCutList(Extrusion_1, [Multi_Translation_3])
|
Cut_2 = geompy.MakeCutList(Extrusion_1, [Multi_Translation_3])
|
||||||
Cut_3 = geompy.MakeCutList(Extrusion_2, [Multi_Translation_3])
|
Cut_3 = geompy.MakeCutList(Extrusion_2, [Multi_Translation_3])
|
||||||
Cut_V = geompy.MakeCutList(Cut_1, [Cut_3])
|
Cut_V = geompy.MakeCutList(Cut_1, [Cut_3])
|
||||||
#Cut_2.SetColor(SALOMEDS.Color(0,0,1))
|
#Cut_2.SetColor(SALOMEDS.Color(0,0,1))
|
||||||
|
Cut_4 = geompy.MakeCutList(Extrusion_3, [Multi_Translation_3])
|
||||||
|
|
||||||
geompy.addToStudy( Sphere_1, 'Sphere_' )
|
geompy.addToStudy( Sphere_1, 'Sphere_' )
|
||||||
geompy.addToStudy( Multi_Translation_2, 'Multi-Translation_2_' )
|
geompy.addToStudy( Multi_Translation_2, 'Multi-Translation_2_'+str(i+1) )
|
||||||
geompy.addToStudy( Multi_Translation_3, 'Multi-Translation_3_' )
|
geompy.addToStudy( Multi_Translation_3, 'Multi-Translation_3_'+str(i+1) )
|
||||||
geompy.addToStudy( Cut_1, 'Pore1_' )
|
geompy.addToStudy( Cut_1, 'Pore1_'+str(i+1) )
|
||||||
geompy.addToStudy( Cut_2, 'Pore2_' )
|
geompy.addToStudy( Cut_2, 'Pore2_'+str(i+1) )
|
||||||
geompy.addToStudy( Cut_3, 'Pore3_' )
|
geompy.addToStudy( Cut_3, 'Pore3_'+str(i+1) )
|
||||||
geompy.addToStudy( Cut_V, 'Cut_V_' )
|
geompy.addToStudy( Cut_V, 'Cut_V_'+str(i+1) )
|
||||||
|
geompy.addToStudy( Cut_4, 'Pore4_'+str(i+1) )
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
if salome.sg.hasDesktop():
|
if salome.sg.hasDesktop():
|
||||||
salome.sg.updateObjBrowser()
|
salome.sg.updateObjBrowser()
|
||||||
|
|
||||||
# Preparation
|
# Preparation
|
||||||
#Cut_1 = geompy.MakeRotation(Cut_1, OZ, -pi_4)
|
|
||||||
|
|
||||||
grains = geompy.ExtractShapes(Multi_Translation_3, geompy.ShapeType["SOLID"], True)
|
grains = geompy.ExtractShapes(Multi_Translation_3, geompy.ShapeType["SOLID"], True)
|
||||||
|
|
||||||
grains = geompy.MakeFuseList(grains, False, False)
|
grains = geompy.MakeFuseList(grains, False, False)
|
||||||
|
|
||||||
return Multi_Translation_3, Cut_1, Cut_2
|
return grains, Cut_1, Cut_4
|
||||||
|
127
temp/samples.old/bodyCenteredCubic.py
Normal file
127
temp/samples.old/bodyCenteredCubic.py
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
import sys
|
||||||
|
import salome
|
||||||
|
|
||||||
|
salome.salome_init()
|
||||||
|
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
import math
|
||||||
|
import SALOMEDS
|
||||||
|
|
||||||
|
geompy = geomBuilder.New()
|
||||||
|
|
||||||
|
def bodyCenteredCubic(alpha):
|
||||||
|
O = geompy.MakeVertex(0, 0, 0)
|
||||||
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
V_1 = geompy.MakeVectorDXDYDZ(1, 1, 0)
|
||||||
|
V_2 = geompy.MakeVectorDXDYDZ(1, -1, 0)
|
||||||
|
|
||||||
|
L = 1.0
|
||||||
|
L2 = L/2
|
||||||
|
r0 = L*math.sqrt(3)/4
|
||||||
|
a = L*math.sqrt(2)
|
||||||
|
a2 = a/2
|
||||||
|
h4 = L/4
|
||||||
|
Pi_4 = 45*math.pi/180.0
|
||||||
|
|
||||||
|
sk = geompy.Sketcher3D()
|
||||||
|
sk.addPointsAbsolute(0, 0, 2*L) #Vertex_1 of Rombus
|
||||||
|
sk.addPointsAbsolute(L, 0, L) #Vertex_2 of Rombus
|
||||||
|
sk.addPointsAbsolute(L, L, 0) #Vertex_3 of Rombus
|
||||||
|
sk.addPointsAbsolute(0, L, L) #Vertex_4 of Rombus
|
||||||
|
sk.addPointsAbsolute(0, 0, 2*L) #Vertex_1 of Rombus
|
||||||
|
a3D_Sketcher_1 = sk.wire()
|
||||||
|
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
||||||
|
Extrusion_1 = geompy.MakePrismDXDYDZ(Face_1, L2, L2, L2)
|
||||||
|
|
||||||
|
sk2 = geompy.Sketcher3D()
|
||||||
|
sk2.addPointsAbsolute(L/3, L/3, 4*L/3) #Vertex_1 of Rombus
|
||||||
|
sk2.addPointsAbsolute(L, 0, L) #Vertex_2 of Rombus
|
||||||
|
sk2.addPointsAbsolute(2*L/3, 2*L/3, 2*L/3) #Vertex_3 of Rombus
|
||||||
|
#sk2.addPointsAbsolute(0, L, L) #Vertex_4 of Rombus
|
||||||
|
sk2.addPointsAbsolute(L/3, L/3, 4*L/3) #Vertex_1 of Rombus
|
||||||
|
a3D_Sketcher_2 = sk2.wire()
|
||||||
|
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
||||||
|
Extrusion_2 = geompy.MakePrismDXDYDZ(Face_2, L2, L2, L2)
|
||||||
|
|
||||||
|
Box_1 = geompy.MakeBoxDXDYDZ(a, a, L)
|
||||||
|
Rotation_1 = geompy.MakeRotation(Box_1, OZ, Pi_4)
|
||||||
|
Translation_1 = geompy.MakeTranslation(Rotation_1, L, 0, 0)
|
||||||
|
Translation_2 = geompy.MakeTranslation(Translation_1, 0, 0, h4)
|
||||||
|
|
||||||
|
Box_2 = geompy.MakeBoxDXDYDZ(a2, a2, L)
|
||||||
|
Rotation_2 = geompy.MakeRotation(Box_2, OZ, Pi_4)
|
||||||
|
Translation_3 = geompy.MakeTranslation(Rotation_2, L, 0, h4)
|
||||||
|
|
||||||
|
Box_3 = geompy.MakeBoxDXDYDZ(a2, a2, L2)
|
||||||
|
Rotation_3 = geompy.MakeRotation(Box_3, OZ, Pi_4)
|
||||||
|
Translation_4 = geompy.MakeTranslation(Rotation_3, L, 0, h4)
|
||||||
|
|
||||||
|
geompy.addToStudy( O, 'O' )
|
||||||
|
geompy.addToStudy( OX, 'OX' )
|
||||||
|
geompy.addToStudy( OY, 'OY' )
|
||||||
|
geompy.addToStudy( OZ, 'OZ' )
|
||||||
|
geompy.addToStudy( V_1, 'V_1' )
|
||||||
|
geompy.addToStudy( V_2, 'V_2' )
|
||||||
|
geompy.addToStudy( Box_1, 'Box_1' )
|
||||||
|
geompy.addToStudy( Rotation_1, 'Rotation_1' )
|
||||||
|
geompy.addToStudy( Translation_1, 'Translation_1' )
|
||||||
|
geompy.addToStudy( Translation_2, 'Translation_2' )
|
||||||
|
geompy.addToStudy( Box_2, 'Box_2' )
|
||||||
|
geompy.addToStudy( Rotation_2, 'Rotation_2' )
|
||||||
|
geompy.addToStudy( Translation_3, 'Translation_3' )
|
||||||
|
geompy.addToStudy( Rotation_3, 'Rotation_3' )
|
||||||
|
geompy.addToStudy( Translation_4, 'Translation_4' )
|
||||||
|
|
||||||
|
#geompy.addToStudy( a3D_Sketcher_1, 'a3D_Sketcher_1' )
|
||||||
|
#geompy.addToStudy( Face_1, 'Face_1' )
|
||||||
|
geompy.addToStudy( Extrusion_1, 'Extrusion_1' )
|
||||||
|
#geompy.addToStudy( a3D_Sketcher_2, 'a3D_Sketcher_1' )
|
||||||
|
#geompy.addToStudy( Face_2, 'Face_2' )
|
||||||
|
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
||||||
|
|
||||||
|
Radius = r0/(1-alpha)
|
||||||
|
Sphere_1 = geompy.MakeSphereR(Radius)
|
||||||
|
Down = geompy.MakeMultiTranslation2D(Sphere_1, OX, L, 3, OY, L, 3)
|
||||||
|
Up = geompy.MakeTranslation(Down, 0, 0, 2*L)
|
||||||
|
Up_Down = geompy.MakeMultiTranslation1D(Down, OZ, L, 3)
|
||||||
|
Cut_1a = geompy.MakeCutList(Translation_1, [Up_Down])
|
||||||
|
Cut_1b = geompy.MakeCutList(Translation_2, [Up_Down])
|
||||||
|
Cut_2a = geompy.MakeCutList(Translation_3, [Up_Down])
|
||||||
|
Cut_2b = geompy.MakeCutList(Translation_4, [Up_Down])
|
||||||
|
Cut_3a = geompy.MakeCutList(Extrusion_1, [Up_Down])
|
||||||
|
Cut_3b = geompy.MakeCutList(Extrusion_2, [Up_Down])
|
||||||
|
Middle = geompy.MakeTranslation(Up_Down, L2, L2, L2)
|
||||||
|
Pore_1a = geompy.MakeCutList(Cut_1a, [Middle])
|
||||||
|
Pore_1b = geompy.MakeCutList(Cut_1b, [Middle])
|
||||||
|
Pore_2a = geompy.MakeCutList(Cut_2a, [Middle])
|
||||||
|
Pore_2b = geompy.MakeCutList(Cut_2b, [Middle])
|
||||||
|
Pore_3a = geompy.MakeCutList(Cut_3a, [Middle])
|
||||||
|
Pore_3b = geompy.MakeCutList(Cut_3b, [Middle])
|
||||||
|
|
||||||
|
geompy.addToStudy( Sphere_1, 'Sphere_' )
|
||||||
|
geompy.addToStudy( Down, 'Down_' )
|
||||||
|
geompy.addToStudy( Up, 'Up_' )
|
||||||
|
geompy.addToStudy( Up_Down, 'Up_Down_' )
|
||||||
|
geompy.addToStudy( Cut_1a, 'Cut_1a_' )
|
||||||
|
geompy.addToStudy( Cut_1b, 'Cut_1b_' )
|
||||||
|
geompy.addToStudy( Middle, 'Middle_' )
|
||||||
|
geompy.addToStudy( Pore_1a, 'Pore_1a_' )
|
||||||
|
geompy.addToStudy( Pore_1b, 'Pore_1b_' )
|
||||||
|
geompy.addToStudy( Pore_2a, 'Pore_2a_' )
|
||||||
|
geompy.addToStudy( Pore_2b, 'Pore_2b_' )
|
||||||
|
geompy.addToStudy( Pore_3a, 'Pore_3a_' )
|
||||||
|
geompy.addToStudy( Pore_3b, 'Pore_3b_' )
|
||||||
|
|
||||||
|
if salome.sg.hasDesktop():
|
||||||
|
salome.sg.updateObjBrowser()
|
||||||
|
|
||||||
|
# Preparation
|
||||||
|
grains = geompy.ExtractShapes(Up_Down, geompy.ShapeType["SOLID"], True)
|
||||||
|
grains += geompy.ExtractShapes(Middle, geompy.ShapeType["SOLID"], True)
|
||||||
|
|
||||||
|
grains = geompy.MakeFuseList(grains, False, False)
|
||||||
|
|
||||||
|
return grains, Pore_1a, Pore_3a
|
135
temp/samples.old/faceCenteredCubic.py
Normal file
135
temp/samples.old/faceCenteredCubic.py
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
import sys
|
||||||
|
import salome
|
||||||
|
|
||||||
|
salome.salome_init()
|
||||||
|
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
import math
|
||||||
|
import SALOMEDS
|
||||||
|
|
||||||
|
geompy = geomBuilder.New()
|
||||||
|
|
||||||
|
def faceCenteredCubic(alpha):
|
||||||
|
O = geompy.MakeVertex(0, 0, 0)
|
||||||
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
V = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
||||||
|
V_1 = geompy.MakeVectorDXDYDZ(1, 1, 0)
|
||||||
|
V_2 = geompy.MakeVectorDXDYDZ(1, -1, 0)
|
||||||
|
|
||||||
|
L = 1.0
|
||||||
|
r0 = L*math.sqrt(2)/4
|
||||||
|
a=2*r0
|
||||||
|
b=L/2
|
||||||
|
#c=b/2
|
||||||
|
h=L/math.sqrt(3)
|
||||||
|
Pi_4 = 45*math.pi/180.0
|
||||||
|
|
||||||
|
Vertex_1 = geompy.MakeVertex(-a, -a, -b)
|
||||||
|
Vertex_2 = geompy.MakeVertex(a, a, b)
|
||||||
|
Vertex_3 = geompy.MakeVertex(-1, 0, -b) # Center of Sphere_1
|
||||||
|
Vertex_4 = geompy.MakeVertex(-b, 0, -0)
|
||||||
|
Vertex_5 = geompy.MakeVertex(0, 0, -b)
|
||||||
|
|
||||||
|
sk = geompy.Sketcher3D() # Rombus
|
||||||
|
sk.addPointsAbsolute(-b, -b, b) #Vertex_1 of Rombus
|
||||||
|
sk.addPointsAbsolute(0, -b, 0) #Vertex_2 of Rombus
|
||||||
|
sk.addPointsAbsolute(0, 0, -b) #Vertex_3 of Rombus
|
||||||
|
sk.addPointsAbsolute(-b, 0, 0) #Vertex_4 of Rombus
|
||||||
|
sk.addPointsAbsolute(-b, -b, b) #Vertex_1 of Rombus
|
||||||
|
a3D_Sketcher_1 = sk.wire()
|
||||||
|
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
||||||
|
Face_1_Up = geompy.MakeTranslation(Face_1, b, b, 0)
|
||||||
|
Rhombohedron = geompy.MakeHexa2Faces(Face_1, Face_1_Up)
|
||||||
|
|
||||||
|
sk_2 = geompy.Sketcher3D() # Triangle
|
||||||
|
sk_2.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Triangle
|
||||||
|
sk_2.addPointsAbsolute(0, -b, 0) #Vertex_2 of Triangle
|
||||||
|
sk_2.addPointsAbsolute(-b/3, -b/3, -b/3) #Vertex_3 of Triangle
|
||||||
|
sk_2.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Triangle
|
||||||
|
a3D_Sketcher_2 = sk_2.wire()
|
||||||
|
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
||||||
|
Extrusion_2 = geompy.MakePrismVecH(Face_2, V, h)
|
||||||
|
|
||||||
|
sk_3 = geompy.Sketcher3D() # Hexagon
|
||||||
|
sk_3.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Hexagon
|
||||||
|
sk_3.addPointsAbsolute(0, -b, 0) #Vertex_2 of Hexagon
|
||||||
|
sk_3.addPointsAbsolute(b/3, -2*b/3, -2*b/3) #Vertex_3 of Hexagon
|
||||||
|
sk_3.addPointsAbsolute(0, 0, -b) #Vertex_4 of Hexagon
|
||||||
|
sk_3.addPointsAbsolute(-2*b/3, b/3, -2*b/3) #Vertex_5 of Hexagon
|
||||||
|
sk_3.addPointsAbsolute(-b, 0, 0) #Vertex_6 of Hexagon
|
||||||
|
sk_3.addPointsAbsolute(-2*b/3, -2*b/3, b/3) #Vertex_1 of Hexagon
|
||||||
|
a3D_Sketcher_3 = sk_3.wire()
|
||||||
|
Face_3 = geompy.MakeFaceWires([a3D_Sketcher_3], 1)
|
||||||
|
Extrusion_3 = geompy.MakePrismVecH(Face_3, V, h)
|
||||||
|
|
||||||
|
Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
|
||||||
|
Rotation_1 = geompy.MakeRotation(Box_1, OZ, Pi_4)
|
||||||
|
Box_2 = geompy.MakeBoxTwoPnt(Vertex_5, Vertex_2)
|
||||||
|
Rotation_2 = geompy.MakeRotation(Box_2, OZ, Pi_4)
|
||||||
|
|
||||||
|
geompy.addToStudy( O, 'O' )
|
||||||
|
geompy.addToStudy( OX, 'OX' )
|
||||||
|
geompy.addToStudy( OY, 'OY' )
|
||||||
|
geompy.addToStudy( OZ, 'OZ' )
|
||||||
|
geompy.addToStudy( V_1, 'V_1' )
|
||||||
|
geompy.addToStudy( V_2, 'V_2' )
|
||||||
|
geompy.addToStudy( Box_1, 'Box_1' )
|
||||||
|
geompy.addToStudy( Rotation_1, 'Rotation_1' )
|
||||||
|
geompy.addToStudy( Box_2, 'Box_2' )
|
||||||
|
geompy.addToStudy( Rotation_2, 'Rotation_2_' )
|
||||||
|
|
||||||
|
geompy.addToStudy( a3D_Sketcher_1, 'a3D_Sketcher_1' )
|
||||||
|
geompy.addToStudy( Face_1, 'Face_1' )
|
||||||
|
geompy.addToStudy( Face_1_Up, 'Face_1_Up' )
|
||||||
|
geompy.addToStudy( Rhombohedron, 'Rhombohedron' )
|
||||||
|
geompy.addToStudy( a3D_Sketcher_2, 'a3D_Sketcher_2' )
|
||||||
|
geompy.addToStudy( Face_2, 'Face_2' )
|
||||||
|
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
||||||
|
geompy.addToStudy( a3D_Sketcher_3, 'a3D_Sketcher_3' )
|
||||||
|
geompy.addToStudy( Face_3, 'Face_3' )
|
||||||
|
geompy.addToStudy( Extrusion_3, 'Extrusion_3' )
|
||||||
|
|
||||||
|
|
||||||
|
Radius = r0/(1-alpha)
|
||||||
|
Sphere_1 = geompy.MakeSpherePntR(Vertex_3, Radius)
|
||||||
|
Down = geompy.MakeMultiTranslation2D(Sphere_1, V_1, a, 3, V_2, a, 3)
|
||||||
|
Up_Down = geompy.MakeMultiTranslation1D(Down, OZ, 1, 2)
|
||||||
|
Cut_1 = geompy.MakeCutList(Rotation_1, [Up_Down], True)
|
||||||
|
|
||||||
|
Sphere_2 = geompy.MakeSpherePntR(Vertex_4, Radius)
|
||||||
|
Middle = geompy.MakeMultiTranslation2D(Sphere_2, V_1, a, 2, V_2, a, 2)
|
||||||
|
Cut_2 = geompy.MakeCutList(Cut_1, [Middle], True)
|
||||||
|
|
||||||
|
Common = geompy.MakeCommonList([Cut_2, Rotation_2], True)
|
||||||
|
Pore_3 = geompy.MakeCommonList([Rhombohedron, Cut_2], True)
|
||||||
|
|
||||||
|
Cut_3 = geompy.MakeCutList(Extrusion_2, [Up_Down], True)
|
||||||
|
Cut_4 = geompy.MakeCutList(Cut_3, [Middle], True)
|
||||||
|
|
||||||
|
Cut_5 = geompy.MakeCutList(Extrusion_3, [Up_Down], True)
|
||||||
|
Cut_6 = geompy.MakeCutList(Cut_5, [Middle], True)
|
||||||
|
|
||||||
|
#geompy.addToStudy( Sphere_1, 'Sphere_' )
|
||||||
|
geompy.addToStudy( Down, 'Down_' )
|
||||||
|
geompy.addToStudy( Up_Down, 'Up_Down_' )
|
||||||
|
geompy.addToStudy( Cut_1, 'Cut_1_' )
|
||||||
|
geompy.addToStudy( Middle, 'Middle_' )
|
||||||
|
geompy.addToStudy( Cut_2, 'Pore_' )
|
||||||
|
geompy.addToStudy( Common, 'Pore_2_' )
|
||||||
|
geompy.addToStudy( Pore_3, 'Pore_3_' )
|
||||||
|
geompy.addToStudy( Cut_4, 'Pore_3a_' )
|
||||||
|
geompy.addToStudy( Cut_6, 'Pore_3b_' )
|
||||||
|
|
||||||
|
if salome.sg.hasDesktop():
|
||||||
|
salome.sg.updateObjBrowser()
|
||||||
|
|
||||||
|
# Preparation
|
||||||
|
grains = geompy.ExtractShapes(Up_Down, geompy.ShapeType["SOLID"], True)
|
||||||
|
grains += geompy.ExtractShapes(Middle, geompy.ShapeType["SOLID"], True)
|
||||||
|
|
||||||
|
grains = geompy.MakeFuseList(grains, False, False)
|
||||||
|
|
||||||
|
return grains, Common, Pore_3
|
110
temp/samples.old/simpleCubic.py
Normal file
110
temp/samples.old/simpleCubic.py
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
import sys
|
||||||
|
import salome
|
||||||
|
|
||||||
|
salome.salome_init()
|
||||||
|
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
import math
|
||||||
|
import SALOMEDS
|
||||||
|
|
||||||
|
geompy = geomBuilder.New()
|
||||||
|
|
||||||
|
def simpleCubic(alpha):
|
||||||
|
O = geompy.MakeVertex(0, 0, 0)
|
||||||
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
|
||||||
|
r0 = 1.0
|
||||||
|
L = 2*r0
|
||||||
|
h = L
|
||||||
|
h2 = 2*h
|
||||||
|
d1 = L*math.sqrt(2)
|
||||||
|
d2 = L*math.sqrt(3)
|
||||||
|
d = 1/math.sqrt(3)
|
||||||
|
pi_4 = 45*math.pi/180.0
|
||||||
|
pi_2 = 90*math.pi/180.0
|
||||||
|
|
||||||
|
Box_1 = geompy.MakeBoxDXDYDZ(d1, d1, h)
|
||||||
|
Rotation_1 = geompy.MakeRotation(Box_1, OZ, pi_4)
|
||||||
|
Translation_2 = geompy.MakeTranslation(Rotation_1, h, 0, 0)
|
||||||
|
Vertex_1 = geompy.MakeVertex(h, 0, 0)
|
||||||
|
Vertex_2 = geompy.MakeVertex(h, h, 0)
|
||||||
|
Vertex_3 = geompy.MakeVertex(h, h, h)
|
||||||
|
Line_1 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
|
||||||
|
|
||||||
|
sk = geompy.Sketcher3D()
|
||||||
|
sk.addPointsAbsolute(0, 0, h2) #Vertex_1 of Rombus
|
||||||
|
sk.addPointsAbsolute(h, 0, h) #Vertex_2 of Rombus
|
||||||
|
sk.addPointsAbsolute(h, h, 0) #Vertex_3 of Rombus
|
||||||
|
sk.addPointsAbsolute(0, h, h) #Vertex_4 of Rombus
|
||||||
|
sk.addPointsAbsolute(0, 0, h2) #Vertex_1 of Rombus
|
||||||
|
|
||||||
|
sk_2 = geompy.Sketcher3D()
|
||||||
|
sk_2.addPointsAbsolute(L, L, L) #Vertex_1 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(5*L/3, 2*L/3, 2*L/3) #Vertex_2 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(2*L, L, 0) #Vertex_3 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(5*L/3, 5*L/3, -L/3) #Vertex_4 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(L, 2*L, 0) #Vertex_5 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(2*L/3, 5*L/3, 2*L/3) #Vertex_6 of Hexagon
|
||||||
|
sk_2.addPointsAbsolute(L, L, L) #Vertex_1 of Hexagon
|
||||||
|
|
||||||
|
a3D_Sketcher_1 = sk.wire()
|
||||||
|
Face_1 = geompy.MakeFaceWires([a3D_Sketcher_1], 1)
|
||||||
|
Vector_1 = geompy.MakeVectorDXDYDZ(1, 1, 0)
|
||||||
|
Extrusion_1 = geompy.MakePrismVecH(Face_1, Vector_1, d1)
|
||||||
|
a3D_Sketcher_2 = sk_2.wire()
|
||||||
|
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
|
||||||
|
Vector_2 = geompy.MakeVectorDXDYDZ(1, 1, 1)
|
||||||
|
Extrusion_2 = geompy.MakePrismVecH(Face_2, Vector_2, d2/3)
|
||||||
|
|
||||||
|
geompy.addToStudy( O, 'O' )
|
||||||
|
geompy.addToStudy( OX, 'OX' )
|
||||||
|
geompy.addToStudy( OY, 'OY' )
|
||||||
|
geompy.addToStudy( OZ, 'OZ' )
|
||||||
|
geompy.addToStudy( Vertex_1, 'Vertex_1' )
|
||||||
|
geompy.addToStudy( Vertex_2, 'Vertex_2' )
|
||||||
|
geompy.addToStudy( Vertex_3, 'Vertex_3' )
|
||||||
|
geompy.addToStudy( Line_1, 'Line_1' )
|
||||||
|
geompy.addToStudy( Box_1, 'Box_1' )
|
||||||
|
geompy.addToStudy( Rotation_1, 'Rotation_1' )
|
||||||
|
geompy.addToStudy( Translation_2, 'Translation_2' )
|
||||||
|
|
||||||
|
geompy.addToStudy( a3D_Sketcher_1, 'a3D_Sketcher_1' )
|
||||||
|
geompy.addToStudy( Face_1, 'Face_1' )
|
||||||
|
geompy.addToStudy( Vector_1, 'Vector_1' )
|
||||||
|
geompy.addToStudy( Extrusion_1, 'Extrusion_1' )
|
||||||
|
geompy.addToStudy( a3D_Sketcher_2, 'a3D_Sketcher_2' )
|
||||||
|
geompy.addToStudy( Face_2, 'Face_2' )
|
||||||
|
geompy.addToStudy( Vector_2, 'Vector_2' )
|
||||||
|
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
||||||
|
|
||||||
|
Sphere_1 = geompy.MakeSphereR(r0/(1-alpha))
|
||||||
|
Multi_Translation_2 = geompy.MakeMultiTranslation2D(Sphere_1, OX, 2, 3, OY, 2, 3)
|
||||||
|
Multi_Translation_3 = geompy.MakeMultiTranslation1D(Multi_Translation_2, OZ, 2, 3)
|
||||||
|
Cut_1 = geompy.MakeCutList(Translation_2, [Multi_Translation_3])
|
||||||
|
Cut_2 = geompy.MakeCutList(Extrusion_1, [Multi_Translation_3])
|
||||||
|
Cut_3 = geompy.MakeCutList(Extrusion_2, [Multi_Translation_3])
|
||||||
|
Cut_V = geompy.MakeCutList(Cut_1, [Cut_3])
|
||||||
|
#Cut_2.SetColor(SALOMEDS.Color(0,0,1))
|
||||||
|
|
||||||
|
geompy.addToStudy( Sphere_1, 'Sphere_' )
|
||||||
|
geompy.addToStudy( Multi_Translation_2, 'Multi-Translation_2_' )
|
||||||
|
geompy.addToStudy( Multi_Translation_3, 'Multi-Translation_3_' )
|
||||||
|
geompy.addToStudy( Cut_1, 'Pore1_' )
|
||||||
|
geompy.addToStudy( Cut_2, 'Pore2_' )
|
||||||
|
geompy.addToStudy( Cut_3, 'Pore3_' )
|
||||||
|
geompy.addToStudy( Cut_V, 'Cut_V_' )
|
||||||
|
|
||||||
|
if salome.sg.hasDesktop():
|
||||||
|
salome.sg.updateObjBrowser()
|
||||||
|
|
||||||
|
# Preparation
|
||||||
|
#Cut_1 = geompy.MakeRotation(Cut_1, OZ, -pi_4)
|
||||||
|
|
||||||
|
grains = geompy.ExtractShapes(Multi_Translation_3, geompy.ShapeType["SOLID"], True)
|
||||||
|
|
||||||
|
grains = geompy.MakeFuseList(grains, False, False)
|
||||||
|
|
||||||
|
return Multi_Translation_3, Cut_1, Cut_2
|
Loading…
Reference in New Issue
Block a user