Join multiple closed polygons in one line


Hello,

I am looking for a way to optimize my machining time (engraving on wood). Do you think it is possible to join the closed polygons in one line? It seems complicated to find such an algorithm but some of you may know this case? 

Do you have any ideas to start with ?

Thank you

Pierre