Round corner radius from JS script?
Dear AI community
I'm struggling with automating a batch job which involves rounding all corners (including sharp ones, low angle) in a PathItem.
I need to replicate from the script what you can do manually by selecting all anchor points and either dragging the round corner handler or just setting the corner radius under object Properties pane -> Corners field.
I spent a reasonable amount of time digging AI scripting guide and seems can't find anything related to rounding PathItem.pathPoints elements. Can't find any equivalent API to setting the corner radius via UI Properties->Corners field.
Also another issue is the corner radius handle & property will only show when the corner angle is bigger than certain threshold. Not sure why. Other vetcor editors I tried e.g. Inkscape or Affinity Designer don't have this limitation, you can round literraly any corner and it works rather well. Is there any way to force round corner regadless of angle? Changing the geometry slightly just to get over the corner angle threshold to get access to the radius property is not going to work for me. This is an automated batch job with a lot of geometry to process.
Any advice please?
What I tried so far:
Tried the built in Round Corner filter you can apply to any object via effects property. Unfortunatelly it is far not the same as rounding corners directly via anchor Radius property in editor quality wise. The Round Corners filter will mess up corners where the sides are not stright lines but curved beziers. Changing radius property for the same corner directly in editor doesn't do that and works as expected.
I've managet to google up this rather advanced Round Corners AI script by WELZ-gh. It is a serious amount of code but unfortunately it doesn't quite work correctly. Multiple similar corners will get different inconsitent amount of rounding and also the rounding itself for many corners looks way too sharp.
https://gist.github.com/WELZ-gh/fcbf311cf504a001577d8d424336e592
