0

I want to use this NURBS-Library. In the given example the controls points are read from a *txt File, but I want to read them from a list:

points = [(220, 340), (230, 350), (274.81862312, 374.16747697), (296.53778748, 432.99598526), (287.34352425, 482.4938853), (240.25166951, 533.10730113), (167.82511298, 566.76643201), (105.54327019, 576.83965142), (33.78721601, 565.2008206), (-4.53463006, 526.7978961), (-28.68208396, 467.04880685), (-30.68208396, 447.04880685)]

curve = ns.Curve()
curve.ctrlpts(points)

This doesn't work: "TypeError: 'tuple' object is not callable"

Any ideas? According to the documentation it should work:

ctrlpts: Control points of a Curve is stored as a list of (x, y) coordinates

Thanks in advance.

schlank
  • 19
  • 4

1 Answers1

0

From what I see looking at the source code of the project you linked, curve.ctrlpts is a property, thus

curve.ctrlpts = points

instead of

curve.ctrlpts(points)

should suffice.

Note: what happens with your current code is that you are indeed trying to use a tuple as a function (i.e. calling it). curve.ctrlpts calls the property getter, which returns the list of control points as a tuple. By writing

curve.ctrlpts(points)

you are trying to call the returned tuple as if it were a function, hence the error.

themiurge
  • 1,619
  • 17
  • 21