OpenSCAD Project: Desk Accessory

Initial Design Idea

  • We plan to create a Super Mario themed desk accessory that has a customizable nameplate and pencil holder where one could change the format and design of the actual product. There will three different objects on the nameplate with the tube from Mario being one of them (to hold the pencils, pens, rulers, etc.) then a pencil or pen holder on the other side. In the middle there will be a decorative pixel Mario from the original game.
  • In all honesty, when it comes to coding, there is not a great deal of knowledge from either of us, but we do want to learn about more complex coding on OpenSCAD. We do have some knowledge about the Mario games as well.
  • We will have to get more familiar with the code provided to us by the professor considering it is well past our knowledge of coding, but we are confident we will accomplish the task. The randomized code seems tough for now, but as we tinker with it over time and change the numbers to see how exactly it works, it should be easy from there.

Design Iteration

  • The model above is the first draft of our model. The left part of the desk accessory is random and the blue block will change every-time we press F5.
  • The following code below is for the slope where we will insert our name. There is no function for the triangle therefore we have to create by using the module. After creating the prism with code, we have to translate the prism to the end of the rectangle therefore both of them were together. As the rectangle has the length of 100 of width of 38, the following picture shows why our translate is -19 and -50. (The purple block is in the center)

  • The code below is to create the bowl in the middle, where we can put our pen and pencils. We can change the width, the height of the bowl.

  • The code below is for the right side of the accessory. We can slightly change the height and the location of those block.

First Draft Print

  • We printed our desk accessory relatively small and it printed successfully. We still need to add the name and the cartoon character on our desk accessory.
  • I think it will be better to increase the height of the bowl in the middle. The slope where to put our name where relatively good enough.
  • The model still need to have some additional iterations and we will find out more in our final print.

Thingiverse Customizer



// Some overall dimension

A = 100;

// Another overall dimension

B = 38;

///////////////////////////////////////////////////////////////////

// STYLE PARAMETERS

/* [Style Settings] */

// controls scaling of elements in random subsequence1

// number from 0 (min allowable) to 10 (max allowable)

style1 = 3.5;

// controls likelihood of true/false in random subsequence2

// number from 0 (always false) to 10 (always true)

style2 = 6;

///////////////////////////////////////////////////////////////////

// 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,5,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

rotate([42,0,0])

if(show_seed=="yes"){

translate([-26.5,-19.5,21.5]) 

color("blue")

linear_extrude(height=1.5)

text("Wayne",size=15,halign="false",center=true);

}

// Output the random seed in the log

echo(labelString);

///////////////////////////////////////////////////////////////////

// RENDERS


// example: flat base based on overall size parameters

color("darkslateblue")

translate([-50,-19,0])

cube([A,B,10],center=false);

// example: cubes 

// heights based on subrandom1, visibility based on subrandom2

color("steelblue")

for (i=[0:3-1]){

if (subrandom2[i]==true){

translate([(i-5)*(A/12)+A/24,0,5+subrandom1[i]/2]) 

cube([8.5,8.5,subrandom1[i]],center=true);

translate([(i-5)*(A/12)+A/24,7.5,5+subrandom1[i]/2]) 

cube([8.5,8.5,subrandom1[i]],center=true);

translate([(i-5)*(A/12)+A/24,-7.5,5+subrandom1[i]/2]) 

cube([8.5,8.5,subrandom1[i]],center=true); 

}

}

///////////////////////////////////////////////////////////////////

color("pink")

  translate([25,0,4])

cube([10,10,15],center=false); 

color("grey")

  translate([20,-5,4])

cube([10,10,25],center=false);  

color("red")

  translate([25,-10,4])

cube([10,10,20],center=false);  

translate([40,0,9])

sphere(6);

color("red")

translate([42,5,9])

sphere(5);


///////

module prism(l, w, h){

       color("red")

    polyhedron(

 points=[[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],

 faces=[[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]] 

       );}

   

       translate ([-A/2,-(B/2)-15,0])

       prism(100, 15, 10);

// MODULES

// put shapes here

///////////////////////////////////////////////////////////////

// simple custom polybowl

/* [Size] */

// width of the bowl (in mm)

diameter = 9.5;

radius = diameter/2;

// height of the main part (in mm)

bodyHeight = 28;

// height of the base and lower rim (in mm)

baseHeight = .5;

// height of the upper rim (in mm)

rimHeight = 0.5;

/* [Style] */

// number of polygon sides

sides = 7;

// thickness of the bowl (keep above 1.5 mm)

thickness = 1.5;

// degrees that the bowl shape will twist

bodyTwist = 50;

// factor by which bowl shape will scale out/in

bodyFlare = 1.2;

//////////////////////////////////////////////////////

// RENDERS

// base

linear_extrude( height = baseHeight )

    polyShape( solid="yes" );

// body

color("palegreen")

translate([0,0,baseHeight])

linear_extrude( height = bodyHeight+10, twist = bodyTwist,

                scale = bodyFlare, slices = 2*bodyHeight )

    polyShape( solid="no" ); // change to yes for solid bowl


// rim

color("green")

translate([0,0,bodyHeight+baseHeight+10])

rotate(-bodyTwist)

scale(bodyFlare)

linear_extrude( height = rimHeight )

    polyShape( solid="no" ); // change to yes for solid bowl

//////////////////////////////////////////////////////

// MODULES

module polyShape(solid){

    difference(){

        // start with outer shape

        offset( r=5, $fn=48 )

            circle( r=radius, $fn=sides );

        // take away inner shape

        if (solid=="no"){

        offset( r=5-thickness, $fn=48 )

            circle( r=radius, $fn=sides );

        }

    }

}

///
  • This is just part of our code due to the size of the actual code being far too large for this post. This portion specifically changes the size of the name plate and works with Customizer by having those two sizes listed above change depending on whatever size the user types in.
  • The parameters that can vary will include the actual size of the name plate, the amount of pillars in the model, as well as the ability to change one’s name on the front. The size can be typed in manually to allow for a large range of sizes and the name will have a set size, but allow the user to simply type in their name on the front. The pillars have a large amount of variability and could be different for almost every model printed.
  • https://www.thingiverse.com/thing:3451286

Final Prints

  • For the three final prints, we wanted to show what our name plate looked like with and without the Mario while also demonstrating what a variation of the three pillars would look like. As one could see on the bottom left (orange) print, there are actually only two pillars which shows how our code varies greatly in number and size. Also, the top print (black) shows what our name plate looks like without the Mario and on the bottom right (blue) one can see a typically name plate with no real variations.
  • The first attempt at the print was a failure because when it came out, the bottom part was completely morphed around the corners. It was difficult to work around this problem at first, but it was suggested to use a raft base when printing and that fixed our future models. The strength mainly comes from our variability in design.