Add anchor points?

  • Is there an easy way to add anchor points to a path, like the Add Anchor Points command in Illustrator?

    add anchor points in illustrator.png

    (I looked here and in the documentation, but I can’t find it.)

  • admin

    you can use the FlattenPen from fontPens.

    from fontPens.flattenPen import FlattenPen
    # create an empty path
    dest = BezierPath()
    # create flatten pen that will draw into the dest bezierPath
    pen = FlattenPen(dest, approximateSegmentLength=30, segmentLines=True)
    # draw into the flatten pen
    pen.moveTo((100, 100))
    pen.curveTo((100, 150), (150, 200), (200, 200))
    # create an other path
    path = BezierPath()
    # draw an oval
    path.oval(200, 200, 200, 200)
    # draw the path with oval in the flatten pen
    # set stroke and fill
    # draw the dest

    to learn more about pens and how to use them see

  • @frederik You opened a door to a whole new world for me. This is much simpler than I thought. And at the same time, I think it’s going to take me some time to get my head around all this pen-stuff. Thanks!

Log in to reply