I'd rather think differently and try to make a powercopy instead of a macro, however you can write a script to create such polygons I think it's not worth it.
There are two variables I'd use:
1.number of angles (edges of the polygon) and
2.radius of the circle (size of the polygon)
Then I would make an axis system where you'd like to place your sketch. After I'd made a line using the origin of the axis system as starting point its length would be equal to radius of the circle (e.g.: 15mm) then I'd made another line using circular pattern the angles between two of them would be 360°/number of angles.
Now you have two lines. In the next step I'd create two points on these lines (point on curve) using the origin again as reference point. Then I'd create another line (point to point) using these two points (By this you have one edge of the polygons).
Then I'd made another circular pattern to make all edges of the polygon.
In the final step I'd joined them in GSD module, and now only you need to do is the project this joined element onto your sketch.
By this you're able to modify the number of the edges and its size via two "external" parameter.
I hope this would help.