Automatically transform curves to polygons in AI CC

I have a script that reads SVG coordinates and creates a dot on each anchor point. The problem is that it does not work with curves so I need to transform the curves of any shape into straight lines – example:

enter image description here

A basic object like that is somewhat easy, but I actually need it on a larger scale. The simplest would look like this:

enter image description here

Is there any way to achieve that automatically with Illustrator CC?

I could adjust the script to read another file extension as long as it only outputs X and Y coordinates (no curves). Ex:



One can do this with a combo of curve simplification and divide command, sort of. Do this:

  1. Choose Object → Path → Add Anchor Points. This will add a anchor at the middle of each span (not uniform but along the t parameter of curve). Do this a few times for enough points.

  2. The problem with previous step is that it also divides straight lines. Let us counter this with Object → Path → Simplify….

    • Option straight lines ON
    • Angle threshold to something low (Preview until your happy)

All of the above works uniformly on as many objects as you select so its really a few clicks no matter how complex your path is.

enter image description here

Image 1: Result of each stage. From left to right original, multi divided and simplified.

Now this is nonideal in many ways, for example you couldt want uniform stepping or so. One way would be to use ghostScript to do the flattening. Another would be to split with something more intelligent like Divide (length) by Hiroyuki Sato. This script would also be easy to modify to do the kind of flattening you need. Also this way you could get the points without actually flattening at all.

Another splitting option is to use a few lines as cutting cookie and then use shape builder to divide objects below. (there is a side effect in shape builder that splits at all intersections when you delete a segment.) But YMMV depending on why you sample the shape in the first place.

enter image description here

Image 2: Linear sampling along x axis done with splitting with a shape builder side effect (1 click to split all + creation and deletion of cookiecutter).

Source : Link , Question Author : Georgi Demirev , Answer Author : joojaa

Leave a Comment