I have tried most of the methods of the GSHint class, but apart from retrieving the origin, I cannot find the correct way to achieve this. Any ideas? Thanks!
Thank you. I have never worked with NSBezierPath directly and am having some difficulties finding the properties I’m looking for. I can get the first point by calling path.currentPoint(), but I can’t find the last point. I went through most of the developer documentation for NSBezierPath, but I cannot find a way to get a nice, clean pythonic list of points for the path. Could you point me somewhere?
I would not call it pythonic, but this is how you get the elements of an NSBezierPath:
bezierPath = Layer.paths[0].bezierPath
for i in range(0, bezierPath.elementCount()):
element, points = bezierPath.elementAtIndex_associatedPoints_(i)
# do stuff
The current point is not necessarily the first point, but the point where the last drawing instruction left off. Say you perform a lineToPoint: on that Bézier path, then that point will be the new current point.
Thank you very much! I had tried something similar but didn’t know what arguments to pass to elementAtIndex_associatedPoints_(), this works perfectly. Much appreciated!