1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2013-2022 CEA/DEN, EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 from salome.geom import geomBuilder
26 geompy = geomBuilder.New()
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")
37 p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
38 geompy.addToStudy(p3, "p3")
40 part = geompy.MakePartition([box], [p3])
41 geompy.addToStudy(part, "part")
43 left = geompy.GetFaceNearPoint(box, p3)
44 geompy.addToStudyInFather(box, left, "left")
51 from salome.smesh import smeshBuilder
52 smesh = smeshBuilder.New()
54 Mesh = smesh.Mesh(part, "Mesh")
56 algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
57 algo2d.SetGeometricMesh( 1 )
58 algo2d.SetAngleMesh( 4 )
59 algo2d.SetPhySize( 8 )
61 algo2d.SetInternalEnforcedVertexAllFaces(True)
65 id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
67 x, y, z = Mesh.GetNodeXYZ(id_node)
69 assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
71 salome.sg.updateObjBrowser()