Skip to main content
Inspiring
June 3, 2023
Answered

replicate a sheet of lined paper

  • June 3, 2023
  • 4 replies
  • 642 views

How can I go about making a part of my project that requires a series of (82) lines with identical space inbetween and same start and end points.

[Looks very much like a sheet of lined paper]

 

Wanting some programatic actions instead of struggling along with copy/paste and getting the same spacing

How to guarantee spacing will be accurate and not just cobbled to gether by hand.

This topic has been closed for replies.
Correct answer femkeblanco

Draw and select the first line.  Enter the number of lines and spacing (in points) separated by a comma (e.g. 82, 10).

var inputs = prompt("", "#, spacing (pt)").split(",");
var first = app.selection[0];
for (var i = 1; i < Number(inputs[0]); i++) {
    var next = first.duplicate();
    next.top = first.top - i * Number(inputs[1]);
}

4 replies

Ton Frederiks
Community Expert
Community Expert
June 3, 2023

Although the script from femkeblanco works very well, just enter the number of lines and distance divided by a comma, the suggestion made by Monika, use the Transform Effect, is very easy, editable, and can be saved as an Object Style for one click reuse.

Inspiring
June 3, 2023

There is an esasy way without programing....
Make two lines - the top and the bottom. Choose the  BLEND TOOL. Click on one end of the upper line, hold down ALT and then the corepsponding anchor point on the lower line. No choose how many steps you want (you get a small menue with diffrent ways to blend). Since you have the upper and lower - that makes 80 steps. Now you have 82 lines with exact spacing. And if you want 83, you just cklick agin and change the numbers of steps. 

femkeblanco
femkeblancoCorrect answer
Legend
June 3, 2023

Draw and select the first line.  Enter the number of lines and spacing (in points) separated by a comma (e.g. 82, 10).

var inputs = prompt("", "#, spacing (pt)").split(",");
var first = app.selection[0];
for (var i = 1; i < Number(inputs[0]); i++) {
    var next = first.duplicate();
    next.top = first.top - i * Number(inputs[1]);
}
Inspiring
June 3, 2023
quote

Draw and select the first line.  Enter the number of lines and spacing (in points) separated by a comma (e.g. 82, 10).

 

var inputs = prompt("", "#, spacing (pt)").split(",");
var first = app.selection[0];
for (var i = 1; i < Number(inputs[0]); i++) {
    var next = first.duplicate();
    next.top = first.top - i * Number(inputs[1]);
}

Above . . By @femkeblanco

 

Sorry to be so dim-witted . . .

Not sure what I am expected to do.

Just type out the program? entering correct numbers?

How to run the program?

Do I need to enter a special mode in AI to create and enter the scripting?

 

femkeblanco
Legend
June 3, 2023

Before running the script, draw and select the first (topmost) line.

 

To run a script, copy and paste the code into a jsx file and save.  (You can create a txt file and change the extension to jsx.)  Then, while your document is open in Illustrator, go to File > Scripts > Other Script (Ctrl+F12), find your script and open it.  This will run the script.  For more on running scripts, see here.

 

When running the script, a prompt window will appear.  In the input field, enter the number of lines and spacing between lines (in points) separated by a comma (e.g. 82, 10). 

Monika Gause
Community Expert
Community Expert
June 3, 2023

You could try either the transform effect (Effect > Distort & transform > Transforn, requires just one line as a starting point, then make a graphc style to apply over and over)  or a blend (requires 2 start objects).