1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
28 import salome_notebook
29 notebook = salome_notebook.notebook
32 from blocFissure import gmu
39 from salome.geom import geomBuilder
44 geompy = geomBuilder.New()
46 O = geompy.MakeVertex(0, 0, 0)
47 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
48 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
49 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
50 geomObj_1 = geompy.MakeCylinderRH(1000, 3000)
51 Cylinder_1 = geompy.MakeRotation(geomObj_1, OZ, 180*math.pi/180.0)
52 geomObj_2 = geompy.MakeCylinder(O, OX, 2000, 5000)
53 Cylinder_2 = geompy.MakeRotation(geomObj_2, OX, 180*math.pi/180.0)
54 Translation_1 = geompy.MakeTranslation(Cylinder_2, -2000, 0, 0)
55 Fuse_1 = geompy.MakeFuse(Cylinder_1, Translation_1)
56 Fillet_1 = geompy.MakeFillet(Fuse_1, 800, geompy.ShapeType["EDGE"], [8])
57 Vertex_1 = geompy.MakeVertex(0, -3000, -3000)
58 Vertex_2 = geompy.MakeVertex(2500, 3000, 3000)
59 Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_1)
60 Partition_1 = geompy.MakePartition([Box_1], [Fillet_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
61 geomObj_3 = geompy.MakeCylinderRH(1450, 8000)
62 Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0)
63 Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3)
64 geompy.addToStudy( Cut_1, 'Cut_1' )
65 [faceFiss1] = geompy.SubShapes(Cut_1, [61])
66 geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
67 [Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5])
68 Cylinder_4 = geompy.MakeCylinderRH(2000, 4000)
69 Cylinder_5 = geompy.MakeCylinderRH(1500, 4000)
70 Cut_2 = geompy.MakeCut(Cylinder_4, Cylinder_5)
71 Plane_1 = geompy.MakePlaneLCS(None, 10000, 3)
72 Vertex_5 = geompy.MakeVertex(0, 0, 100)
73 Plane_2 = geompy.MakePlaneThreePnt(O, Vertex_5, Vertex_3, 10000)
74 Plane_3 = geompy.MakePlaneThreePnt(O, Vertex_5, geomObj_4, 10000)
75 Vertex_6 = geompy.MakeVertex(0, -5000, -5000)
76 Vertex_7 = geompy.MakeVertex(5000, 5000, 5000)
77 Box_2 = geompy.MakeBoxTwoPnt(Vertex_7, Vertex_6)
78 Common_1 = geompy.MakeCommon(Box_2, Cut_2)
79 objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
80 [hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain)
81 geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheFiss.brep"))
82 geompy.addToStudy( O, 'O' )
83 geompy.addToStudy( OX, 'OX' )
84 geompy.addToStudy( OY, 'OY' )
85 geompy.addToStudy( OZ, 'OZ' )
86 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
87 geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
88 geompy.addToStudy( Translation_1, 'Translation_1' )
89 geompy.addToStudy( Fuse_1, 'Fuse_1' )
90 geompy.addToStudy( Fillet_1, 'Fillet_1' )
91 geompy.addToStudy( Vertex_1, 'Vertex_1' )
92 geompy.addToStudy( Vertex_2, 'Vertex_2' )
93 geompy.addToStudy( Box_1, 'Box_1' )
94 geompy.addToStudy( Partition_1, 'Partition_1' )
95 geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
96 geompy.addToStudyInFather( faceFiss1, Vertex_3, 'Vertex_3' )
97 geompy.addToStudy( Cylinder_4, 'Cylinder_4' )
98 geompy.addToStudy( Cylinder_5, 'Cylinder_5' )
99 geompy.addToStudy( Cut_2, 'Cut_2' )
100 geompy.addToStudy( Plane_1, 'Plane_1' )
101 geompy.addToStudy( Vertex_5, 'Vertex_5' )
102 geompy.addToStudy( Plane_2, 'Plane_2' )
103 geompy.addToStudy( Plane_3, 'Plane_3' )
104 geompy.addToStudy( Vertex_6, 'Vertex_6' )
105 geompy.addToStudy( Vertex_7, 'Vertex_7' )
106 geompy.addToStudy( Box_2, 'Box_2' )
107 geompy.addToStudy( Common_1, 'Common_1' )
108 geompy.addToStudy( objetSain, 'objetSain' )
109 geompy.addToStudyInFather( objetSain, hauteurs, 'hauteurs' )
110 geompy.addToStudyInFather( objetSain, epaisseurs, 'epaisseurs' )
111 geompy.addToStudyInFather( objetSain, Compound_3, 'Compound_3' )
112 geompy.addToStudyInFather( objetSain, Compound_4, 'Compound_4' )
113 geompy.addToStudyInFather( objetSain, Compound_5, 'Compound_5' )
114 geompy.addToStudyInFather( objetSain, Compound_6, 'Compound_6' )
120 import SMESH, SALOMEDS
121 from salome.smesh import smeshBuilder
123 smesh = smeshBuilder.New()
124 from salome.StdMeshers import StdMeshersBuilder
125 objetSain_1 = smesh.Mesh(objetSain)
126 smesh.SetName(objetSain_1, 'objetSain')
127 Regular_1D = objetSain_1.Segment()
128 Nb_Segments_1 = Regular_1D.NumberOfSegments(10,[],[ ])
129 Nb_Segments_1.SetDistrType( 0 )
130 Quadrangle_2D = objetSain_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
131 Hexa_3D = objetSain_1.Hexahedron(algo=smeshBuilder.Hexa)
132 Regular_1D_1 = objetSain_1.Segment(geom=hauteurs)
133 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(15,[],[ ])
134 Nb_Segments_2.SetDistrType( 0 )
135 Regular_1D_2 = objetSain_1.Segment(geom=epaisseurs)
136 Nb_Segments_3 = Regular_1D_2.NumberOfSegments(5,[],[ ])
137 Nb_Segments_3.SetDistrType( 0 )
138 is_done = objetSain_1.Compute()
139 text = "objetSain_1.Compute"
141 logging.info(text+" OK")
143 text = "Erreur au calcul du maillage.\n" + text
145 raise Exception(text)
146 objetSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheSain.med"))
147 SubMesh_1 = Regular_1D_1.GetSubMesh()
148 SubMesh_2 = Regular_1D_2.GetSubMesh()
151 smesh.SetName(objetSain_1.GetMesh(), 'objetSain')
152 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
153 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
154 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
155 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
156 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
157 smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
158 smesh.SetName(SubMesh_1, 'SubMesh_1')
159 smesh.SetName(SubMesh_2, 'SubMesh_2')
161 if salome.sg.hasDesktop():
162 salome.sg.updateObjBrowser()