Copy link to clipboard
Copied
Hi,
I want to move each one of selected paths to anchor points
From this
To this
It is possible via script?
This old script duplicates one selection to all anchors, I need something similar
Bonjour,
/*Duplicates each element of the group placed in the foreground
to center them on selected points within paths or isolated points.
Duplicates each element of the group placed in the foreground on each of the selected points*/
// JavaScript Document /* Duplique chaque élément du groupe placé au premier plan pour les centrer sur les points sélectionnés appartenant à des tracés ou des points isolés.*/ function main(){ var doc = activeDocument; var s = selection; if (s.length < 2) re...
Copy link to clipboard
Copied
It should be possible. Are the crosses in the middle of the banners points or paths? Can you show the fully expanded layers panel?
Copy link to clipboard
Copied
Hello!
The crosses are paths
Copy link to clipboard
Copied
If you draw single points as markers for object positions, the script is easier to write.
Another script variant is to draw a path with anchor points, place it at the bottom or at the top of the selection, and place the other objects along the points of this key path.
Copy link to clipboard
Copied
Another unclear thing is whether the OP really means to move "paths" and not textframe characters.
Copy link to clipboard
Copied
Hi, the path is outlined text, not textframe characters.
Thank you!
Copy link to clipboard
Copied
Bonjour,
/*Duplicates each element of the group placed in the foreground
to center them on selected points within paths or isolated points.
Duplicates each element of the group placed in the foreground on each of the selected points*/
// JavaScript Document /* Duplique chaque élément du groupe placé au premier plan pour les centrer sur les points sélectionnés appartenant à des tracés ou des points isolés.*/ function main(){ var doc = activeDocument; var s = selection; if (s.length < 2) return; var gr = s[0]; // Groupe premier plan if (gr.typename != "GroupItem") return; var nbObj = gr.pageItems.length, paths = []; extractPathes(s.slice(1), paths, 0); var pts, tgt_point, vb; for(var i = 0, k = 0; i < paths.length; i++){ pts = paths[i].pathPoints; for(var j = 0; j < pts.length; j++) { if(isSelected(pts[j])) { if (nbObj == k) break; tgt_item = gr.pageItems[k]; vb = tgt_item.visibleBounds; tgt_point = [(vb[0]+vb[2])/2,(vb[1]+vb[3])/2]; tgt_item.duplicate(paths[i],ElementPlacement.PLACEBEFORE).translate( pts[j].anchor[0]-tgt_point[0], pts[j].anchor[1]-tgt_point[1]); k++; } } } } // ------- function isSelected(pt){return pt.selected == PathPointSelection.ANCHORPOINT;} // ------- function extractPathes(s,tabs,deb){ for (var i = 0; i < s.length; i++){ if(s[i].typename == "PathItem" && !s[i].guides && !s[i].clipping && i >= deb){ tabs.push(s[i]); } else if(s[i].typename == "GroupItem" && i >= deb){ // Cherche les objets pageItems dans ce groupe, récursivement extractPathes(s[i].pageItems,tabs,0); } else if(s[i].typename == "CompoundPathItem" && i >= deb){ // Cherche les objets de type PathItem dans ce tracé transparent, récursivement extractPathes(s[i].pathItems,tabs,0); } } } // ------- if (app.documents.length > 0) main();
René
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I'm happy to take the credit, but it was @renél80416020's script.