
module translated_cylinder ( size_vector, idx = 0 ) Strings Integer from Numeric String (Decimal or Hex)Ĭonverts number in string format to an integer, (s2d - String 2 Decimal - named before I added hex to it.)Į.g. sizes =, ,, , ] // One option to solve this is by using a recursive module // that will create a new translated coordinate system before // going into the next level. All cylinders are to be stacked above each other (with // an additional spacing of 1 unit).

Define the sizes for the cylinders, first value is the // radius, the second is the height.
#Openscad box code
function add ( v, i = 0, r = 0 ) = i < len ( v ) ? add ( v, i + 1, r + v ) : r input = output = add ( input ) echo ( output ) // ECHO: 40 //- add2 - // An even simpler non recursive code version of add explores the // the matrix product operator function add2 ( v ) = * v echo ( add2 ( input )) // ECHO: 40 // add2 works also with lists of vectors input2 =, , ] echo ( add2 ( input2 )) // ECHO: echo ( add ( input2 )) // ECHO: undef // Why? //- add3 - // With a little more code, the function add may be used also // to add any homogeneous list structure of floats function add3 ( v, i = 0, r ) = i < len ( v ) ? i = 0 ? add3 ( v, 1, v ) : add3 ( v, i + 1, r + v ) : r input3 =, 1 ], , 2 ], , 3 ] ] input4 =, 1 ], , 2 ], , 3 ] ] echo ( add3 ( input3 )) // ECHO:, 6] echo ( add2 ( input3 )) // ECHO: undef // input3 is not a list of vectors echo ( add3 ( input4 )) // ECHO: undef // input4 is not a homogeneous list Count values in a list matching a condition

Create a simple recursive function that adds the values of a list of floats // the simple tail recursive structure makes it possible to // internally handle the calculation as loop, preventing a // stack overflow.
