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

Convert multiple rectangle shapes to paths/lines for chart

Community Beginner ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

I have a very, very large bar chart that was sent to me as a PDF to design. One thing I need to do is convert the rectangular bars (in pink) into lines with an end cap. Is this possible to do to multiple rectangles at once? I have literally hundreds of bars to do this to, so manually deleting anchor points on each one is NOT an option.

 

The first example, which has all bars as rectangular shapes, needs to be converted into something like the second example, which has the pink bars as lines with endcap "arrowheads":Example A: all bars are rectangular shapes (including the bright pink ones)Example A: all bars are rectangular shapes (including the bright pink ones)Example B: This is what I'm looking to create. All the bright pink bars are single lines with a stroke and end cap "arrowheads"Example B: This is what I'm looking to create. All the bright pink bars are single lines with a stroke and end cap "arrowheads"

TOPICS
Draw and design , Feature request

Views

1.7K

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 2 Correct answers

Community Expert , Jan 26, 2020 Jan 26, 2020

Sure, here is the English version.

https://adobe.ly/3aIQz1B

Votes

Translate

Translate
Community Beginner , May 02, 2024 May 02, 2024

Thank you! im currently going ham with multiple scripts, hoping i can find one that keeps the rotation of the original object in mind so i can replace the brush circles with a finished symbol and they all rotated inwards!:O Thank you Ton!

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

You could use a script to swap the rectangles for a stroke (and while still selected adjust the stroke to the same size):

http://illustrator.hilfdirselbst.ch/dokuwiki/en/skripte/javascript/zamena_size

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 Beginner ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

Thanks! I gave it a try, but so far as I can tell, it only converts the rectangle into an outlined rectangle. What I really need is to somehow delete 2 of the 4 anchor points on each rectangle first. to turn each one into a straight line. Seems like it should be such a simple task, but so far every solution I've found recquires that to be done manually on each object.

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 ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

Try again, it should work.

replace rectangles.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
Enthusiast ,
Jan 25, 2020 Jan 25, 2020

Copy link to clipboard

Copied

Ton, that script was a good find.

I gave it a test run.

Worked like a charm.

I can see that would be most useful turning Fills into Strokes.

 

KScreen zamena script test.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 ,
Jan 25, 2020 Jan 25, 2020

Copy link to clipboard

Copied

Yes, it is a useful script.

I found a variation where it also keeps the colors of the original objects (I forgot who made this edit in one of the old forum posts).

After the line:

newItem.evenodd=currItem.evenodd;

Add this line:

newItem.fillColor=currItem.fillColor;

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
Enthusiast ,
Jan 25, 2020 Jan 25, 2020

Copy link to clipboard

Copied

Well that sounded interesting!

 

Tired as I may to modify, I could not get it to work.

I’m not a script writer.

I have modified scripts long ago successfully.

 

I tried 5 times. Even restarted the computer.

 

Ton, Would you be so kind and just upload your .js modified file that now includes colors?

 

Thanks K

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 ,
Jan 25, 2020 Jan 25, 2020

Copy link to clipboard

Copied

Sure, here it is:

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array){
goal=mySelection[0];
centerPoint=goal.position[0]+(goal.width/2);
centerPointVert=goal.position[1]-(goal.height/2);
for (i=1; i<mySelection.length; i++){
currItem=mySelection[i];
centerPoint=currItem.position[0]+(currItem.width/2);
centerPointVert=currItem.position[1]-(currItem.height/2);
ratio=100/(goal.width/currItem.width);
ratioV=100/(goal.height/currItem.height);
newItem=goal.duplicate();
newItem.position=Array((centerPoint-(goal.width/2)),(centerPointVert+(goal.height/2)));
if(ratio<ratioV){
newItem.resize(ratio,ratio,true,true,true,true,ratio)
}else{
newItem.resize(ratioV,ratioV,true,true,true,true,ratioV)
}
newItem.artworkKnockout=currItem.artworkKnockout;
newItem.clipping=currItem.clipping;
newItem.isIsolated=currItem.isIsolated;
newItem.evenodd=currItem.evenodd;
newItem.fillColor=currItem.fillColor;
if(currItem.polarity){
newItem.polarity=currItem.polarity
}
newItem.moveBefore(currItem);
currItem.remove()
}
}
}else{}

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
Enthusiast ,
Jan 25, 2020 Jan 25, 2020

