Show messages:
1-20
21-40
41-42
From: Martin (MARTIN3D)
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 );
}
}
From: Michael Gibson
You're welcome Martin, I'm glad that worked!
Also another new thing related to polyline handling in the new beta - for the Rebuild command there's a new "Endpoints" mode which builds a new smooth curve that goes through the endpoints of the current curve's segments rather than sampling points at percentages along the curve's length. This can be useful for building a smooth curve through imported polylines like you sometimes get with PDF or DXF imports. It's basically the same as doing a "Through points" curve snapping each point onto polyline segment endpoints, but doing it all in one go.
- Michael
Show messages:
1-20
21-40
41-42