algorithmic modeling for Rhino
Here is a solution
angle must be close to Math.PI (3.14159) for your purpose Math.Pi - angle tolerance (1° in radian)
private void RunScript(Polyline c, double angle, ref object A, ref object B)
{
//Breaks polyline at kinks
Polyline[] crs = c.BreakAtAngles(angle);
//Take all the first points of polyline
List<Point3d> pts = new List<Point3d> ();
foreach (Polyline pl in crs)
{
pts.Add(pl.First);
}
//Add the last point
pts.Add(crs[crs.Count() - 1].Last);
//Create the new polyline
A = new Polyline(pts);
}
try Polyline.ReduceSegments(tolerance);
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_...
Thanks Andrew,
before answering I read RhinoCommon help and I though this command will merge points close from each other. I didn't test it ! Bad idea. It is answering exactely the question of Platut.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by