I need an NSPointArray

I am working with NSBezierPaths. Many of its methods require an NSPointArray as one of the parameters. The documentation describes it as “A C-style array containing up to three NSPoint data types.” The documentation is sparse. Evidently I have been unable to create an NSPointArray because all my attempts to use one cause both Script Debugger and Script Editor to crash. For example, the following code results in a crash due to the setAssociatedPoints: method.

[AppleScript]set theImage to NSImage’s alloc’s initWithSize:{500, 500}
theImage’s lockFocus()
set thePath to NSBezierPath’s bezierPath()
thePath’s moveToPoint:{0, 0}
thePath’s lineToPoint:{50, 50}
set thePoint to current application’s NSMakePoint(50, 125)
set theArray to current application’s NSArray’s alloc’s initWithArray:{thePoint}
thePath’s setAssociatedPoints:theArray atIndex:1
thePath’s stroke()
theImage’s unlockFocus()

I have tried a number of variations to create theArray, including using a mutable array. I have also tried using NSValue to place the point in the array, but the code still caused Script Debugger to crash.

set theImage to NSImage's alloc's initWithSize:{500, 500}
	theImage's lockFocus()
	set thePath to NSBezierPath's bezierPath()
	thePath's moveToPoint:{0, 0}
	thePath's lineToPoint:{50, 50}
	set thePoint to current application's NSMakePoint(50, 125)
	set theArray to current application's NSMutableArray's alloc's init()
	theArray's addObject:(current application's NSValue's valueWithPoint:thePoint)
	thePath's setAssociatedPoints:theArray atIndex:1
	thePath's stroke()
	theImage's unlockFocus()[/AppleScript]

I would appreciate any assistance.

It can’t be done — ASObjC doesn’t support pointers like NSPointArray.

Shane - thank you for another quick response. I was wondering if you were going to tell me that NSPointArrays are not supported.

I have learned an enormous amount from your Book and the many clear examples you have posted. You have my gratitude.