Hi martina, here's a script to get you started, it will basically get a selected shape, get it's dimensions and position, create a circle from scratch and place it on top of your selection, then it will remove your selection. Use it with care, it doesn't have any error handling and it will need a lot more work to make it deal with archs...but it works fine with those "circle" polygons.
select one or more objects before running the script. Also, if you have a "circle" that is not one piece, but it is broken down into multiple separate line items, grouped them together and the script will turn the group into one circle.
// selectionToCircles.jsx
// carlos canto 8/25/18
// https://forums.adobe.com/thread/2527376
// script will turn selected items into circles
// if you don't get the results you want, UNDO is your friend
function main() {
var idoc = app.activeDocument;
var selec = idoc.selection;
var sel, d, r, pos, blackColor;
for (var a=0; a<selec.length; a++) {
sel = selec;
d = sel.width;
r = d/2;
pos = [sel.position[0]+sel.width/2-r, sel.position[1]-sel.height/2+r];
// create color
blackColor = getThisColor([0, 0, 0, 100]);
drawCircle(sel, sel.parent, r, pos, blackColor);
}
app.executeMenuCommand('clear');
}
main();
function drawCircle(sel, container, r, pos, color) {
var icircle = container.pathItems.ellipse(pos[1], pos[0], r*2, r*2);
icircle.filled = false;
//icircle.fillColor = color;
icircle.stroked = true;
icircle.strokeWidth = sel.strokeWidth || sel.pageItems[0].strokeWidth;
icircle.strokeColor = color;
}
// create new cmyk color
function getThisColor (c /* array [46, 4, 1, 0] */) {
var newColor = new CMYKColor();
newColor.cyan = c[0];
newColor.magenta = c[1];
newColor.yellow = c[2];
newColor.black = c[3];
return newColor;
}