1 # Copyright (C) 2014-2021 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from salome.shaper import model
21 from salome.shaper import geom
22 from ModelAPI import *
26 aSession = ModelAPI_Session.get()
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)
32 theFile = getFilePath("compoundVertices.txt")
34 aSession.startOperation("Create part for import")
35 aPartFeature = aSession.moduleDocument().addFeature("Part")
36 aSession.finishOperation()
37 aPart = aSession.activeDocument()
39 aSession.startOperation("Import file")
40 aFeatureKind = "compoundVertices"
41 anImportFeature = aPart.addFeature(aFeatureKind)
43 aFieldName = "file_path"
44 file = anImportFeature.string(aFieldName)
45 file.setValue(theFile)
47 aSeparatorName = "separator"
48 separator = anImportFeature.string(aSeparatorName)
49 separator.setValue(" ")
50 aSession.finishOperation()