SplitCurves In Order
Need a little help.I need to use splitcurves to break lines, polylines, and arcs but I need the breaks to occur in order from start of line to end of line. The routine I have now randomly breaks them creating segments longer than they should be.It's hard for me to explain but hopefully the attached picture will help.Any idea how I can break my polyline segments in order from start to end at my point locations?
Entity myent = (Entity)myid.GetObject(OpenMode.ForWrite);
Curve curve = myent as Curve;
Point3dCollection newpointcoll = new Point3dCollection();
foreach (Point3d mypnt in breakpoints)
{
Point3d nearpoint = curve.GetClosestPointTo(mypnt, false);
if (nearpoint.DistanceTo(mypnt)
{
newpointcoll.Add(nearpoint);
}
}
newCurves = curve.GetSplitCurves(newpointcoll); Nevermind. I think I have my head wrapped around it now.Nothing like a good vr break.I should be able to get the parameters of the points, sort then in order, then get the point locations again based on those parameters.Wish me luck That did the trick
List lst = new List();
DoubleCollection paramcollection = new DoubleCollection();
foreach (Point3d pnt in newpointcoll)
lst.Add(curve.GetParameterAtPoint(pnt));
lst.Sort();
foreach (double param in lst)
paramcollection.Add(param);
newCurves = curve.GetSplitCurves(paramcollection); good to see the thought process and the resulting code !
页:
[1]