From 0007f1286c943b9d4817aa4ebbed818babf5ccfb Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Sun, 15 May 2022 11:47:44 -0400 Subject: [PATCH] bug fixes --- strings.scad | 14 ++++++++++++++ tutorials/Attachments.md | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/strings.scad b/strings.scad index b323364..3682779 100644 --- a/strings.scad +++ b/strings.scad @@ -332,6 +332,20 @@ function upcase(str) = str_join([for(char=str) let(code=ord(char)) code>=97 && code<=122 ? chr(code-32) : char]); +// Section: Random strings + +// Function: rand_str() +// Usage: +// str = rand_str(n, [charset], [seed]); +// Description: +// Produce a random string of length `n`. If you give a string `charset` then the +// characters of the random string are drawn from that list, weighted by the number +// of times each character appears in the list. If you do not give a character set +// then the string is generated with characters ranging from 0 to z (based on +// character code). +function rand_str(n, charset, seed) = + is_undef(charset)? str_join([for(c=rand_int(48,122,n,seed)) chr(c)]) + : str_join([for(i=rand_int(0,len(charset)-1,n,seed)) charset[i]]); diff --git a/tutorials/Attachments.md b/tutorials/Attachments.md index 9719c86..b42cd51 100644 --- a/tutorials/Attachments.md +++ b/tutorials/Attachments.md @@ -445,14 +445,14 @@ tag("keep")cube(100, center=true) ``` -If you need to mark multiple children with a tag, you can use the `tags()` module. +If you need to mark multiple children with a tag, you can use the `tag()` module. ```openscad-3D include diff("hole") cube(100, center=true) attach([FRONT,TOP], overlap=20) - tags("hole") { + tag("hole") { cylinder(h=20.1, d1=0, d2=95); down(10) cylinder(h=30, d=30); } @@ -475,14 +475,14 @@ Some notable non-attachable modules are `text()`, `linear_extrude()`, `rotate_ex `intersection()`, `offset()`, `hull()`, and `minkowski()`. To allow you to use tags-based operations with non-attachable shapes, you can wrap them with the -`force_tags()` module to specify their tags. For example: +`force_tag()` module to specify their tags. For example: ```openscad-3D include diff("hole") cuboid(50) attach(TOP) - force_tags("hole") + force_tag("hole") rotate_extrude() right(15) square(10,center=true);