Draw a shape with bezier curve (node with handle) in Python?

Hi there,

I’m developing a script which need to drawing shape with bezier curve.

I’ve found that this code can draw a rectangle or other goemartic shape with lines:

coords = ([0, 0], [0, 10], [10, 10], [10, 0])

newline = GSPath()
for idx, xy in enumerate(coords):
	newnode = GSNode()
	newnode.type = GSLINE
	newnode.position = (xy[0], xy[1])
	newline.nodes.append(newnode)
newline.closed = True
	
thisLayer.shapes.append(newline)

but how about this kind of shape that has handle control point (CURVE, QCURVE and OFFCURVE) ? How can I draw it with script/python?

image

Thanks for help.

Good news, I found this method, it works fine for me.

Actually better to use a pen. I’ll post a sample later.

Could you show a demo about coordinates to Bezier curve?

Thank you.

Look at the Build scripts of the mekkablue scripts.