Salome HOME
Merge remote-tracking branch 'origin/ngo/macros'
authormpv <mpv@opencascade.com>
Thu, 17 Oct 2019 07:06:22 +0000 (10:06 +0300)
committermpv <mpv@opencascade.com>
Thu, 17 Oct 2019 07:06:22 +0000 (10:06 +0300)
1  2 
src/PythonAddons/Test/TestcompoundVertices.py
src/PythonAddons/macros/compoundVertices/feature.py
src/PythonAddons/macros/importParameters/importParameters.txt

index 0000000000000000000000000000000000000000,05d3b2a2e3bb77e478754070c4b54cb5513a0241..697225c9fda8b7c0bb6ea1c7a7fba54fefbc1d46
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,51 +1,50 @@@
 -
+ # 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()
index ba0a1492176ff7d08bf747d98e75c2736e77239a,d089f743431c41396bd2b66b4b18165a69898092..e7ba419b112c7c07bda26f520e5261206f00a4ae
@@@ -2,6 -2,7 +2,6 @@@
  Author: Nathalie Gore
  """
  
 -from qtsalome import QMessageBox
  from salome.shaper import model
  from salome.shaper import geom
  import ModelAPI
@@@ -78,11 -79,12 +78,11 @@@ class compoundVertices(model.Feature)
                  for line in file:
                      coord = line.split(self.separator)
                      if len(coord) != 3:
 -                        #QMessageBox.warning( self, 'Error!', '3D coords waited!' )
                          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)
index 0000000000000000000000000000000000000000,c5babe823b424deb381a2849f76f2bf256e8753c..a6d7d258dd725447ac2e93c9033cf987a0058d7d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,4 +1,3 @@@
 -
+ a 10
+ b 12
+ c 15