Copy link to clipboard
Copied
I have a composition with hundreds of different sized rectangles I'd like to convert to perfect circles of the same relative size as the original rectangular shapes. The 'convert to ellipse' command doesn't quite get me there as the results are not perfect circles, rather they are ovals.
Any advice is much appreciated.
Happy New Year!
Copy link to clipboard
Copied
1. apply Convert to Shape...Ellipse Effect, this example has 0 Extra Width/Height, Relative.
2. make 1 copy and rotate it 90 degrees, using the Transform Effect
Copy link to clipboard
Copied
You may want to see if this is what you want? It's only for the first path item… The relative size is area (approx).
#target illustrator function main() { if (app.documents.length == 0) { alert('Open a document before running this script'); return; } else { var docRef = app.activeDocument; with (docRef) { if (pathItems.length == 0) { alert('No Path Items'); return; } else { var pVB = pathItems[0].visibleBounds; var pVC = (pVB[2]+pVB[0])/2; var pHC = (pVB[1]+pVB[3])/2; var rad = Math.sqrt(pathItems[0].area/Math.PI); pathItems.ellipse(pHC+rad,pVC-rad,rad*2,rad*2,false,true); redraw(); } } } } main();