Copy link to clipboard
Copied
There are single points in the drawings from Autocad. Is there a script to select only these single points?
Thank you!
Not tested. Save before trying.
var paths = app.activeDocument.pathItems;
for (var i = paths.length - 1; i > - 1; i--) {
if (paths[i].pathPoints.length <= 2) {
var ps = paths[i].pathPoints;
if (ps[0].anchor.toString() == ps[1].anchor.toString() &&
ps[0].rightDirection.toString() == ps[1].rightDirection.toString() &&
ps[0].leftDirection.toString() == ps[1].leftDirection.toString()) {
paths[i].remove();
}
}
}
Copy link to clipboard
Copied
THis is even built into Illustrator. You could check out Select > Object > Single anchor points.
Or use the Object > Path > Clean up function.
Copy link to clipboard
Copied
Thank but "Object > Path > Clean up function" I tried but it didn't work. I couldn't find "Select > Object > Single anchor points". Is there a different method?
Copy link to clipboard
Copied
I don't think they are single points; especially the one on the right since Illustrator will not display a stroke on a single point like that. Try drag one with the direct select tool and see what happens. There may be two connected points on top of each other, so in essence a line segment (which makes sense for Autocad). In which case the Clean Up tool will not find them.
Copy link to clipboard
Copied
I checked, single point.
Copy link to clipboard
Copied
How did you check? In the Document info panel?
Copy link to clipboard
Copied
Not tested. Save before trying.
var paths = app.activeDocument.pathItems;
for (var i = paths.length - 1; i > - 1; i--) {
if (paths[i].pathPoints.length <= 2) {
var ps = paths[i].pathPoints;
if (ps[0].anchor.toString() == ps[1].anchor.toString() &&
ps[0].rightDirection.toString() == ps[1].rightDirection.toString() &&
ps[0].leftDirection.toString() == ps[1].leftDirection.toString()) {
paths[i].remove();
}
}
}
Copy link to clipboard
Copied
This script perfect working cleared all single points. Thank You...