Removing Ambiguous Anchors in Illustrator

Sometimes after merging shapes it happens that a vector in illustrator has anchors that you don’t need. These anchors might prevent you from doing some other great things with your vector. Unfortunately the simplify function of Illustrator is not sufficient enough to get rid of those, so that is why I wrote a little Illustrator script to get rid of the annoying redundant anchor points.

For a recent project I created some simplified maps of Europe with either horizontal, vertical or 45 degree lines. With the Live Paint Bucket tool I was able to fill a grid built up of triangles. This way I created the borders of countries in a simplified way. However after I tried to stylise the vectors by applying rounded corners to it I noticed that only a few corners were rounded.

After zooming to 6400%  I noticed the following. Many corners anchors in my path had redundant anchors close around them:

Two ambiguous anchors in a corner of a vector.

Two redundant anchors in a corner of a vector.

Unfortunately I could not find any plugins that can solve this issue by removing the redundant anchors. So I decided to write my first Illustrator Script.

The script is not optimal yet, but it worked like a charm in most of my use cases. These are some of it functionalities:

  • It removes the redundant anchors
  • Several methods to determine the optimal anchor (which one to keep), or interpolate between the possible options. It does this by looking one anchor back and one ahead of the group of ambiguous anchors.
  • It can solve multiple groups of anchors at the same time (be careful that
  • Adjust the threshold of how close anchors may be together to be called ambiguous

Download & How to use:

Download
  1. Download the script.
  2. Save it your Adobe Illustrator Presets/Scripts folder. In my case that was: file:\%ProgramFiles%AdobeAdobe Illustrator CS6 (64 Bit)Presetsen_GBScripts
  3. Open your file with ambiguous anchors
  4. Select with the Direct Selection Tool (A) part of a path, or select an entire path
  5. Execute the script by going to FileScripts > RemoveRedundant
    1. If the script is not present in this submenu, either you did not save it at the right place, or you have to restart Illustrator
    2. You can also navigate to the script by clicking on Other Script…

Options:

There are some global variables you can change to optimise the script for your usage. You should open the script in a text editor to do so.

  • Turn on debugging (several alerts will be presented when executing the script), default is off
  • Show a prompt dialog when executing the script to ask for the precision (threshold) for finding redundant anchors, default is off
  • The default precision. The default is 0.1;  (I have used it between 1 and 0.01)
  • Maximum number of anchors to evaluate. This is a precaution to prevent your illustrator from freezing. Default is 100 anchors.

Issues:

  • Trying to solve too many anchors, or heavily anchored paths at the same time might freeze illustrator
  • Sometimes certain ambiguous groups are completely removed (could not identify yet how). This happens often when multiple groups are being solved in one go. To prevent this select one group of ambiguous anchors at the same time.
  • Grouped paths will be skipped at the moment. So select your path at the lowest level possible!
  • It only works for straight cornered anchors. If you have smooth anchors these will be converted to corner anchors.
  • On large files it can be a bit slow

If you come across any issues or have some suggestions please let me know! In some future I might try to turn this into a proper plugin which would make the script run much smoother and faster.

4 Comments on “Removing Ambiguous Anchors in Illustrator

  1. Hi, This script sounds very useful, where can I acquire a copy of “RemoveRedundant.jsx” the download is 404/Not Found ? Thanks so much in advance, looking forward to hear from you and trying this script.

  2. Hi,

    Not sure if you got my email, I was really hoping to acquire this script but the download link is broken. Can you please advise how I may acquire this script, or fix the download link so myself and others can download it, or update the bog post with some information? Please let me know one way or another, thank you for your time. I would be greatly appreciative to get a copy of your script, if you don’t wish to post it, you can email it to me also.

    LL

      • Thanks so much Maurits, I’m looking forward to use it and review the code. Thanks again for fixing the download link, very much appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.