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