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 B: This is what I'm looking to create. All the bright pink bars are single lines with a stroke and end cap "arrowheads"
Sure, here is the English version.
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!
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
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.
Copy link to clipboard
Copied
Try again, it should work.
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.
K
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;
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
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{}
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
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:
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.
K
Copy link to clipboard
Copied
Glad to hear it worked 🙂
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.
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
Copy link to clipboard
Copied
Works fine, Kurt, but the arrowheads seem language dependend, Pfeil 27 is not recognized in an English version.
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.
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.
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.
Copy link to clipboard
Copied
Sure, here is the English version.
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
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? 🙂
Copy link to clipboard
Copied
LOL, arrowheads are better than AIRHEADS
K
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!
Copy link to clipboard
Copied
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!