ADD_UNIT_TESTS(
TestRectangle.py
+ TestcompoundVertices.py
+ TestimportParameters.py
)
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from salome.shaper import geom
+from ModelAPI import *
+
+import os
+
+aSession = ModelAPI_Session.get()
+
+def getFilePath(fileName):
+ path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "compoundVertices")
+ return os.path.join(path, fileName)
+
+theFile = getFilePath("compoundVertices.txt")
+
+aSession.startOperation("Create part for import")
+aPartFeature = aSession.moduleDocument().addFeature("Part")
+aSession.finishOperation()
+aPart = aSession.activeDocument()
+
+aSession.startOperation("Import file")
+aFeatureKind = "compoundVertices"
+anImportFeature = aPart.addFeature(aFeatureKind)
+
+aFieldName = "file_path"
+file = anImportFeature.string(aFieldName)
+file.setValue(theFile)
+
+aSeparatorName = "separator"
+separator = anImportFeature.string(aSeparatorName)
+separator.setValue(" ")
+aSession.finishOperation()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from salome.shaper import geom
+from ModelAPI import *
+
+import os
+
+aSession = ModelAPI_Session.get()
+
+def getFilePath(fileName):
+ path = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "macros", "importParameters")
+ return os.path.join(path, fileName)
+
+theFile = getFilePath("importParameters.txt")
+
+aSession.startOperation("Create part for import")
+aPartFeature = aSession.moduleDocument().addFeature("Part")
+aSession.finishOperation()
+aPart = aSession.activeDocument()
+
+aSession.startOperation("Import file")
+aFeatureKind = "importParameters"
+anImportFeature = aPart.addFeature(aFeatureKind)
+aFieldName = "file_path"
+file = anImportFeature.string(aFieldName)
+file.setValue(theFile)
+aSession.finishOperation()
+
+assert(model.checkPythonDump())
--- /dev/null
+21 16 224.00000000000003
+33 21 224.00000000000003
+35 38 224.00000000000003
+40 43 224.00000000000003
+53 43 224.00000000000003
+69 29 224.00000000000003
+97 58 224.00000000000003
+97 100 224.00000000000003
+80 127 224.00000000000003
+69 128 224.00000000000003
+63 116 224.00000000000003
+51 121 224.00000000000003
+44 137 224.00000000000003
+30 155 224.00000000000003
+23 158 224.00000000000003
+14 154 224.00000000000003
+18 76 224.00000000000003
+16 21 224.00000000000003
return
x = float(coord[0]); y = float(coord[1]); z = float(coord[2]);
point = model.addPoint(part, x,y,z); point.execute(True); self.lfeatures.append(point)
- vertex = model.addVertex(part, [point.result()]); vertex.execute(True); self.lfeatures.append(vertex)
- lVertices.append(vertex.result())
+ #vertex = model.addVertex(part, [point.result()]); vertex.execute(True); self.lfeatures.append(vertex)
+ lVertices.append(point.result())
file.close()
compound = model.addCompound(part, lVertices)
compound.execute(True); self.lfeatures.append(compound)
--- /dev/null
+a 10
+b 12
+c 15
+