Copy link to clipboard
Copied
I am working on a project with topographic lines. Each line has varying space between them but they all increase by a height of 20mm (after I'm done they're vertically aligned to the bottom of the artboard). The lines on the left are an example of the ones that have been completed. Is there a way I adjust the length of all the lines at once with a constant increase in length?
Thanks!
wyatts,
Can you reverse the order of how you build the lines?
As far as I can see you create short lines and distribute them at varying distances, and then you wish to increase their lengths linearly.
If you can create them at different lengths and then place them at varying distances, it is much easier because you can start by create lines at linearly increasing lengths with a simple Blend, expand the Blend, and then distribute the lines as desired.
Hi @wyatts93859812,
do you mean something like that?
The main "problem" is the basic structure of the script. Ultimately, only two loops are required:
// https://community.adobe.com/t5/illustrator/adjust-varying-lengths-of-line-at-once/td-p/11099361?page=1
// resize_increase_height_based_on_xPosition.jsx
// regard pixxxelschubser 03. März 2020
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
Copy link to clipboard
Copied
If they are not grouped you could try Object > Transform > Transform Each and scale them vertical with Scale Strokes & Effects unchecked
Copy link to clipboard
Copied
I tried your idea. I don't think it works since it scales them all the same.
Copy link to clipboard
Copied
They scale with a percentage of their original size, so maybe I misunderstood
Do I understand correctly that you want to add a fixed size to different size lines?
Copy link to clipboard
Copied
My bad. The length of the line would go like 20mm for the first, 40mm for the second, 60mm for the third, and so forth until it reaches the last line.
Copy link to clipboard
Copied
Maybe someone can write a script to do that.
Copy link to clipboard
Copied
wyatts,
Can you reverse the order of how you build the lines?
As far as I can see you create short lines and distribute them at varying distances, and then you wish to increase their lengths linearly.
If you can create them at different lengths and then place them at varying distances, it is much easier because you can start by create lines at linearly increasing lengths with a simple Blend, expand the Blend, and then distribute the lines as desired.
Copy link to clipboard
Copied
This does work, thank you!
Copy link to clipboard
Copied
it could be scripted, I'm not sure what the requirement is.
Copy link to clipboard
Copied
Hi @wyatts93859812,
do you mean something like that?
The main "problem" is the basic structure of the script. Ultimately, only two loops are required:
// https://community.adobe.com/t5/illustrator/adjust-varying-lengths-of-line-at-once/td-p/11099361?page=1
// resize_increase_height_based_on_xPosition.jsx
// regard pixxxelschubser 03. März 2020
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// required: opened document, only lines with the same height on the active layer //
// all paths are ungrouped and simple paths (lines) //
// no selection needed //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
main();
app.redraw();
alert("Done");
function main() {
var aDoc = app.activeDocument;
var Pths = aDoc.activeLayer.pathItems;
var len = Pths.length;
var list = new Array ();
var toMM = 2.83464567;
var Pth, item, factor, inc;
inc = prompt ("Please enter the value of increment (mm)", 2, "Increment");
if (inc == null) { return; }
if (inc.match(/[0-9]+/) == null) { return;}
inc = inc*1;
for (i = 0; i < len; i++) {
Pth = new Array (2);
Pth[0] = Pths[i].left;
Pth[1] = Pths[i];
list.push(Pth);
}
list.sort();
for (k = len-1; k >= 0 ; k--) {
item = list[k][1];
factor = (item.height +inc*toMM*k)*100/item.height;
list[k][1].resize( 100, factor, true, true, true, true, 100, Transformation.CENTER );
}
};
Before:
During:
Result:
If that works for you
have fun
😉
Copy link to clipboard
Copied
Thank you, this will save me to much time!
Copy link to clipboard
Copied
For my part you are welcome, Wyatt.
Scripts are almost always easier (for the lucky one that can use it without having to create it).
We are very lucky to have scripter friends, such as Hans-Jürgen and Carlos.