Copy link to clipboard

Copied

Oh Ton,  I am so exhausted and very frustrated.

Tried and tried to modify the script.

No problems in the past with very little modifications up until today.

 

Maybe it’s the OLD software???

I opened the old script zamena-size.js to modify.

My computer defaults to Adobe ExtendScript Toolkit CS5.

I do not see an Adobe update with CC.

 

I’m not a script writer nor a java person, therefore, I have not purchased any dedicated software to do so.

 

K

Screen_ExtendScript.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 ,
Jan 25, 2020 Jan 25, 2020

Copy link to clipboard

Copied

It should work with old and new software. Important is that the script is copied to a text only document, no formatting, no rtf.

But if you can't get it to work, here is the script download location:

https://adobe.ly/2uumpyq

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
Enthusiast ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Ton, Thank you for your help yesterday.

I was going nutso.

Actually I was doing everything correctly.

I used that same example as before to test ZamenaSizeColor.

At a quick glance, it appeared there was no color change.

Upon a closer look, the script added a color fill to that stroke.

 

All is well.

Thank you again.

 

KScreen Script examples.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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Glad to hear it worked 🙂

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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Just to suggest another possible route: You can also do it with an action that will work in many situations (see sample .aia file below).

 

https://drive.google.com/open?id=1zUk_ZTFnKEJmMgduplASbdFzrWbPE3XX

 

Instruction:

 

- Unzip the zipped .aia file and import it into the Actions palette.

 

- Select an unlimited number of filled, ungrouped and unrotated rectangles.

 

- Play back the action.

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
Enthusiast ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Hi Kurt,

 

I’ll give that a try.

 

Decades ago, I wrote many Actions using Photoshop, then much less writing Actions using Illustrator,  . . . InDesign, well never look into if have. 

 

K

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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Works fine, Kurt, but the arrowheads seem language dependend, Pfeil 27 is not recognized in an 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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

That's a bit astonishing, Ton, as usually the corresponding parameter keys inside an action shouldn't be language-dependent.

 

However, if it doesn't work properly, the last two action steps would just have to be re-recorded in an English version of Illustrator to get it to work.

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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Thats what I did, rerecord to check it, but it is ineed strange that the arrows are language dependend, and it does not give an error message.

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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Would you mind sharing the re-recorded action?

 

I'd like to take a look at both versions and compare the keys.

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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Sure, here is the English version.

https://adobe.ly/3aIQz1B

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
Enthusiast ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Oh Kurt and Ton, you guys so SMART!!!!

 

Your (English version) Action is a winner.  

Fills>Strokes.

 

Thank you.

 

K

Screen Action fills>Strokes.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 ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

Thank you, Ton. The re-recorded steps are not recognised in a German version of Illustrator, so I'd call it a (minor) bug or an imperfect implementation.

 

So be it, who needs arrowheads at all? 🙂

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
Enthusiast ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

LOL, arrowheads are better than AIRHEADS

 

K

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 Beginner ,
Jan 26, 2020 Jan 26, 2020

Copy link to clipboard

Copied

I wasn't able to get the script to work, but this action did the job perfectly! THANK YOU so much. And thanks to all who chimed in to help problem solve. This quick fix has the potential to save me hours and hours of tedious work. Yay!

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 Beginner ,
May 02, 2024 May 02, 2024

Copy link to clipboard

Copied

LATEST

Thank you! im currently going ham with multiple scripts, hoping i can find one that keeps the rotation of the original object in mind so i can replace the brush circles with a finished symbol and they all rotated inwards!:O Thank you Ton!

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