5

I have an illustrator file (actually it's a map) which has lines, polygons and some patterns. I would like to scale the stroke width of all lines (also lines inside patterns) by 80% without altering the patterns or the size of the objects.

When using the Scale tool I must chose one of "transform objects" and "transform patterns" but I don't want to scale any of those, only Strokes.

I could first scale everything by 80%. Then I could scale it by 133.333333% and leave out "strokes & effects". The problem is that lines in patterns stay the same.

When I toggle "transform patterns" the size of the patterns changes including the stroke widths, but I only want the stroke widths to be altered.

So does anyone know how to solve this?

I do not want to have to select individual objects since there are thousands of them.

1

2 Answers 2

1
+50

You can try this: Open your text editor (the best is ExtendScript Toolkit, installed with Illustrator by default), then past in new document the text below.

//here you can change the stroke percentual
var myA = prompt("Choose your %","80","Change width stroke");
var myPercentile = myA/100;

if(myA!=null){

    // choose all page elements
    for (var i=0;i<app.activeDocument.pageItems.length;i++){
        var myLayer = app.activeDocument.pageItems[i];

        //if element is compound make a new loop for pathItems
        if(myLayer.typename=="CompoundPathItem"){
            for(var u=0;u<myLayer.pathItems.length;u++){

                //take actual stroke size
                var myPath = myLayer.pathItems[u];
                var myMeasure = myPath.strokeWidth;

                //transform the stroke width into % choose at start
                myPath.strokeWidth = myMeasure*myPercentile;
                }

            }

        if(myLayer.typename=="PathItem"){
                var myMeasure = myLayer.strokeWidth;
                myLayer.strokeWidth = myMeasure*myPercentile;
            }
        }
    }

Save the doc wherever you want with .jsx extension. Back in Illustrator and open the file to change, in File menu, choose Script > another script... and choose the file .jsx

Hope it works for you

6
  • 1
    +1 Nice, that's a really useful script! One slight problem for the original question though: it doesn't apply to strokes within patterns, and it doesn't work from within the pattern editor, so to use it with patterns they'd have to use it on the original tiles the pattern was created from, then re-create the patterns. Still very useful. Oct 8, 2013 at 11:44
  • 1
    Just noticed the asker said the file was created outside of illustrator: assuming the patterns are interpreted by Illustrator as normal pattern swatches, (in CS6) for each pattern they could double-click the swatch, select all, copy, exit pattern editor, paste, run script on this pasted tile (replace-all pageItems for selection in the script and it will apply only to selected items), then copy the adjusted tile back into the pattern editor to update the pattern. Oct 8, 2013 at 11:52
  • Hi, I don’t understand the new Illustrator pattern, so I can’t test the script on it. maybe if I have a pattern example I can adjuste this script. Thanks
    – steguozzo
    Oct 8, 2013 at 13:29
  • To comment so the asker gets notified, comment on the question (or, if they're involved in a comments discussion, with @theirUsername like above) Oct 11, 2013 at 8:48
  • Hello @OskarKarlin, have you tried this? Please give a feedback. Thanks
    – steguozzo
    Oct 11, 2013 at 12:31
0
  • Select one object with a stroke.

  • Choose Select > Same > Stroke Weight

  • Enter the value for the stroke you want.

  • Choose Object > Hide

  • Repeat until all objects are hidden.

  • Choose Object > Show All

There is no built in way to independently scale strokes of different weights which I'm aware of.

4
  • Sorry but there are too many different objects with different strokes so that would take forever I'm afraid. Also, when selecting same stroke weight i will not get the strokes in patterns, right?
    – oskarlin
    Sep 27, 2013 at 16:05
  • Nothing selects strokes within patterns, except the pattern editor. Sorry you feel this won't work. There's no other method I'm aware of.
    – Scott
    Sep 27, 2013 at 16:06
  • If you had the foresight to use Graphic Styles or Symbols, you could easily update the Graphic Styles and/or Symbols, that would alter all associated objects.
    – Scott
    Sep 27, 2013 at 17:22
  • The problem is that it's not Illustrator which creates the files. It's the mapping software OCAD...
    – oskarlin
    Sep 30, 2013 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.