]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - tests/test_precad_intersections.py
Salome HOME
Deleted Study parameter
[plugins/blsurfplugin.git] / tests / test_precad_intersections.py
1 # -*- coding: utf-8 -*-
2
3 import sys
4 import salome
5
6 salome.salome_init()
7
8 ###
9 ### GEOM component
10 ###
11
12 import GEOM
13 from salome.geom import geomBuilder
14 geompy = geomBuilder.New()
15
16
17 geompy.init_geom()
18
19 Face_1 = geompy.MakeFaceHW(10, 10, 1)
20 Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
21 Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
22 Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
23 geompy.addToStudy( Face_1, 'Face_1' )
24 geompy.addToStudy( Translation_1, 'Translation_1' )
25 geompy.addToStudy( Translation_2, 'Translation_2' )
26 geompy.addToStudy( Partition_1, 'Partition_1' )
27
28 p_axe = geompy.MakeVertex(5, -5, 0)
29 axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
30 vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
31 gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
32 geompy.UnionList(gr_vertices, vertices)
33 geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
34
35 ###
36 ### SMESH component
37 ###
38
39 import SMESH
40 from salome.smesh import smeshBuilder
41 smesh = smeshBuilder.New()
42
43
44 Mesh_1 = smesh.Mesh(Partition_1)
45
46 BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
47 BLSURF_Parameters = BLSURF_1.Parameters()
48 BLSURF_Parameters.SetPhySize( 5 )
49 BLSURF_Parameters.SetPreCADMergeEdges( True )
50 BLSURF_Parameters.SetPreCADProcess3DTopology( True )
51
52 Mesh_1.Compute()
53
54 # Check that vertices are merged by preCAD preprocessing
55 nodes = []
56 for p in vertices:
57     x, y, z = geompy.PointCoordinates(p)
58     id_node = Mesh_1.FindNodeClosestTo(x, y, z)
59     nodes.append(id_node)
60
61 nodes = list(set(nodes))
62
63 nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
64
65 assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
66
67 if salome.sg.hasDesktop():
68   salome.sg.updateObjBrowser()