The OpenScad Useful Library

The OpenScad Useful Library

thingiverse

The OpenScad Useful Library This file offers a set of functions for vector, string, and number operations. Author: Nathanael Jourdane Email: nathanael@jourdane.net Date: December 30, 2015 License: Creative Commons CC-BY (Attribution) thingiverse: http://www.thingiverse.com/thing:1237203 Requires OpenScad 2015.03 or above. Implementing recursive functions is a pleasure for me. If you require a generic function not found in OpenScad, or if you find an error in these ones, feel free to inquire. Another string library: http://www.thingiverse.com/thing:526023 Instructions Copy-paste the function(s) you need from TOUL.scad into your .scad file; OR: Place TOUL.scad in your local OpenSCAD folder under /libraries. On Windows, this folder should default to Documents/OpenSCAD/libraries. Then import TOUL.scad with the following line of code: include "TOUL.scad" [new_vector] new_vector(length, [value]): Returns a vector with length elements initialized to the value. Arguments [int] length: The length of the vector. [char] value (optional): The initial value of the vector. [splittt] split(string, [separator]): Returns a list of substrings by splitting the input string at each occurrence of the separator. Arguments [str] string: The original string. [char] separator (optional): The separator to split the string by (space by default). [stvv] str2vec(string): Returns a list of characters representing the input string. Arguments [str] string: The input string. [subsstt] substr(string, [start], [length]): Returns a substring from the original string. Arguments [str] string: The original string. [int] start (optional): The starting position of the substring (0 by default). [int] length (optional): The length of the substring (default is string length). [filll] fillstr(substring, number): Returns a string where the input substring is repeated the specified number of times. Arguments [str] substring: The substring to repeat. [int] number: The number of times to repeat the substring. [numberss] dec2bin(number, [length]): Converts an integer into its binary representation and returns it as a list of booleans. Arguments [int] number: The input number. [int] length (optional): The desired length of the output vector. [nnmmbrss] atoi(string, [base]): Returns the numeric value represented by the input string. Arguments [str] string: The string to convert. [int] base (optional): The base conversion (2 for binary, 10 for decimal, and 16 for hexadecimal). Usage Examples [new_vvecrtt] new_vector(3) // creates a vector [0,0,0] [spllt] split("Hello world", " ") // ["Hello", "world"] [stvveecccrrtt] str2vec("foo") // ["f","o","o"] [subsst] substr("Hello world", 7) // "world" [fflslttrrtreeesstrrng] fillstr("hey", 3) // "heyyeyy"

Download Model from thingiverse

With this file you will be able to print The OpenScad Useful Library with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on The OpenScad Useful Library.