From ca4af25854c498df104609a1b01c8018222d25e3 Mon Sep 17 00:00:00 2001 From: NATHALIE GORE Date: Mon, 19 Aug 2019 16:49:57 +0200 Subject: [PATCH] Add field in macro --- src/PythonAddons/macros/compoundVertices/feature.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PythonAddons/macros/compoundVertices/feature.py b/src/PythonAddons/macros/compoundVertices/feature.py index d6b5869f3..3f5a3e3f1 100644 --- a/src/PythonAddons/macros/compoundVertices/feature.py +++ b/src/PythonAddons/macros/compoundVertices/feature.py @@ -47,20 +47,30 @@ class compoundVertices(model.Feature): filepath = apath.value() print("filepath : ", filepath) if filepath != "" : + + from os.path import basename + filename = basename(filepath) + print("filename : ", filename) # Creating the construction points in the current document part = model.activeDocument() lVertices = [] + startPoint = None + with open(filepath) as file: for line in file: coord = line.split(' ') x = float(coord[0]); y = float(coord[1]); z = float(coord[2]); point = model.addPoint(part, x,y,z); point.execute(True) + if startPoint == None : startPoint = point vertex = model.addVertex(part, [point.result()]); vertex.execute(True) lVertices.append(vertex.result()) file.close() - Compound_1 = model.addCompound(part, lVertices) + compound = model.addCompound(part, lVertices) + compound.execute(True) + folder = model.addFolder(part, startPoint, compound) + folder.setName(filename) return setError("The file does not exist") -- 2.39.2