Getting all points of a curve using a script

 From:  Martin (MARTIN3D)
6257.41 In reply to 6257.5 
Hi Michael,
quote:

I've added in something for the next beta so that the start and end of curve _segments_ can also be retrieved. Right now they can only be gotten for the full curve, not for individual segments. Once this is in place then you would be able to get the segments by doing var segs = crv.getSubObjects(); , then each segment will respond to getStartPt() and getEndPt() in the next beta.


I tested that with todays beta, two selected polylines and the code below. It works fine. Thanks a lot for adding this!

code:
script:
var curves = moi.geometryDatabase.getSelectedObjects().getCurves();
for ( var i = 0; i < curves.length; i++ ) {
	var segments = curves.item(i).getSubObjects();
	for ( var j = 0; j < segments.length; j++ ) {
		var segment = segments.item(j);
		moi.ui.alert( "Curve " + i + "\n" + 
		"Segment " + j + " start: " + segment.getStartPt().x + ", " + segment.getStartPt().y + "\n" +
		"Segment " + j + " end: " + segment.getEndPt().x + ", " + segment.getEndPt().y );
	}
}