• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Does anyone have a script for adding an anchor point to the top-most point of a path?

Participant ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

Hi there!

 

I was wondering if any of you have got a script that would be able to add an anchor point to the top-most/bottom-most point of a selected path (ex: an arc)?

 

I know it's a long shot, and I'm not even sure if it's doable. But it's a problem I've run into quite often, so I was wondering if someone has been able to fix it in the past. Thank you!

TOPICS
Scripting

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 13, 2022 Mar 13, 2022

Hi @Eduard Buta, I've made a script that I think will do what you want. I've made a github page for it and you can download the latest release .zip file. The way you use it is to select *just the path segment(s) you want* and run the script "Add Path Point At Extrema.js". So if you just want a top anchor point, just select the topmost path segment (use direct selection tool and click on the path no on the anchor points) and then run script. If you select the whole path, it will add extreme point

...

Votes

Translate

Translate
Adobe
Community Expert ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

can you show a screen shot of a path showing what you need?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

Absolutely. Here's the image in question, showcasing through the red circle the general area in which that point would be.

 

What I understand by the top-most point is the actual point that 'touches' (or represents, if you will) the top margin of a path's bounding box. In other words, the point with the highest coordinates on the vertical axis, or the 'peak' if we're thinking strictly of arches. I hope that's enough context to clear things up! Example-image.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

at first, I thought you needed to add an achor to the end of a path, that should be easy. 

 

After seeing your image, it's not impossible to write a script to do it but it's not as easy.

 

would a manual method work for you?

addAnchorToTopOfArch.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

Manual methods are exactly how I've tackled the issue so far. And since it's something coming up fairly often, I would definitely prefer a script. But I understand I might be out of luck in that department, since it sounds like a complicated task. Thank you for your detailed answer!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

There is a plugin that can add points at these extreme positions (or move existing points there): VectorScribe

 

So if you need it often, that might be an option.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

I will look into that. I appreciate the tip!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

You can download an action set file here:

 

Point Maker 2

 

It contains four actions that can make points at different positions on curved paths (topmost, bottommost, leftmost and rightmost).

 

Instruction:

 

- Download and unzip the file
- In the Actions palette import the action set file (point_maker_1.aia)
- Select an arc or any other curved path
- Run one of the actions
- Do some experiments

 

Note that the actions may fail in some cases, but they certainly work in many cases.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

These certainly seem to work in some cases, so thank you. However, I'm really looking for scripts, since I'm using a script panel to create GUI button elements for all my scripts, extending the Illustrator capabilities through a new set of tools that way. Anyways, beggars can't be choosers, so I thank you for this solution. It'll definitely come in handy if I can't seem to find a script that does this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

By saying that the actions seem to work in some cases, does that mean that you carefully tested them and found out that they merely work sometimes and don't work more often than not?

 

I'm just asking because I checked them with some hundreds of different curved paths and as far as I can see they work reliably in almost all cases. Moreover, they can handle multiple selected (ungrouped and non-overlapping) paths as well as direct selected segments.

 

Sometimes (in rather rare cases) the actions may fail, but that has almost always to do with a general issue: Actions sometimes tend to stumble upon their own steps, especially if one runs them in accelerated mode.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

I only tested them on a bunch of paths, but they seemed to do the trick. I will have to get accustomed to them more if I am to use them generally. So I can't really give you a satisfying answer here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Just FYI Kurt, only point_maker_Top works for me - all the others say "Cannot find the swatch."

This is probably useful, although I can't think of a situation where I'd need it, but if I do I can always rotate 90degress and run point_maker_Top for each "side."

Sadly I've never put any time into learning anything about Actions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Thanks for the hint, Met.

 

Most likely this is one of the typical localisation issues that were introduced some years ago when one creates actions in non-English Illustrator versions and share them with users that use English or other international versions.

 

At the moment it would be required to recreate the actions in an English version of Illustrator, such that the swatch called "Ohne" would be incorporated as "None".

 

Perhaps I may do it. Perhaps not.

 

In the meantime you may want to take a closer look at the single action steps and do the recreation yourself, so it will work fluently in the English version.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

Met,

 

I've modified the actions. The localisation issues should now be fixed. You can download it here or in my other post above:

 

Point Maker 2

 

You may try them and report if they work in your version of Illustrator.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

Awesome, thanks Kurt, worked perfectly!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

Thanks for reporting back, Met.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

@Kurt Gold, if you don't mind me asking, how did you solve the localization issue?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

Mark,

 

in this case the solution works by applying the swatch [None] without explicitly using the Swatches palette to apply it. Instead one (or two) pathfinder commands make it [None].

 

This way [None] is being created for stroked and filled paths, but at the same time [None] is not being created as a hard-wired controller inside the action. The advantage is that the actions therefore should work in any international Illustrator version.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

Awesome! I new it would be a clever outside-the-square solution. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

I think this is an interesting problem, scripting wise. There are two steps. First, finding the maximum (or minimum) of the Bezier curve function of a segment. One may need to brush up their calculus. Two, since it's not possible to add a point to the middle of the segment, the whole segment will have to be redrawn with the added point. I'll think about it when I have the time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Appreciate your willingness to look into it. Your idea sounds interesting, and could very well be a great starting point. Wish I had the knowledge to help out in these cases, but I really just depend here on the generosity and time of those that can write script code. I hope you'll give this some thought and that you'll come up with something!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

What's the purpose of adding anchors? what do you do with it after it's added? just curious

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 09, 2022 Mar 09, 2022

Copy link to clipboard

Copied

Use Case Example: Snapping other objects exactly where the path ends. An anchor point in that exact place makes it much easier to accomplish this since Illustrator is notoriously bad at snapping things in their supposed place.

 

Other use cases include typical design stuff where you have to do path manipulation. I remember running into this need quite often, yet it would be pretty hard to describe the exact context.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

Hi @femkeblanco, I think we are both interested in similar challenges! 🙂

 

My maths is not good enough, but I have adapted a technique found on the Internet and created a method for my Bez object (remember that project to convert dashes for pixxxelschubser?) that adds anchorpoints at extreme points. However at the moment it adds points at extreme points of *every path segment*, so it's a bit over-the-top. I haven't had time to do it yet but next I am going to adjust it so that it has the options of top, left, bottom or right extreme points only (as OP wants), or just bounding box extreme points, or all extreme points. Or maybe I could add it at selected path segments—hmm, that'd be useful I think. Yeah I'll try and do that.

 

Anyway, I don't want to get in the way of your own project, but I hope you don't mind me working on this too. It is fun to do.

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

Hi @m1b I've been avoiding (or at least waiting for a better time) to manipulate Bezier curve functions, while at the same time recognising that it's interesting stuff. After all, Illustrator at its core is just a program that manipulates Bezier curve functions. Rather than the math per se, the issue is in implementing the math and the related logic in Javascript. Have a go, of course! (If you know how to find the exterma of segments, you are at an advantage; I'm not there yet.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines