Getting all points of a curve using a script
 1-19  20-39  40-42

Previous
Next
 From:  MajorGrubert (CARLOSFERREIRAPINTO)
6257.40 
Hi BurrMan,

Its working now, before i was saving as .3dm file and not as a .txt (never heard about this scripts before you mention).

Thanks for help and taking the time to make the video. Fantastic.

This is an amazing community!

Cheers

Carlos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 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 );
	}
}
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
6257.42 In reply to 6257.41 
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
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages:  1-19  20-39  40-42