Salome HOME
Copyright update 2020
[modules/smesh.git] / src / Tools / blocFissure / materielCasTests / ellipse.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020  EDF R&D
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 import sys
22 import salome
23
24 salome.salome_init()
25
26 import salome_notebook
27 notebook = salome_notebook.notebook
28
29 import os
30 from blocFissure import gmu
31
32 ###
33 ### GEOM component
34 ###
35
36 import GEOM
37 from salome.geom import geomBuilder
38 import math
39 import SALOMEDS
40
41
42 geompy = geomBuilder.New()
43
44 O = geompy.MakeVertex(0, 0, 0)
45 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
46 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
47 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
48 Vertex_1 = geompy.MakeVertex(400, 0, 400)
49 Vertex_2 = geompy.MakeVertex(400, 0, 500)
50 Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2)
51 Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, Vector_1, 50)
52 Rotation_1 = geompy.MakeRotation(Disk_1, Vector_1, 180*math.pi/180.0)
53 Scale_1 = geompy.MakeScaleAlongAxes(Rotation_1, Vertex_1, 1, 1.5, 1)
54 Vertex_3 = geompy.MakeVertex(420, -400, 300)
55 Vertex_4 = geompy.MakeVertex(500, 400, 500)
56 Box_1 = geompy.MakeBoxTwoPnt(Vertex_4, Vertex_3)
57 ellipse1 = geompy.MakeCut(Scale_1, Box_1)
58 [fondFiss] = geompy.SubShapes(ellipse1, [4])
59 geompy.addToStudy( O, 'O' )
60 geompy.addToStudy( OX, 'OX' )
61 geompy.addToStudy( OY, 'OY' )
62 geompy.addToStudy( OZ, 'OZ' )
63 geompy.addToStudy( Vertex_1, 'Vertex_1' )
64 geompy.addToStudy( Vertex_2, 'Vertex_2' )
65 geompy.addToStudy( Vector_1, 'Vector_1' )
66 geompy.addToStudy( Disk_1, 'Disk_1' )
67 geompy.addToStudy( Rotation_1, 'Rotation_1' )
68 geompy.addToStudy( Scale_1, 'Scale_1' )
69 geompy.addToStudy( Vertex_3, 'Vertex_3' )
70 geompy.addToStudy( Vertex_4, 'Vertex_4' )
71 geompy.addToStudy( Box_1, 'Box_1' )
72 geompy.addToStudy( ellipse1, 'ellipse1' )
73 geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' )
74 geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"))
75
76
77 if salome.sg.hasDesktop():
78   salome.sg.updateObjBrowser()