I’m trying to write a reporter plugin which highlights alternating segments (e.g. segments 0, 2, 4… are drawn in green). I can get path.segments, and each segment I get is an array of NSPoints. My problem is that I cannot get its bezierPath easily. I have a following function that’s supposed to return NSPath of the given segment.
def segPath(nodes): np = NSBezierPath.alloc().init() np.moveToPoint_(nodes) if len(nodes) == 2: # straight line np.lineToPoint_(nodes) elif len(nodes) == 4: # curve np.curveToPoint_controlPoint1_controlPoint2_(nodes, nodes, nodes) np.closePath() return np
However, I get this error where I do moveToPoint : TypeError: depythonifying struct, got no sequence
What am I doing wrong? Or is there a better way? I personally think paths.segments can be packaged differently. Just an array of NSPoints doesn’t seem all that helpful.