1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2013-2024 CEA, EDF
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
31 from salome.geom import geomBuilder
32 geompy = geomBuilder.New()
37 Face_1 = geompy.MakeFaceHW(10, 10, 1)
38 Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
39 Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
40 Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
41 geompy.addToStudy( Face_1, 'Face_1' )
42 geompy.addToStudy( Translation_1, 'Translation_1' )
43 geompy.addToStudy( Translation_2, 'Translation_2' )
44 geompy.addToStudy( Partition_1, 'Partition_1' )
46 p_axe = geompy.MakeVertex(5, -5, 0)
47 axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
48 vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
49 gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
50 geompy.UnionList(gr_vertices, vertices)
51 geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
58 from salome.smesh import smeshBuilder
59 smesh = smeshBuilder.New()
62 Mesh_1 = smesh.Mesh(Partition_1)
64 BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
65 BLSURF_Parameters = BLSURF_1.Parameters()
66 BLSURF_Parameters.SetPhySize( 5 )
67 BLSURF_Parameters.SetPreCADMergeEdges( True )
68 BLSURF_Parameters.SetPreCADProcess3DTopology( True )
69 BLSURF_Parameters.SetPreCADOptionValue( 'remove_tiny_uv_edges', 'yes' )
73 # Check that vertices are merged by preCAD preprocessing
76 x, y, z = geompy.PointCoordinates(p)
77 id_node = Mesh_1.FindNodeClosestTo(x, y, z)
80 nodes = list(set(nodes))
82 nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
84 assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
86 if salome.sg.hasDesktop():
87 salome.sg.updateObjBrowser()