1 """compound of vertices Feature
5 from salome.shaper import model
6 from salome.shaper import geom
9 class compoundVertices(model.Feature):
10 """Import of Construction points
13 # Feature initializations
16 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
17 model.Feature.__init__(self)
21 """Return Id of the Feature."""
22 return "compoundVertices"
26 """Returns ID of the file select parameter."""
30 """Override Feature.getKind()"""
31 return compoundVertices.ID()
34 # Initialization of the dialog panel
36 def initAttributes(self):
37 """Override Feature.initAttributes()"""
38 # Creating the input argument of the feature
39 self.data().addAttribute(self.FILE_ID(), ModelAPI.ModelAPI_AttributeString_typeId())
41 # Execution of the Import
44 """F.execute() -- execute the Feature"""
45 # Retrieving the user input
46 apath = self.string(self.FILE_ID())
47 filepath = apath.value()
48 print("filepath : ", filepath)
51 # Creating the construction points in the current document
52 part = model.activeDocument()
55 with open(filepath) as file:
57 coord = line.split(' ')
58 x = float(coord[0]); y = float(coord[1]); z = float(coord[2]);
59 point = model.addPoint(part, x,y,z)
60 vertex = model.addVertex(part, [point.result()])
61 lVertices.append(vertex.result())
63 Compound_1 = model.addCompound(part, lVertices)
66 setError("The file does not exist")