Graphic Line Anchors...


the script below github (graphic lines · fabiantheblind/auto-typo-adbe-id wiki · github) creates path shown below...

 

the anchor location each point matches position of point before it.

 

i want create path made of straight lines , have been trying, unsuccessfully, either remove anchors or make anchor positions match position of point they're drawn from.

 

does have suggestions?

 

thanks help.

 

gline.png

var data = {

   "pw":100,

   "ph":100,

   "anchors":[

  [  0,50],

  [ 10,60],

  [ 20,40],

  [ 30,60],

  [ 40,40],

  [ 50,60],

  [ 60,40],

  [ 70,60],

  [ 80,40],

  [ 90,60],

  [100,50]

  ]

  };

 

   // need doc

   // use pw , ph data

   var doc = app.documents.add({

  documentpreferences:{

  pageheight:data.ph,

  pagewidth:data.pw

  }

  });

 

   // page there

   var page = doc.pages.item(0);

 

   // create graphicline

 

   var gl = page.graphiclines.add();

 

   // loop thru data.anchors

   for(var in data.anchors){

   var point = gl.paths[0].pathpoints[i];

   /**

  * graphicline has 2 pathpoints

  * need add points third

  * anchor data object

  */

 

   if(i < 2){

  point.anchor = data.anchors[i];

  }else{

  point = gl.paths[0].pathpoints.add();

  point.anchor =  data.anchors[i];

  }

 

   if((i != data.anchors.length - 1)&& i!=0)

 

  point.rightdirection = data.anchors[i-1];

  point.leftdirection = data.anchors[i];

  }

thanks help.

gline.png

hi,

 

i remove line:

 if((i != data.anchors.length - 1)&& i!=0) 

 

and modify line:

 point.rightdirection = data.anchors[i]; 

 

jarek



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!