Applying Rounded Corners to specific Anchor Points
Hey y'all,
I'm working on a script to round specific corners of my artwork based on their angle and type (inside or outside corners). For example, I want all inside corners to be rounded to 0.01", and outside corners to be rounded to 0.02". I've tried various methods, such as creating two vectors, rounding the corners separately, and then merging them, but this isn't ideal for all use cases.
Here is the code I've been using to identify which corners need the live effect applied, but I'm having trouble applying the effect to individual points:

function checkCorners() {
var corners = [];
var doc = app.activeDocument;
var sel = doc.selection;
if (sel.length > 0 && sel[0].typename === "PathItem") {
var path = sel[0].pathPoints;
for (var i = 0; i < path.length; i++) {
var point = path[i];
var nextPoint = path[(i + 1) % path.length];
var prevPoint = path[(i - 1 + path.length) % path.length];
var vec1 = {
x: point.anchor[0] - prevPoint.anchor[0],
y: point.anchor[1] - prevPoint.anchor[1]
};
var vec2 = {
x: nextPoint.anchor[0] - point.anchor[0],
y: nextPoint.anchor[1] - point.anchor[1]
};
var angle = Math.atan2(vec2.y, vec2.x) - Math.atan2(vec1.y, vec1.x);
angle = angle * (180 / Math.PI);
if (angle < 0) {
angle += 360;
}
var cornerType = (angle > 180) ? "Inside Corner" : "Outside Corner";
corners.push("Point " + i + ": " + cornerType + " (" + angle.toFixed(2) + " degrees)");
}
} else {
alert("Please select a single path item.");
}
alert(corners.join("\n"));
}
checkCorners();

With the results above, I would like to run the following code to apply the effect to the specific corners:
function roundCorners(radius) {
var doc = app.activeDocument
var sel = doc.selection;
xmlstring2 = '<LiveEffect name="Adobe Round Corners"><Dict data="R radius ' + (radius * 72) + '"/></LiveEffect>';
for (var j = 0; j < sel.length; j++) {
sel[j].applyEffect(xmlstring2);
}
}Despite my efforts, I haven't been able to apply the effect from point to point, which brings me here...
Any thoughts, ideas, or alternate methods y'all can think of that might point me in the right direction?
Thanks!
