1 # -*- coding: utf-8 -*-
9 notebook = salome_notebook.notebook
12 from blocFissure import gmu
19 from salome.geom import geomBuilder
24 geompy = geomBuilder.New()
26 O = geompy.MakeVertex(0, 0, 0)
27 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
28 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
29 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
30 geomObj_1 = geompy.MakeCylinderRH(1000, 3000)
31 Cylinder_1 = geompy.MakeRotation(geomObj_1, OZ, 180*math.pi/180.0)
32 geomObj_2 = geompy.MakeCylinder(O, OX, 2000, 5000)
33 Cylinder_2 = geompy.MakeRotation(geomObj_2, OX, 180*math.pi/180.0)
34 Translation_1 = geompy.MakeTranslation(Cylinder_2, -2000, 0, 0)
35 Fuse_1 = geompy.MakeFuse(Cylinder_1, Translation_1)
36 Fillet_1 = geompy.MakeFillet(Fuse_1, 800, geompy.ShapeType["EDGE"], [11])
37 Vertex_1 = geompy.MakeVertex(0, -3000, -3000)
38 Vertex_2 = geompy.MakeVertex(2500, 3000, 3000)
39 Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_1)
40 Partition_1 = geompy.MakePartition([Box_1], [Fillet_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
41 geomObj_3 = geompy.MakeCylinderRH(1450, 8000)
42 Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0)
43 Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3)
44 geompy.addToStudy( Cut_1, 'Cut_1' )
45 [faceFiss1] = geompy.SubShapes(Cut_1, [61])
46 geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
47 [Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5])
48 Cylinder_4 = geompy.MakeCylinderRH(2000, 4000)
49 Cylinder_5 = geompy.MakeCylinderRH(1500, 4000)
50 Cut_2 = geompy.MakeCut(Cylinder_4, Cylinder_5)
51 Plane_1 = geompy.MakePlaneLCS(None, 10000, 3)
52 Vertex_5 = geompy.MakeVertex(0, 0, 100)
53 Plane_2 = geompy.MakePlaneThreePnt(O, Vertex_5, Vertex_3, 10000)
54 Plane_3 = geompy.MakePlaneThreePnt(O, Vertex_5, geomObj_4, 10000)
55 Vertex_6 = geompy.MakeVertex(0, -5000, -5000)
56 Vertex_7 = geompy.MakeVertex(5000, 5000, 5000)
57 Box_2 = geompy.MakeBoxTwoPnt(Vertex_7, Vertex_6)
58 Common_1 = geompy.MakeCommon(Box_2, Cut_2)
59 objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
60 [hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain)
61 geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"))
62 geompy.addToStudy( O, 'O' )
63 geompy.addToStudy( OX, 'OX' )
64 geompy.addToStudy( OY, 'OY' )
65 geompy.addToStudy( OZ, 'OZ' )
66 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
67 geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
68 geompy.addToStudy( Translation_1, 'Translation_1' )
69 geompy.addToStudy( Fuse_1, 'Fuse_1' )
70 geompy.addToStudy( Fillet_1, 'Fillet_1' )
71 geompy.addToStudy( Vertex_1, 'Vertex_1' )
72 geompy.addToStudy( Vertex_2, 'Vertex_2' )
73 geompy.addToStudy( Box_1, 'Box_1' )
74 geompy.addToStudy( Partition_1, 'Partition_1' )
75 geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
76 geompy.addToStudyInFather( faceFiss1, Vertex_3, 'Vertex_3' )
77 geompy.addToStudy( Cylinder_4, 'Cylinder_4' )
78 geompy.addToStudy( Cylinder_5, 'Cylinder_5' )
79 geompy.addToStudy( Cut_2, 'Cut_2' )
80 geompy.addToStudy( Plane_1, 'Plane_1' )
81 geompy.addToStudy( Vertex_5, 'Vertex_5' )
82 geompy.addToStudy( Plane_2, 'Plane_2' )
83 geompy.addToStudy( Plane_3, 'Plane_3' )
84 geompy.addToStudy( Vertex_6, 'Vertex_6' )
85 geompy.addToStudy( Vertex_7, 'Vertex_7' )
86 geompy.addToStudy( Box_2, 'Box_2' )
87 geompy.addToStudy( Common_1, 'Common_1' )
88 geompy.addToStudy( objetSain, 'objetSain' )
89 geompy.addToStudyInFather( objetSain, hauteurs, 'hauteurs' )
90 geompy.addToStudyInFather( objetSain, epaisseurs, 'epaisseurs' )
91 geompy.addToStudyInFather( objetSain, Compound_3, 'Compound_3' )
92 geompy.addToStudyInFather( objetSain, Compound_4, 'Compound_4' )
93 geompy.addToStudyInFather( objetSain, Compound_5, 'Compound_5' )
94 geompy.addToStudyInFather( objetSain, Compound_6, 'Compound_6' )
100 import SMESH, SALOMEDS
101 from salome.smesh import smeshBuilder
103 smesh = smeshBuilder.New()
104 from salome.StdMeshers import StdMeshersBuilder
105 objetSain_1 = smesh.Mesh(objetSain)
106 Regular_1D = objetSain_1.Segment()
107 Nb_Segments_1 = Regular_1D.NumberOfSegments(10,[],[ ])
108 Nb_Segments_1.SetDistrType( 0 )
109 Quadrangle_2D = objetSain_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
110 Hexa_3D = objetSain_1.Hexahedron(algo=smeshBuilder.Hexa)
111 Regular_1D_1 = objetSain_1.Segment(geom=hauteurs)
112 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(15,[],[ ])
113 Nb_Segments_2.SetDistrType( 0 )
114 Regular_1D_2 = objetSain_1.Segment(geom=epaisseurs)
115 Nb_Segments_3 = Regular_1D_2.NumberOfSegments(5,[],[ ])
116 Nb_Segments_3.SetDistrType( 0 )
117 isDone = objetSain_1.Compute()
118 smesh.SetName(objetSain_1, 'objetSain')
119 objetSain_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med"), 0, SMESH.MED_V2_2, 1 )
120 SubMesh_1 = Regular_1D_1.GetSubMesh()
121 SubMesh_2 = Regular_1D_2.GetSubMesh()
124 smesh.SetName(objetSain_1.GetMesh(), 'objetSain')
125 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
126 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
127 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
128 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
129 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
130 smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
131 smesh.SetName(SubMesh_1, 'SubMesh_1')
132 smesh.SetName(SubMesh_2, 'SubMesh_2')
134 if salome.sg.hasDesktop():
135 salome.sg.updateObjBrowser()