Copy link to clipboard
Copied
Hello, can anyone help me with this Illustrator task?
I would like to scale this entire set of drawings, using two points WITHIN the group.
The two points I would like to use are highlights in RED and the final dimension I would like is 150mm wide as this is a scale of 1:10. When I make this change, I would like the rest of the drawing to proportionally scale up too.
I know I can draw a box in 150mm behind it, and manually resize the group and use the box behind as a guide, and it will be a roughly correct result, however I am looking for a faster and more accurate workflow as I have many to do.
Copy link to clipboard
Copied
Hotdoors CAD Tools has a bunch of advanced resizing tools and dynamic rulers/ labels.
Mylenium
Copy link to clipboard
Copied
assuming the whole diagram is Grouped, select or draw 1 horizontal line (inside the group), select it and run the script below.
Enter the desire size incuding units and the Parent group of the selected item will be resized.
Before
After
// https://community.adobe.com/t5/illustrator/scaling-between-two-points-within-a-group-of-objects/td-p/10769540
// resize Group by selecting 1 horizontal item (directly within the group)
// carlos canto 11/30/19
function main() {
var idoc = app.activeDocument;
var sel = idoc.selection;
if (sel.length == 1) {
var newWidth = Window.prompt ('Enter Selected item new Width', "ie. 150 mm or 1.5 in or 300 pt", 'Resize Group by Selecting 1 item inside it');
var myUV = new UnitValue(newWidth);
if (myUV.type == "?") {
alert("Unknown unit type entered. Enter a valid measurement unit and try again");
return;
}
resizeObject (sel[0], myUV.as ('pt'));
function resizeObject (obj, newWidth) {
var idoc = app.activeDocument;
var parentGroup = obj.parent;
var currentWidth = obj.width;
var perCent = newWidth/currentWidth*100;
var scaleMatrix = app.getScaleMatrix(perCent, perCent);
parentGroup.transform (scaleMatrix, true, true, true, true, perCent/100, Transformation.CENTER); // scale strokes
}
}
else {
alert('select 1 Horizontal item (within a group) and try again');
}
}
main();
Copy link to clipboard
Copied
Hi Carlos,
Thank you very much! It is very kind of you to take the time to help.
I have zero experience scripting. I have created a copy of an Illustrator 2019 sample script, and replaced with your code. Would you mind reviewing where I am going wrong?
Warm regards,
Anna
Copy link to clipboard
Copied
Hi annarees, delete line 17, that should take care of the problem.
Copy link to clipboard
Copied
Hi Carlos,
You are my hero. Thank you! It works perfectly now!
Best wishes,
Anna
Copy link to clipboard
Copied
my pleasure 🙂
Copy link to clipboard
Copied
what are those, IKEA manuals?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
thanks, it does look nice.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more