Copy link to clipboard
Copied
Java Script: How select all corner points in opened document?
this may do what you are after.
*****Do Not expect this to work on complex paths.*****
very tight tolerance set, this can be changed if smooth does not need to be too smooth.
...//------------------------------------------------------------------------------------
// Select "Sharp" or "Smooth" pathPoints
//------------------------------------------------------------------------------------
//
// Qwertyfly
// 06/07/2015
// Version 1.0
//
//--------------------------
Copy link to clipboard
Copied
Hi victorcarbajo‌,
hmmh?
1. Why and what exactly? (number of corner points or position or corner point kinds)
2. Your illustrator version?
3. A sample document?
4. Are there deep nested grouped groups in your document? Or nested compound paths? Or areas – defined in the appearance palette?
5. What is with hidden paths or clipping paths?
6. How many paths exists in your document?
But anyway – this will give you the number of Path points of the first path item in your document:
alert (app.activeDocument.pathItems[0].pathPoints.length)
Have fun
![]()
Copy link to clipboard
Copied
Example:

Result of script:

Copy link to clipboard
Copied
Why do you not answers to my questions?
Anyway, this will select the first path point of the first path item in your document:
app.activeDocument.pathItems[0].pathPoints[0].selected = PathPointSelection.ANCHORPOINT;
Have fun
![]()
Copy link to clipboard
Copied
Thanks, pixxxel schubser, for your answer. Excuse my delay.
My Illustrator version is 19.0.0.
There are not nested grouped groups in my document. There are not nested compound paths. Only simple paths with curve and corner points, but the document have a lot of paths. I need to modify corner points together, and then curve points together.
With best regards.
Copy link to clipboard
Copied
Thanx for your answer.
But again:
What do you want to do exactly with the selected corner points or selected curved points?
The background of this question is: a loop through all path items takes a long time – more path items, more longer! Additional you have to loop through all path points of every path item. The takes again more time! And that's why: What do you want to do exactly with the selected corner points or selected curved points?
![]()
Copy link to clipboard
Copied
I need to modify corner points together and curve points together for two reasons:
1. When I vectorizing my hand drawings I found a lot of mistake points. I selected the points by hand, but it take a lot of time.
2. I explore the possibilities of this two worlds (corner and curve points) when I freely draw in Illustrator.
With best regards.
Copy link to clipboard
Copied
So we will not get. We turn in circles. Imagine, I am 5 year old and you want to tell me what exactly you are doing.
Please define "mistake points".
Please give an example file (CS3 or at max CS5 compatible).
An automatic vectorization generates countless paths.
What criteria do you choose your path points (manually) from? What exactly do you do with the path points after selection???
Copy link to clipboard
Copied
Dear pixxxel schubser,
I uploaded a Illustrator CS3 file with "mistake points". Link: mistake_points.ai - Box
In this file most points have abnormal behavior. I could correct this abnormal behavior if I could select them and modify with, for example, InkScribe plug-in. Now I make this operation manually.
With best regards.
PS: Excuse my English, I am Spanish and maybe I do not understand me well.
Copy link to clipboard
Copied
this may do what you are after.
*****Do Not expect this to work on complex paths.*****
very tight tolerance set, this can be changed if smooth does not need to be too smooth.
//------------------------------------------------------------------------------------
// Select "Sharp" or "Smooth" pathPoints
//------------------------------------------------------------------------------------
//
// Qwertyfly
// 06/07/2015
// Version 1.0
//
//------------------------------------------------------------------------------------
//
// *****Do Not expect this to work on complex paths.*****
//
//------------------------------------------------------------------------------------
//
// Set tolerance here (this is in Radians)
var tolerance = 0.0000000001;
//
//------------------------------------------------------------------------------------
var doc = app.activeDocument;
var myPoint, angle1, angle2, sel = "";
var w = new Window('dialog');
var B1 = w.add('button',undefined,"Select Corner Anchors");
var B2 = w.add('button',undefined,"Select Smooth Anchors");
var B3 = w.add('button',undefined,"Cancel");
B1.onClick = function(){sel = "sharp"; goTime();}
B2.onClick = function(){sel = "smooth"; goTime();}
B3.onClick = function(){w.close()}
w.show()
function goTime(){
w.close();
doc.selection = null;
for(var i = 0; i < doc.pathItems.length; i++){
for(var j = 0; j < doc.pathItems.pathPoints.length; j++){
myPoint = doc.pathItems.pathPoints
; if(sel == "smooth"){
if(isSmooth()){
myPoint.selected = PathPointSelection.ANCHORPOINT;
}
}else if(sel == "sharp"){
if(!isSmooth()){
myPoint.selected = PathPointSelection.ANCHORPOINT;
}
}else{alert("error");}
}
}
}
function isSmooth(){
angle1 = Math.atan2(myPoint.leftDirection[1] - myPoint.anchor[1],myPoint.leftDirection[0] - myPoint.anchor[0]);
angle2 = Math.atan2(myPoint.rightDirection[1] - myPoint.anchor[1],myPoint.rightDirection[0] - myPoint.anchor[0]);
return(Math.abs((angle1 - angle2)) > Math.PI - tolerance && Math.abs((angle1 - angle2)) < Math.PI + tolerance);
}
Copy link to clipboard
Copied
for your .ai I needed to drop the tolerance to "0.01"
then it worked
Copy link to clipboard
Copied
Fantastic! Works!
Thanks for your brain, Qwertyfly..., it is a awesome script.
With best wishes.
Copy link to clipboard
Copied
‌glad I could help!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now