Salome HOME
544c71d5d70fcecc29e2c9a13863c12f3a524dc1
[plugins/blsurfplugin.git] / tests / test_precad_intersections.py
1 # -*- coding: iso-8859-1 -*-
2
3 ###
4 ### This file is generated automatically by SALOME v6.6.0 with dump python functionality
5 ###
6
7 import sys
8 import salome
9
10 salome.salome_init()
11 theStudy = salome.myStudy
12
13 import salome_notebook
14 notebook = salome_notebook.notebook
15 sys.path.insert( 0, r'/export/home/bourcier/salome/tests')
16
17 ###
18 ### GEOM component
19 ###
20
21 import GEOM
22 from salome.geom import geomBuilder
23 geompy = geomBuilder.New(salome.myStudy)
24
25
26 geompy.init_geom(theStudy)
27
28 geomObj_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
29 geomObj_2 = geompy.MakeVertex(-2, 60, 40)
30 geomObj_3 = geompy.MakeSpherePntR(geomObj_2, 10)
31 geomObj_4 = geompy.MakeVertex(70, 20, 60)
32 geomObj_5 = geompy.MakeSpherePntR(geomObj_4, 15)
33 geomObj_6 = geompy.MakeCompound([geomObj_3, geomObj_5])
34 geomObj_7 = geompy.GetInPlaceByHistory(geomObj_6, geomObj_3)
35 geomObj_8 = geompy.GetInPlaceByHistory(geomObj_6, geomObj_5)
36 Face_1 = geompy.MakeFaceHW(10, 10, 1)
37 Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
38 Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
39 Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
40 geompy.addToStudy( Face_1, 'Face_1' )
41 geompy.addToStudy( Translation_1, 'Translation_1' )
42 geompy.addToStudy( Translation_2, 'Translation_2' )
43 geompy.addToStudy( Partition_1, 'Partition_1' )
44
45 p_axe = geompy.MakeVertex(5, -5, 0)
46 axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
47 vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
48 gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
49 geompy.UnionList(gr_vertices, vertices)
50 geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
51
52 ###
53 ### SMESH component
54 ###
55
56 import SMESH
57 from salome.smesh import smeshBuilder
58 smesh = smeshBuilder.New(salome.myStudy)
59
60
61 Mesh_1 = smesh.Mesh(Partition_1)
62
63 BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
64 BLSURF_Parameters = BLSURF_1.Parameters()
65 BLSURF_Parameters.SetPhySize( 5 )
66 BLSURF_Parameters.SetTopology( 3 )
67
68 Mesh_1.Compute()
69
70 # Check that vertices are merged by preCAD preprocessing
71 nodes = []
72 for p in vertices:
73     x, y, z = geompy.PointCoordinates(p)
74     id_node = Mesh_1.FindNodeClosestTo(x, y, z)
75     nodes.append(id_node)
76
77 nodes = set(nodes)
78
79 assert(len(nodes) == 1)
80
81 if salome.sg.hasDesktop():
82   salome.sg.updateObjBrowser(1)