/ src / turtle / footprints2.scad
footprints2.scad
 1  
 2  /**
 3  * footprints2.scad
 4  *
 5  * @copyright Justin Lin, 2020
 6  * @license https://opensource.org/licenses/lgpl-3.0.html
 7  *
 8  * @see https://openhome.cc/eGossip/OpenSCAD/lib3x-footprints2.html
 9  *
10  **/ 
11  
12  use <turtle2d.scad>
13  
14  function footprints2(cmds, start = [0, 0]) = 
15      let(leng = len(cmds))
16      [start, each [
17          for(i = 0, t = turtle2d(cmds[i][0], turtle2d("create", start.x, start.y, 0), cmds[i][1]); 
18              i < leng;
19              i = i + 1,
20              t = turtle2d(cmds[i][0], t, cmds[i][1]))
21          if(cmds[i][0] == "forward") turtle2d("pt", t)
22      ]];