The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   questions on point list in AppleScript (http://forums.omnigroup.com/showthread.php?t=16793)

roosterboy 2010-07-18 04:32 PM

questions on point list in AppleScript
 
In the point list for a bezier object copied from OG to AppleScript, I think every three points in the list describes a point on the path and its two control points. Is this correct?

Which one is the actual destination point of the draw operation?

What does it mean if two of the points have the same x and y values?

What does it mean if all three points have the same x and y values?

Probably outside the scope of this forum, but I'll ask anyway:
Does anyone know an easy way to take a point list from AppleScript and turn it into a series of messages to an NSBezierPath object in Cocoa to draw the same shape in an NSView? I can get everything [i]almost[/i] working, but not quite. The lower curve on my shape (see below) comes out wrong.

Here's the shape I'm working with:
[code]tell application "OmniGraffle Professional 5"
tell layer "Layer 2" of canvas of front window
make new shape at end of graphics with properties {fill color:{1.0, 1.0, 1.0}, ¬
draws shadow:false, stroke color:{0.0, 0.0, 0.0}, thickness:4, ¬
point list:{{215.0094, 121.1161}, {194.3519, 121.1161}, {177.6077, 111.5196}, ¬
{177.6077, 77.55308}, {177.6077, 77.55308}, {166.9595, 77.55308}, ¬
{166.9595, 77.55308}, {166.9595, 77.55308}, {166.9595, 49.36419}, ¬
{166.9595, 49.36419}, {166.9595, 49.36419}, {170.855, 45.52066}, ¬
{170.855, 45.52066}, {170.855, 45.52066}, {183.4891, 44.45979}, ¬
{183.4891, 44.45979}, {187.1026, 35.175}, {192.1896, 27.59161}, ¬
{198.2134, 22.60616}, {198.2134, 22.60616}, {199.2312, 13.48825}, ¬
{199.2312, 13.48825}, {199.2312, 13.48825}, {203.3185, 9.644714}, ¬
{203.3185, 9.644714}, {203.3185, 9.644714}, {226.6957, 9.644714}, ¬
{226.6957, 9.644714}, {226.6957, 9.644714}, {230.7852, 13.48825}, ¬
{230.7852, 13.48825}, {230.7852, 13.48825}, {231.8031, 22.60616}, ¬
{231.8031, 22.60616}, {237.8224, 27.59161}, {242.9117, 35.175}, ¬
{246.5272, 44.45979}, {246.5272, 44.45979}, {259.1614, 45.52066}, ¬
{259.1614, 45.52066}, {259.1614, 45.52066}, {263.0568, 49.36419}, ¬
{263.0568, 49.36419}, {263.0568, 49.36419}, {263.0568, 77.55308}, ¬
{263.0568, 77.55308}, {263.0568, 77.55308}, {252.4066, 77.55308}, ¬
{252.4066, 77.55308}, {252.4066, 111.5196}, {235.6602, 121.1161}, ¬
{215.0094, 121.1161}, {215.0094, 121.1161}, {215.0094, 121.1161}}, ¬
name:"Bezier", stroke cap:butt, stroke join:miter}
end tell
end tell
[/code]

And here are pictures of how it looks in OG and how it looks drawn in Cocoa:
[img]http://csha.roosterville.net/code/shape-correct-omnigraffle.png[/img]
[img]http://csha.roosterville.net/code/shape-incorrect-nsbezierpath.png[/img]


All times are GMT -8. The time now is 07:32 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.