Mobile app version of vmapp.org
Login or Join
Heady304

: 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

@Heady304

Posted in: #Adobe #AdobeIllustrator

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:



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



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:

-20.8,262.5
-4.3,263.6
4,264.9
13.4,267.2
23.5,270.6
34.5,275.4

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady304

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini998

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


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.
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.



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.



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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme