// mathgrrl maker maker /////////////////////////////////////////////////////////////////// // CUSTOMIZER DISPLAY SETTINGS // preview[view:south, tilt:top] /////////////////////////////////////////////////////////////////// // SIZE PARAMETERS /* [Size Settings] */ // Some overall dimension A = 100; // Another overall dimension B = 30; /////////////////////////////////////////////////////////////////// // STYLE PARAMETERS /* [Style Settings] */ // controls scaling of elements in random subsequence1 // number from 0 (min allowable) to 10 (max allowable) style1 = 6; // controls likelihood of true/false in random subsequence2 // number from 0 (always false) to 10 (always true) style2 = 7; /////////////////////////////////////////////////////////////////// // RANDOM SEED /* [Choose Random Seed] */ // USE THIS ONE WITH OPENSCAD // comment this out if using Customizer // OpenSCAD chooses a random seed random_seed = floor(rands(1,9999999,1)[0]); // USE THIS ONE WITH CUSTOMIZER // comment this out if using OpenSCAD // Click anywhere in the slider to choose a seed //random_seed = 8675309; // [1:1:9999999] // OR TYPE IN A SEED MANUALLY // works both in OpenSCAD and Customizer // Overrides the slider seed unless set to 0 custom_seed = 0; // set the random snowflake seed seed = (custom_seed==0) ? random_seed : custom_seed; // Show random seed? (it won't print even if you say yes) show_seed = "yes"; //[yes:Yes,no:No] // Create a string to output the random seed // thank you laird for showing me how to do this with your code // from http://www.thingiverse.com/thing:188481 labelString=str(floor(seed/1000000)%10, floor(seed/100000)%10, floor(seed/10000)%10, floor(seed/1000)%10, floor(seed/100)%10, floor(seed/10)%10, floor(seed/1)%10); // Display the random seed in the render if(show_seed=="yes"){ translate([0,-30,0]) color("gray") %linear_extrude(height=1) text(labelString,size=4,halign="center"); } // Output the random seed in the log echo(labelString); /////////////////////////////////////////////////////////////////// // RANDOM SEQUENCES // construct the main random sequence // a list of random real numbers in [0,10] based on the chosen seed maxSteps=30*1; random = rands(0,10,maxSteps,seed); echo(random); // subsequence of 10 items from the main sequence // weighted by style1 subrandom1 = [for(i=[0:10-1]) random[i]*style1]; echo(subrandom1); // subsequence of another 10 items from the main sequence // output as true/false verdicts by comparison to style2 subrandom2 = [for(i=[10:10+10-1]) random[i]<=style2]; echo(subrandom2); /////////////////////////////////////////////////////////////////// // RENDERS // example: flat base based on overall size parameters cube([A,B,10],center=true); // example: cubes // heights based on subrandom1, visibility based on subrandom2 color("white") for (i=[0:10-1]){ if (subrandom2[i]==true){ translate([(i-5)*(A/12)+A/24,0,5+subrandom1[i]/2]) cube([5,5,subrandom1[i]],center=true); } } /////////////////////////////////////////////////////////////////// // MODULES // put shapes here