Contour List Issue, FDM Toolpath


I am writing a pretty basic script for creating stepped contours as a polyline to eventually run on a kuka robot with an extruder head. Put simply my script does this: contours > splits contours into segments > creates “ramps” > merges ramps and segments. Both lists for the ramps and contours seem to order points normally but when I merge the two at the very top the line traces back on itself. I would like for the final ramp to just terminate into the final contour.

Any thoughts?

Stepped (11.7 KB)
Test File.3dm (312.5 KB)

Stepped (11.7 KB)

You might want to eliminate that top “ramp” that extends above the contoured brep? And FYI, the Move ‘Geometry’ input has 171 values but the ‘Motion’ input has only 168 values.

First, thank you. I hope wherever you are you get some good sailing weather in.

I think it’s at 168 values because i converted to segments between points. The ‘motion’ value will always be the # of points in the ramps short of the geometry.

I guess I understand why the match tree function works because it changes {55,1} to {56,0}
But I’m not entirely sure why it was {55,1} to begin with.

How would you suggest I get rid of the last ramp?
I tried to flip data and split list to eliminate the top three vertices, but this flattens the list.

I don’t know either but I didn’t look too hard.

Eliminate the last two points in the list:

Stepped (14.4 KB)