Skip to main content
blakeferm
Participating Frequently
January 4, 2019
Answered

Automated way to draw lines from multiple dots in AI

  • January 4, 2019
  • 2 replies
  • 2105 views

Hello AI friends! I'm curious if there's a way to make a custom style or SVG filter that would allow you to draw lines(bezier curves) from multiple dots. If I had several dots in a line, how could I apply a style/SVG filter to those dots that would draw lines from them. I'd love to hear any ideas you guys might have.


I've attached an image of what I'm going for.

Best,
Blake

This topic has been closed for replies.
Correct answer pixxxelschubser

You can see from my AI file how I'd love the lines to work from the right hand side example. You can also see some of the brush styles I've begun to test with.

Thanks so much!


Try

// required some filled circles - all selected

// regards pixxxel schubser

var aDoc = app.activeDocument;

var aSel = aDoc.selection;

var len = 100;

var line = null;

for (i=0; i<=aSel.length-1; i++)

{

    var pI = new Array (2);

    pI[0] = aSel.left + aSel.width/2;

    pI[1] = aSel.top - aSel.height/2;

   

    line = aDoc.pathItems.add();

    line.setEntirePath ( new Array( new Array ( pI[0], pI[1] ), new Array( pI[0]+len, pI[1]+len )));

    line.pathPoints[1].rightDirection = new Array( pI[0]+len, pI[1]+len);

    line.pathPoints[1].anchor = new Array( pI[0]+len*1.2, pI[1]+len*0.8);

    line.rotate(5*i, true, true, true, true, Transformation.BOTTOMLEFT);

    line.filled = false;

    line.stroked = true;

    line.strokeWidth = 1;

    line.strokeColor = aDoc.swatches[1].color;

}

This snippet draws a line (Bezier curve) from the middle of each circle using setEntirePath function.

Before:

After:

If that works for you

have fun

2 replies

pixxxelschubser
Community Expert
Community Expert
January 4, 2019

blakeferm​,

do your lines follow a certain rule? Which one is it? (start point is the center of a circle - but where is the end point)

blakeferm
blakefermAuthor
Participating Frequently
January 4, 2019

Hi Pixxxel! Thank you so much for the reply. The lines would maintain their stoke width and can arc/curve outwards from the dot on a two point line. Start point of the line would be the dot and end point could be further away. The end point isn't too specific but it would be cool if it had distance to create a nice long line coming out from the dot.

I've been experimenting with custom brush styles that could be applied to a series of dots, but I'm having some issues getting the lines to simply arc away from the start point of the dot.

Best,
Blake

blakeferm
blakefermAuthor
Participating Frequently
January 14, 2019

Hi blakeferm​,

do you need further assistance? Or is your problem solved?


Hi Pixxxel,

We can mark this as resolved. Thank you so much for all of your help.

Best,
Blake

Ann Bens
Community Expert
Community Expert
January 4, 2019