Cleaning mesh skeleton

Hello! I am working with this script: (9.4 KB)

If I connect it with a random mesh, the result can be like that:

I kind of like the result, but I am not completely happy. My questions would be:

  1. How is it possible to avoid single non-closed strings (highlighted in red)?
  2. Not so important: But is there a way to reduce such ugly transitions (highlighted in green)?

Would be very thankful if someone could take a look at my script! Have a good day, stay safe! :slight_smile:

Continuation of this discussion