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.
Answer
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
Attribution
Source : Link , Question Author : oskarlin , Answer Author : steguozzo