Extract Exoskeleton guide lines of a tree

Hello everyone.
I have some Tree 3D Meshes and I Want to Extract the very Simplified Lines from them which be like Exoskeleton guide Lines for the Trees, Like the Image Below:

I wrote an algorithm for this purpose and it works, But if anyone knows a better way to do that or can help me improve my code, I appreciate it. I want the Lines to have the highest accuracy possible and Decrease or even better Delete the “Tolerance” inputs of my code and make all the computations automatic with least inputs.
I attached The gh file of the algorithm Below:

Mesh To Line.gh (268.3 KB)