Adding first point of next list to previous list


I have a bellow list consisting of a points which are filtered based on bounding box. the issue is the points which are on the edge of bounding box corner is omitted from the list which resulting in arc not upto that point (see bellow image) i want to create a list in such a way that first point and last point in the list should be the same. Means the same point should be there as last point of first list and first point of next list.

Thanks for support

Do they still need to be separate arcs? You could just flatten the list and create one continuous arc.

If you do need to keep them separate you’ll probably need to use LastItem and AddItemToEnd to move your points around. You’ll also likely need to do a little cleanup as you’re not looping the last arc back to the first.


Just an FYI, as it seems like you might be building a workflow that won’t resolve itself in the end, which could mean you’re going down the wrong path here…

Curves created with Arc.ByBestFitThoughPoints do not necessarily touch the points which generate them.


@Nick_Boyts thanks for the reply and suggestion, Yes the arc needs to be separate. I have taken part from suggestion and part improvised as bellow and it worked fine. Still i am not able to get the last arc any suggestion for that ?

@JacobSmall Thanks for this valuable info.

Just to clarify: Continuing the discussion from Fit the curves in geometry …polyline to geometry line:

I have devided the lines in to say 20 parts and each part is filtered with bounding box to collect the existing points inside the box. and tried to fit an arc for that portion through points.
Issue was that one point at the edge of bounding box was only considered once and thus resulting in gaps in the arc so need to add points again to the previous list just to get a continues arc.

This is what i was doing manually at the time of creating that alignment and trying to replicate the same in code now.

I know there are still hurdles in the approach but lets take one step at a time by dividing the problem. Once best fit arcs are done then the big issue will be the connection at end and tangency between the arcs, also what if points are more or less in straight line …hope to find a solution for that too.

Perhaps instead of bounding box containment, you could use a geometry.doesintersect, or a geometry.intersect?

1 Like

Jacob’s suggestion of a geometry intersection would work by enlarging the geometry just a tiny bit to ensure overlap of the edge points.

As I said earlier, with a little cleanup you should also be able to get it to work with just shifting the last index to the next list.

1 Like