1 # -*- coding: utf-8 -*-
11 from blocFissure import gmu
18 from salome.geom import geomBuilder
23 geompy = geomBuilder.New()
25 O = geompy.MakeVertex(0, 0, 0)
26 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
27 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
28 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
29 eprouvetteDroite = geompy.MakeBoxDXDYDZ(100, 200, 500)
30 [Compound_z, Compound_y, Compound_x] = geompy.Propagate(eprouvetteDroite)
32 Vertex_1 = geompy.MakeVertex(-10, -10, 200)
33 geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
34 Plane_1 = geompy.MakePlane(Vertex_1, OZ, 2000)
35 geomObj_2 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
36 Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:TT 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 0.000000:WW", Plane_1 )
37 sectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
38 Box_1_vertex_7 = geompy.GetSubShape(eprouvetteDroite, [7])
39 Box_1_vertex_16 = geompy.GetSubShape(eprouvetteDroite, [16])
40 Line_1 = geompy.MakeLineTwoPnt(Box_1_vertex_7, Box_1_vertex_16)
41 geomObj_3 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
42 Plane_2 = geompy.MakePlane(Vertex_1, Line_1, 2000)
43 geomObj_4 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
44 Sketch_2 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:T 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 20.000000:WW", Plane_2 )
45 SectionInclinee = geompy.MakeFaceWires([Sketch_2], 1)
46 geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"))
47 geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"))
48 Vertex_2 = geompy.MakeVertex(110, -10, 200)
49 Vertex_3 = geompy.MakeVertex(110, 80, 200)
50 Vertex_4 = geompy.MakeVertex(-10, 80, 200)
51 Line_2 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
52 Line_3 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
53 Line_4 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
54 Line_5 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_1)
55 Face_1 = geompy.MakeFaceWires([Line_2, Line_3, Line_4, Line_5], 1)
56 Vertex_5 = geompy.MakeVertex(110, -10, 180)
57 Vertex_6 = geompy.MakeVertex(110, 70, 180)
58 Face_1_vertex_4 = geompy.GetSubShape(Face_1, [4])
59 Line_6 = geompy.MakeLineTwoPnt(Face_1_vertex_4, Vertex_5)
60 Line_7 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6)
61 Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9])
62 Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Face_1_vertex_9)
63 Face_2 = geompy.MakeFaceWires([Line_5, Line_6, Line_7, Line_8], 1)
64 geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"))
65 geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"))
66 geompy.addToStudy( O, 'O' )
67 geompy.addToStudy( OX, 'OX' )
68 geompy.addToStudy( OY, 'OY' )
69 geompy.addToStudy( OZ, 'OZ' )
70 geompy.addToStudy( eprouvetteDroite, 'eprouvetteDroite' )
71 geompy.addToStudyInFather( eprouvetteDroite, Compound_z, 'Compound_z' )
72 geompy.addToStudyInFather( eprouvetteDroite, Compound_y, 'Compound_y' )
73 geompy.addToStudyInFather( eprouvetteDroite, Compound_x, 'Compound_x' )
74 geompy.addToStudy( Vertex_1, 'Vertex_1' )
75 geompy.addToStudy( Plane_1, 'Plane_1' )
76 geompy.addToStudy( Sketch_1, 'Sketch_1' )
77 geompy.addToStudy( sectionDroite, 'sectionDroite' )
78 geompy.addToStudyInFather( eprouvetteDroite, Box_1_vertex_7, 'Box_1:vertex_7' )
79 geompy.addToStudyInFather( eprouvetteDroite, Box_1_vertex_16, 'Box_1:vertex_16' )
80 geompy.addToStudy( Line_1, 'Line_1' )
81 geompy.addToStudy( Plane_2, 'Plane_2' )
82 geompy.addToStudy( Sketch_2, 'Sketch_2' )
83 geompy.addToStudy( SectionInclinee, 'SectionInclinee' )
84 geompy.addToStudy( Vertex_2, 'Vertex_2' )
85 geompy.addToStudy( Vertex_3, 'Vertex_3' )
86 geompy.addToStudy( Vertex_4, 'Vertex_4' )
87 geompy.addToStudy( Line_2, 'Line_2' )
88 geompy.addToStudy( Line_3, 'Line_3' )
89 geompy.addToStudy( Line_4, 'Line_4' )
90 geompy.addToStudy( Line_5, 'Line_5' )
91 geompy.addToStudy( Face_1, 'Face_1' )
92 geompy.addToStudy( Vertex_5, 'Vertex_5' )
93 geompy.addToStudy( Vertex_6, 'Vertex_6' )
94 geompy.addToStudyInFather( Face_1, Face_1_vertex_4, 'Face_1:vertex_4' )
95 geompy.addToStudy( Line_6, 'Line_6' )
96 geompy.addToStudy( Line_7, 'Line_7' )
97 geompy.addToStudyInFather( Face_1, Face_1_vertex_9, 'Face_1:vertex_9' )
98 geompy.addToStudy( Line_8, 'Line_8' )
99 geompy.addToStudy( Face_2, 'Face_2' )
105 import SMESH, SALOMEDS
106 from salome.smesh import smeshBuilder
108 smesh = smeshBuilder.New()
109 from salome.StdMeshers import StdMeshersBuilder
110 eprouvetteDroite_1 = smesh.Mesh(eprouvetteDroite)
111 Regular_1D = eprouvetteDroite_1.Segment()
112 Nb_Segments_1 = Regular_1D.NumberOfSegments(50,[],[ ])
113 Nb_Segments_1.SetDistrType( 0 )
114 Quadrangle_2D = eprouvetteDroite_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
115 Hexa_3D = eprouvetteDroite_1.Hexahedron(algo=smeshBuilder.Hexa)
116 Regular_1D_1 = eprouvetteDroite_1.Segment(geom=Compound_y)
117 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(20,[],[ ])
118 Nb_Segments_2.SetDistrType( 0 )
119 Regular_1D_2 = eprouvetteDroite_1.Segment(geom=Compound_x)
120 Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,[],[ ])
121 Nb_Segments_3.SetDistrType( 0 )
122 isDone = eprouvetteDroite_1.Compute()
123 smesh.SetName(eprouvetteDroite_1, 'eprouvetteDroite')
124 eprouvetteDroite_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med"), 0, SMESH.MED_V2_2, 1 )
125 SubMesh_1 = Regular_1D_1.GetSubMesh()
126 SubMesh_2 = Regular_1D_2.GetSubMesh()
129 smesh.SetName(eprouvetteDroite_1.GetMesh(), 'eprouvetteDroite')
130 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
131 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
132 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
133 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
134 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
135 smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
136 smesh.SetName(SubMesh_1, 'SubMesh_1')
137 smesh.SetName(SubMesh_2, 'SubMesh_2')
139 if salome.sg.hasDesktop():
140 salome.sg.updateObjBrowser()