So here is a solution for creating one wedge with an angle between 0 and 180 degrees. Not so sexy but a solution.
If anyone have something clever I’m open.
I’m still missing something : is there anyway to set, with JavaScript, « keep ratio » ?
cnvs = document.windows[0].selection.canvas
cnvs.graphics.forEach(function(graphic){graphic.remove()})
var angleFalse = 60//angle wanted in degrees from 0 to 180
var R = 75//circle radius
// ger half circle
g1 = cnvs.newShape()
g1.geometry =new Rect(0,0,2*R,2*R)
g1.shape="Circle"
g2 = cnvs.newShape()
g2.geometry =new Rect(0,R,2*R,2*R)
g2.shape="Rectangle"
var g3=cnvs.combine([g2,g1],ShapeCombination.Subtract)
//get new rectangle to intersect.
//made as the right side have middle point (R,R) ie center of hal circle
var angle = -angleFalse*3.14159/180//use negative in order to have it on the right + conversion from degrees
var ca=Math.cos(angle)
var sa=Math.sin(angle)
g2 = cnvs.newShape()
g2.shape="Rectangle"
g2.shapeVertices = [new Point(R+2*R*ca,R+2*R*sa),new Point(R-2*R*ca,R-2*R*sa),new Point(R-2*R*ca-2*R*sa,R-2*R*sa+2*R*ca),new Point(R+2*R*ca-2*R*sa,R+2*R*sa+2*R*ca)]
var wedge = cnvs.combine([g3,g2], ShapeCombination.Intersect)//Voilà