anisotropy/temp/test.py

176 lines
7.5 KiB
Python
Raw Normal View History

2021-04-08 15:26:00 +05:00
#!/usr/bin/env python
###
### This file is generated automatically by SALOME v9.6.0 with dump python functionality
###
import sys
import salome
salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'/home/nafaryus/projects/anisotrope-cube/build')
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Box_1 = geompy.MakeBoxDXDYDZ(2.82842712474619, 2.82842712474619, 2)
Rotation_1 = geompy.MakeRotation(Box_1, OZ, 45*math.pi/180.0)
Translation_2 = geompy.MakeTranslation(Rotation_1, 2, 0, 0)
Vertex_1 = geompy.MakeVertex(2, 0, 0)
Vertex_2 = geompy.MakeVertex(2, 2, 0)
Vertex_3 = geompy.MakeVertex(2, 2, 2)
Line_1 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
sk = geompy.Sketcher3D()
sk.addPointsAbsolute(0.0000000, 0.0000000, 4.0000000)
sk.addPointsAbsolute(2.0000000, 0.0000000, 2.0000000)
sk.addPointsAbsolute(2.0000000, 2.0000000, 0.0000000)
sk.addPointsAbsolute(0.0000000, 2.0000000, 2.0000000)
sk.addPointsAbsolute(0.0000000, 0.0000000, 4.0000000)
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, 2.82842712474619)
sk = geompy.Sketcher3D()
sk.addPointsAbsolute(2.0000000, 2.0000000, 2.0000000)
sk.addPointsAbsolute(3.3333333, 1.3333333, 1.3333333)
sk.addPointsAbsolute(4.0000000, 2.0000000, 0.0000000)
sk.addPointsAbsolute(3.3333333, 3.3333333, -0.6666667)
sk.addPointsAbsolute(2.0000000, 4.0000000, 0.0000000)
sk.addPointsAbsolute(1.3333333, 3.3333333, 1.3333333)
sk.addPointsAbsolute(2.0000000, 2.0000000, 2.0000000)
a3D_Sketcher_2 = sk.wire()
Face_2 = geompy.MakeFaceWires([a3D_Sketcher_2], 1)
geomObj_1 = geompy.MakeVectorDXDYDZ(1, 1, 1)
Extrusion_2 = geompy.MakePrismVecH(Face_2, geomObj_1, 1.154700538379251)
a3D_Sketcher_3 = geompy.MakeTranslation(a3D_Sketcher_2, -2.333333333333333, -2.333333333333333, -0.3333333333333333)
geomObj_2 = geompy.MakeFaceWires([a3D_Sketcher_3], 1)
Vector_2 = geompy.MakeVectorDXDYDZ(1, 1, 1)
Extrusion_3 = geompy.MakePrismVecH(geomObj_2, Vector_2, 3.464101615137754)
Sphere_ = geompy.MakeSphereR(1.111111111111111)
Multi_Translation_2_ = geompy.MakeMultiTranslation2D(Sphere_, OX, 2, 3, OY, 2, 3)
Multi_Translation_3_ = geompy.MakeMultiTranslation1D(Multi_Translation_2_, OZ, 2, 3)
[geomObj_3,geomObj_4,geomObj_5,geomObj_6,geomObj_7,geomObj_8,geomObj_9,geomObj_10,geomObj_11,geomObj_12,geomObj_13,geomObj_14,geomObj_15,geomObj_16,geomObj_17,geomObj_18,geomObj_19,geomObj_20,geomObj_21,geomObj_22,geomObj_23,geomObj_24,geomObj_25,geomObj_26,geomObj_27,geomObj_28,geomObj_29] = geompy.ExtractShapes(Multi_Translation_3_, geompy.ShapeType["SOLID"], True)
Pore1_ = geompy.MakeCutList(Translation_2, [Multi_Translation_3_])
Pore2_ = geompy.MakeCutList(Extrusion_1, [Multi_Translation_3_])
Pore3_ = geompy.MakeCutList(Extrusion_2, [Multi_Translation_3_])
Cut_V_ = geompy.MakeCutList(Pore1_, [Pore3_])
Pore4_ = geompy.MakeCutList(Extrusion_3, [Multi_Translation_3_])
grains = geompy.MakeFuseList([geomObj_3, geomObj_4, geomObj_5, geomObj_6, geomObj_7, geomObj_8, geomObj_9, geomObj_10, geomObj_11, geomObj_12, geomObj_13, geomObj_14, geomObj_15, geomObj_16, geomObj_17, geomObj_18, geomObj_19, geomObj_20, geomObj_21, geomObj_22, geomObj_23, geomObj_24, geomObj_25, geomObj_26, geomObj_27, geomObj_28, geomObj_29], False, False)
geomObj_30 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
sk = geompy.Sketcher3D()
sk.addPointsAbsolute(2, 0, 0)
sk.addPointsAbsolute(0, 2, 0)
sk.addPointsAbsolute(0, 2, 2)
sk.addPointsAbsolute(2, 0, 2)
sk.addPointsAbsolute(2, 0, 0)
a3D_Sketcher_1_1 = sk.wire()
Face_3 = geompy.MakeFaceWires([a3D_Sketcher_1_1], 0)
Vector_Normal_1 = geompy.GetNormal(Face_3)
cuban = geompy.MakePrismVecH(Face_3, Vector_Normal_1, 2)
inlet = geompy.CreateGroup(cuban, geompy.ShapeType["FACE"])
geompy.UnionIDs(inlet, [31])
outlet = geompy.CreateGroup(cuban, geompy.ShapeType["FACE"])
geompy.UnionIDs(outlet, [33])
sp1 = geompy.CreateGroup(cuban, geompy.ShapeType["FACE"])
geompy.UnionIDs(sp1, [20])
sp2 = geompy.CreateGroup(cuban, geompy.ShapeType["FACE"])
geompy.UnionIDs(sp2, [3])
sp3 = geompy.CreateGroup(cuban, geompy.ShapeType["FACE"])
geompy.UnionIDs(sp3, [27])
sp4 = geompy.CreateGroup(cuban, geompy.ShapeType["FACE"])
geompy.UnionIDs(sp4, [13])
Cut_1 = geompy.MakeCutList(cuban, [grains])
Cut_2 = geompy.MakeCutList(inlet, [grains])
[geomObj_31] = geompy.SubShapeAll(Cut_2, geompy.ShapeType["FACE"])
Cut_3 = geompy.MakeCutList(outlet, [grains])
Cut_4 = geompy.MakeCutList(sp1, [grains])
Cut_5 = geompy.MakeCutList(sp2, [grains])
Cut_6 = geompy.MakeCutList(sp3, [grains])
Cut_7 = geompy.MakeCutList(sp4, [grains])
geomObj_32 = geompy.GetInPlace(Cut_1, Cut_2, True)
[geomObj_33] = geompy.SubShapeAll(geomObj_32, geompy.ShapeType["FACE"])
[geomObj_34] = geompy.SubShapeAll(geomObj_32, geompy.ShapeType["FACE"])
inlet_1 = geompy.CreateGroup(Cut_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(inlet_1, [13])
geomObj_35 = geompy.GetInPlace(Cut_1, Cut_3, True)
[geomObj_36] = geompy.SubShapeAll(geomObj_35, geompy.ShapeType["FACE"])
[geomObj_37] = geompy.SubShapeAll(geomObj_35, geompy.ShapeType["FACE"])
outlet_1 = geompy.CreateGroup(Cut_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(outlet_1, [101])
geometry1 = Pore1_
geometry2 = Pore4_
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
geompy.addToStudy( Translation_2, 'Translation_2' )
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( 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( Extrusion_2, 'Extrusion_2' )
geompy.addToStudy( a3D_Sketcher_3, 'a3D_Sketcher_3' )
geompy.addToStudy( Vector_2, 'Vector_2' )
geompy.addToStudy( Extrusion_3, 'Extrusion_3' )
geompy.addToStudy( Sphere_, 'Sphere_' )
geompy.addToStudy( Multi_Translation_2_, 'Multi-Translation_2_' )
geompy.addToStudy( Multi_Translation_3_, 'Multi-Translation_3_' )
geompy.addToStudy( Pore1_, 'Pore1_' )
geompy.addToStudy( Pore2_, 'Pore2_' )
geompy.addToStudy( Pore3_, 'Pore3_' )
geompy.addToStudy( Cut_V_, 'Cut_V_' )
geompy.addToStudy( Pore4_, 'Pore4_' )
geompy.addToStudy( grains, 'grains' )
geompy.addToStudy( a3D_Sketcher_1_1, '3D Sketcher_1' )
geompy.addToStudy( Face_3, 'Face_3' )
geompy.addToStudy( Vector_Normal_1, 'Vector_Normal_1' )
geompy.addToStudy( cuban, 'cuban' )
geompy.addToStudyInFather( cuban, inlet, 'inlet' )
geompy.addToStudyInFather( cuban, outlet, 'outlet' )
geompy.addToStudyInFather( cuban, sp1, 'sp1' )
geompy.addToStudyInFather( cuban, sp2, 'sp2' )
geompy.addToStudyInFather( cuban, sp3, 'sp3' )
geompy.addToStudyInFather( cuban, sp4, 'sp4' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( Cut_2, 'Cut_2' )
geompy.addToStudy( Cut_3, 'Cut_3' )
geompy.addToStudy( Cut_4, 'Cut_4' )
geompy.addToStudy( Cut_5, 'Cut_5' )
geompy.addToStudy( Cut_6, 'Cut_6' )
geompy.addToStudy( Cut_7, 'Cut_7' )
geompy.addToStudyInFather( Cut_1, inlet_1, 'inlet' )
geompy.addToStudyInFather( Cut_1, outlet_1, 'outlet' )
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()