]> SALOME platform Git repositories - modules/smesh.git/blob - src/Tools/blocFissure/materielCasTests/eprouvetteCourbe.py
Salome HOME
debug blocFissure: geom behaviour change
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / eprouvetteCourbe.py
1 # -*- coding: utf-8 -*-
2
3 import sys
4 import salome
5
6 salome.salome_init()
7 theStudy = salome.myStudy
8
9 import salome_notebook
10 notebook = salome_notebook.notebook
11
12 import os
13 from blocFissure import gmu
14
15 ###
16 ### GEOM component
17 ###
18
19 import GEOM
20 from salome.geom import geomBuilder
21 import math
22 import SALOMEDS
23
24
25 geompy = geomBuilder.New(theStudy)
26
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 Vertex_1 = geompy.MakeVertex(-2000, 0, 0)
32 Cylinder_1 = geompy.MakeCylinder(Vertex_1, OY, 1900, 300)
33 Cylinder_2 = geompy.MakeCylinder(Vertex_1, OY, 2100, 300)
34 Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1)
35 Vertex_2 = geompy.MakeVertex(-500, -100, -300)
36 Vertex_3 = geompy.MakeVertex(500, 400, 300)
37 Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
38 Common_1 = geompy.MakeCommon(Box_1, Cut_1)
39 Vertex_4 = geompy.MakeVertex(-300, -1000, 0)
40 Cylinder_3 = geompy.MakeCylinder(Vertex_4, OX, 1100, 600)
41 EprouvetteCourbe = geompy.MakeCut(Common_1, Cylinder_3)
42 [Compound_y, Compound_z, Compound_x] = geompy.Propagate(EprouvetteCourbe)
43 geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
44 Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 )
45 SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
46 geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
47 geompy.addToStudy( O, 'O' )
48 geompy.addToStudy( OX, 'OX' )
49 geompy.addToStudy( OY, 'OY' )
50 geompy.addToStudy( OZ, 'OZ' )
51 geompy.addToStudy( Vertex_1, 'Vertex_1' )
52 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
53 geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
54 geompy.addToStudy( Cut_1, 'Cut_1' )
55 geompy.addToStudy( Vertex_2, 'Vertex_2' )
56 geompy.addToStudy( Vertex_3, 'Vertex_3' )
57 geompy.addToStudy( Box_1, 'Box_1' )
58 geompy.addToStudy( Common_1, 'Common_1' )
59 geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
60 geompy.addToStudy( Vertex_4, 'Vertex_4' )
61 geompy.addToStudy( EprouvetteCourbe, 'EprouvetteCourbe' )
62 geompy.addToStudy( Sketch_1, 'Sketch_1' )
63 geompy.addToStudy( SectionDroite, 'SectionDroite' )
64 geompy.addToStudyInFather( EprouvetteCourbe, Compound_y, 'Compound_y' )
65 geompy.addToStudyInFather( EprouvetteCourbe, Compound_z, 'Compound_z' )
66 geompy.addToStudyInFather( EprouvetteCourbe, Compound_x, 'Compound_x' )
67
68 ###
69 ### SMESH component
70 ###
71
72 import  SMESH, SALOMEDS
73 from salome.smesh import smeshBuilder
74
75 smesh = smeshBuilder.New(theStudy)
76 from salome.StdMeshers import StdMeshersBuilder
77 EprouvetteCourbe_1 = smesh.Mesh(EprouvetteCourbe)
78 Regular_1D = EprouvetteCourbe_1.Segment()
79 Nb_Segments_1 = Regular_1D.NumberOfSegments(50)
80 Nb_Segments_1.SetDistrType( 0 )
81 Quadrangle_2D = EprouvetteCourbe_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
82 Hexa_3D = EprouvetteCourbe_1.Hexahedron(algo=smeshBuilder.Hexa)
83 Regular_1D_1 = EprouvetteCourbe_1.Segment(geom=Compound_x)
84 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(15)
85 Nb_Segments_2.SetDistrType( 0 )
86 Regular_1D_2 = EprouvetteCourbe_1.Segment(geom=Compound_y)
87 Nb_Segments_3 = Regular_1D_2.NumberOfSegments(25)
88 Nb_Segments_3.SetDistrType( 0 )
89 isDone = EprouvetteCourbe_1.Compute()
90 smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
91 EprouvetteCourbe_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"), 0, SMESH.MED_V2_2, 1 )
92 SubMesh_1 = Regular_1D_1.GetSubMesh()
93 SubMesh_2 = Regular_1D_2.GetSubMesh()
94
95 ## set object names
96 smesh.SetName(EprouvetteCourbe_1.GetMesh(), 'EprouvetteCourbe')
97 smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
98 smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
99 smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
100 smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
101 smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
102 smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
103 smesh.SetName(SubMesh_1, 'SubMesh_1')
104 smesh.SetName(SubMesh_2, 'SubMesh_2')
105
106 if salome.sg.hasDesktop():
107   salome.sg.updateObjBrowser(True)