Copy link to clipboard
Copied
Sorry to ask but is there a way to automatically select an Anchor Point? It will always be the Lowest point (and because there will be multiple on that Y-axis) I want the Left most point.
Thank you!
Hello, check this out.
Make sure your art item is wholly selected in the document first - that's how it knows to affect only the points in a group or compound path that is desired among all which could be present in the document at any time.
The underlying assumption is that you may have a line of points at the bottom and at the top - whereby the tolerance is a buffer area which would include the range of points along which some of the x axis would be included - because you will have situations wh
...Copy link to clipboard
Copied
Hello, check this out.
Make sure your art item is wholly selected in the document first - that's how it knows to affect only the points in a group or compound path that is desired among all which could be present in the document at any time.
The underlying assumption is that you may have a line of points at the bottom and at the top - whereby the tolerance is a buffer area which would include the range of points along which some of the x axis would be included - because you will have situations where the bottom most point isn't a leftmost point, etc.
#target illustrator
function test(){
var tolerance = 10;
var doc = app.activeDocument;
var selectedItem = doc.selection[0];
var bottomMost, thisPoint, thisPathItem;
var allContainedPoints = [];
for (var i = 0; i < doc.pathItems.length; i++) {
thisPathItem = doc.pathItems;
if(!thisPathItem.selected){
continue;
}
for (var j = 0; j < doc.pathItems.pathPoints.length; j++) {
thisPoint = doc.pathItems.pathPoints
; allContainedPoints.push(thisPoint);
}
}
allContainedPoints.sort(function(a,b){
return a.anchor[1] < b.anchor[1];
});
for (var i = 0; i < allContainedPoints.length; i++) {
thisPoint = allContainedPoints;
if(i == 0){
bottomMost = thisPoint.anchor[1];
} else {
if(thisPoint.anchor[1] < bottomMost){
bottomMost = thisPoint.anchor[1];
}
}
}
doc.selection = null;
var bottomMostItems = [];
for (var i = 0; i < allContainedPoints.length; i++) {
thisPoint = allContainedPoints;
// $.writeln(thisPoint.anchor[1] + " : " + bottomMost);
if(thisPoint.anchor[1] + tolerance >= bottomMost && thisPoint.anchor[1] - tolerance <= bottomMost){
bottomMostItems.push(thisPoint);
}
}
bottomMostItems.sort(function(a,b){
return a.anchor[0] > b.anchor[0];
});
bottomMostItems[0].selected = PathPointSelection.ANCHORPOINT;
};
test();
Copy link to clipboard
Copied
I want to divide the text quickly by the space character.
Enthusiastic friends, I have a problem, can you help me write this? Thank you very much.