I tried your few lines of code and it works perfectly for curves. However if any item in the list to be extended to the boundary is a polyline, the script gives an error when I try also to extend both ends to the boundary.
It says polyline doesn’t have the attribue ‘To’ and in the polyline class of the rhino library, I couldn’t find a way to extract it’s endpoints.
Another way I tried is to explode the all lines, if the length of the list is greater than one, meaning its a polyline, then get the first index and the last index of the exploded list of lines. However, an error msg shows ‘Guid’ object has no attribute ‘ToNurbCurves’.
Do you know anyway I can extend the two ends of the polyline to a boundary that contain it?
extendCurve trial.3dm (22.7 KB) extendCurve trial.gh (11.7 KB)