Sliced voxel mesh producing bad linework

Data is internalized.
The attached script is my best attempt at generating perimeter line-work from voxel meshes. I realize the contour tool may be the better choice but with the various overlapping regions this solution was working well until I came across a few pieces of geometry.
Any guidance would be stellar.

The problematic geo does have a nonmanfold edge, but the resultant bogus line work is not located in in that exact location. Not sure if it is related?

Thank you

Slicer Forums.gh (42.8 KB)

Why use meshes?

And why the duplicate thread :question:

Apologies,you are correct I should have just appended this post to my other similar post. I will re-post to that thread.

Unfortunately a downstream process requires the geo to be mesh. Were you thinking the process would be better using nurbs and converting to mesh at the end? I would love to hear your thoughts in the other thread. Thanks again!