Salome HOME
updated copyright message
[plugins/blsurfplugin.git] / tests / enforced_internal_vertex.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2013-2023  CEA/DEN, 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 salome
22 import math
23
24 import GEOM
25 from salome.geom import geomBuilder
26 geompy = geomBuilder.New()
27
28 r = 10
29 dist = 10
30 dist_coin = 10.1
31
32 p1 = geompy.MakeVertex(0., 0., 0.)
33 p2 = geompy.MakeVertex(100., 100., 100.)
34 box = geompy.MakeBoxTwoPnt(p1, p2)
35 geompy.addToStudy(box, "box")
36
37 p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
38 geompy.addToStudy(p3, "p3")
39
40 part = geompy.MakePartition([box], [p3])
41 geompy.addToStudy(part, "part")
42
43 left = geompy.GetFaceNearPoint(box, p3)
44 geompy.addToStudyInFather(box, left, "left")
45
46
47 # Mesh
48 # ====
49
50 import SMESH
51 from salome.smesh import smeshBuilder
52 smesh = smeshBuilder.New()
53
54 Mesh = smesh.Mesh(part, "Mesh")
55
56 algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
57 algo2d.SetGeometricMesh( 1 )
58 algo2d.SetAngleMesh( 4 )
59 algo2d.SetPhySize( 8 )
60
61 algo2d.SetInternalEnforcedVertexAllFaces(True)
62
63 Mesh.Compute()
64
65 id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
66
67 x, y, z = Mesh.GetNodeXYZ(id_node)
68
69 assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
70
71 salome.sg.updateObjBrowser()
72