Copy link to clipboard
Copied
In Illustrator Stroke and Fill can be applied to a Group itself in the Appearance Panel.
They then will visualy overright the Strokes of all objects inside this group.
I wonder if it is possible to check / change the strokeWidth of such a group by script as the scripting reference seams not have any specific attributes for this case.
check attached file (rename as .ai) to play around...
Anyone any idea / solution in mind?
Thanks
Nils
select your group before running
activeDocument.defaultStrokeWidth = 6
Hi Nils, yes! select your group and check the default stroke
var strokeSize = activeDocument.defaultStrokeWidth;
damn! this one was too easy! 😂
but it makes perfect sense (i will never get used to these default stroke functions.... and i still don't understand why they don't just give us a direct control function for group properties 🤷🏼:male_sign:)...
thank you soo much for helping me out!
So here's my final Script:
var docRef = app.activeDocument;
var minStrokeWidth = 4;
for (var p=0; p<docRef.pageItems.length; p++) {
docRef.selection = null;
var myPI = docRef.pageItems[p];
if (myPI.con
...
Copy link to clipboard
Copied
Please post only Scripting solutions!
Copy link to clipboard
Copied
select your group before running
activeDocument.defaultStrokeWidth = 6
Copy link to clipboard
Copied
wait, maybe I misunderstood, your sample file doesn't give any clues as what you need, please provide before and after if I did.
Copy link to clipboard
Copied
Hi CarlosCanto,
selecting the groups worked out well so far (see script below)
Big question now is:
Is it possible to check the strokeWidth of such a group before changing (getting the value before setting a new one)?
example file setting are the following:
- the sample file includes 2 similar groups, each containing 2 rectangles
- all rectangles do not have any stroke
- but a 3pt stroke was added for the whole group (both groups)
Here's my Script so far:
var docRef = app.activeDocument;
var pIs = docRef.pageItems;
for (var p=0; p<pIs.length; p++) {
docRef.selection = null;
if (pIs[p].constructor.name == "GroupItem") {
pIs[p].selected = true;
activeDocument.defaultStrokeWidth = 6;
}
}
Copy link to clipboard
Copied
Hi Nils, yes! select your group and check the default stroke
var strokeSize = activeDocument.defaultStrokeWidth;
Copy link to clipboard
Copied
damn! this one was too easy! 😂
but it makes perfect sense (i will never get used to these default stroke functions.... and i still don't understand why they don't just give us a direct control function for group properties 🤷🏼:male_sign:)...
thank you soo much for helping me out!
So here's my final Script:
var docRef = app.activeDocument;
var minStrokeWidth = 4;
for (var p=0; p<docRef.pageItems.length; p++) {
docRef.selection = null;
var myPI = docRef.pageItems[p];
if (myPI.constructor.name == "GroupItem") {
myPI.selected = true;
var myStrokeWidth = activeDocument.defaultStrokeWidth;
if (myStrokeWidth < minStrokeWidth) {
activeDocument.defaultStrokeWidth = minStrokeWidth;
}
docRef.selection = null;
}
}
Copy link to clipboard
Copied
or make a copy, select the copy and Expand Appearance, one of the paths should have the stroke size you need