I am creating an exact parabola using AppleScript:
tell application id “OGfl”
tell canvas of front window
activate
set lstPoints to {{-200, -200}, {0, 200}, {0, 200}, {200, -200}}
make new line with properties {bezier point list:lstPoints, line type:bezier, draws shadow:false}
end tell
end tell
All I get is a straight line. Javascript OmniJS works perfectly for me
var canvas = document.windows[0].selection.canvas;
var g1 = canvas.newLine();
g1.lineType = LineType.Bezier;
g1.bezierPoints = [new Point(-200, -200), new Point(0, 200), new Point(200, -200), new Point(0, 200)];
g1.shadowColor = null;
I am wondering why AppleScript is not working for the parabola or Bezier curves in general. Any help is greatly appreciated.
The points need to be in multiples of 3, and there need to be at least 6 points.
To be confident of the API incantations, probably safest to experiment with:
first drawing something similar by hand,
and then using Edit > Copy As AppleScript to see what kind of code it returns.
A simple sample of a Bezier snippet generated this way:
tell application "OmniGraffle"
tell canvas of front window
make new shape at end of graphics with properties {name:"Bezier", fill:no fill, draws shadow:false, point list:{{108, -29}, {149.5, -135}, {283.5, -205.5}, {283.5, -205.5}, {283.5, -205.5}, {371.5, 100.5}, {371.5, 100.5}, {371.5, 100.5}, {66.5, 77}}, stroke color:{0.0, 0.0, 0.0}, fill color:{0.794417, 0.794436, 0.794426}}
end tell
end tell
Thanks for the reply @draft8. The problem is with Bezier curves, not Bezier shapes. I have recreated the problem using gif. I’d appreciate any input. Thanks!!
You can try emailing support, but I think the bottom line is that the API work has now shifted to the Automation JSContext, and it may be better to do your scripting there, if possible.
It’s a general problem of bezier lines drawn by scripts. When using a script the control points are placed along the straight lines in direction of the neighboring points of the lines. It also happens with bezier lines with more segments. This is clearly a bug.