Salome HOME
updated copyright message
[modules/shaper.git] / src / PythonAddons / Test / TestcompoundVertices.py
1 # Copyright (C) 2014-2023  CEA, EDF
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 from salome.shaper import model
21 from salome.shaper import geom
22 from ModelAPI import *
23
24 import os
25
26 aSession = ModelAPI_Session.get()
27
28 def getFilePath(fileName):
29     path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "compoundVertices")
30     return os.path.join(path, fileName)
31
32 theFile = getFilePath("compoundVertices.txt")
33
34 aSession.startOperation("Create part for import")
35 aPartFeature = aSession.moduleDocument().addFeature("Part")
36 aSession.finishOperation()
37 aPart = aSession.activeDocument()
38
39 aSession.startOperation("Import file")
40 aFeatureKind = "compoundVertices"
41 anImportFeature = aPart.addFeature(aFeatureKind)
42
43 aFieldName = "file_path"
44 file = anImportFeature.string(aFieldName)
45 file.setValue(theFile)
46
47 aSeparatorName = "separator"
48 separator = anImportFeature.string(aSeparatorName)
49 separator.setValue(" ")
50 aSession.finishOperation()