Loading

MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now

MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now
P1030688

Introduction to Parametric Customization

by txoof, published

P1030688
Introduction to Parametric Customization by txoof Dec 16, 2015

Featured Thing!

10 Share

Thing Apps Enabled

Open in Customizer Order This Printed View All Apps

Summary

This is a customizable box with a sliding lid and customizable dividers created in OpenSCAD and is part of a series of OpenSCAD lesson found below.

Please Note: Some features have been left incomplete as an exercise for the reader. For a complete version please see the original box with sliding lid

Changes to the Daring Fireball markdown might make these directions look awful. A full archive of the images, lessons and SCAD files can be found here:

https://github.com/txoof/sliding_box

How I Designed This

Identify a problem

Medication in pill form is difficult to pack in small quantities. Pill bottles are large and cumbersome and do not fit in pockets or small purses. Blister packs rupture leaving the medication exposed to contamination and abrasion.

Define a Solution

A small, refillable pill box with a secure lid that holds one or two doses would be ideal for transporting medication in a pocket or purse.

Design Specifications:

The final design must:

  • fit in an average pocket or small purse
  • have a secure lid
  • hold one or two doses of medication
  • protect the medication from contamination and abrasion

Propose Solutions

  • Bottle with screw on lid
  • Box with snap on lid
  • Box with slide lid
  • Box with iris lid

Select a Solution and Develop

Box with sliding lid

  • lid should be secure, but not difficult to open to keep out contaminants
  • box should be sturdy to hold up to pocket/purse wear and tear
  • box should protect medication from abrasion

Rough sketch of product

Prototyping - 1

Make rough outline of OpenSCAD project on paper defining variables and modules

Outline of OpenSCAD project on paper

Prototyping - 2

Develop a 3D model in OpenSCAD using the plan and drawings.

Prototyping - 3

3D print several models and make changes to the design as needed:

  • Lid fit too snug; increase lid slot
  • Add multiple dividers to keep pills from touching; they abrade less this way

Evaluate finial product

Advantages:

  • Holds two doses of medicine
  • Lid is very secure

Disadvantages:

  • Box is defined by external dimensions rather than by the size of the medication
  • Lid is a bit too secure, difficult to open
  • Lid is not very attactive

Restart design cycle

Identify problems and propose solutions.

Overview and Background

This is a customizable box with a sliding lid and customizable dividers created in OpenSCAD and is part of a series of OpenSCAD lesson found below.

This set of lessons aims to introduce students to the concept of Parametric design. It is not directly tied to benchmarks nor standards, but could be used in any class that uses OpenSCAD.

Please Note: Some features have been left incomplete as an exercise for the reader. For a complete version please see the original box with sliding lid

Lesson Plan and Activity

See Above for specific lesson plans

Project: Introduction and Requirements

Introduction

This is a set of lessons that will introduce a novice, but experienced OpenSCAD user to modular and parametric design.

Audience:

  • Users with some basic OpenSCAD experience
  • Users that wish to improve their OpenSCAD skills
  • Users that wish to learn the basics of Parametric Design/Customization

Objectives:

Students will learn...

  • How to use variables
  • How to use modules
  • How pass variables
  • How to write a module
  • The basics of parametric design
  • How to create customizable SCAD files
  • How to add a customizable Thing to Thingiverse
  • A little about licenses
  • How to manipulate other's OpenSCAD code

Results:

Students will...

  • Have a greater understanding of OpenSCAD variables and modules
  • Create a functioning, customizable sliding top box model with x and y dividers
  • Create a customizable name plate
  • Have a basic understanding of Open Licenses and Copyright
  • Have a basic understanding of parametric design practices

Requirements:

Optional:

Lesson 1

Introduction to the Customizer

The Thingiverse offers users the ability to display their models and designs through a sort of gallery. The gallery can contain images, pdfs, zipped files STL models, OpenSCAD source files and many other file types.

Most models on the Thingiverse are STL files. These are sort of like loaves of bread; they have been made to a recipe with a program like Rhino, Sketchup, Blender or OpenSCAD. They are more-or-less immutable and cannot be changed without a special STL editor.

OpenSCAD files are more of a recipe than a finished product. The recipe can be tweaked and modified to suit a particular need. When OpenSCAD is instructed to 'render' a design, it runs the recipe and bakes the finished product. Some OpenSCAD designs are more tweakable than others depending on how they are created.

Explore this design and see what can be manipulated. Think about this might be useful.

  1. Open this thing at Thingiverse.com and launch the customizer
    • Note: You will need a free Thingiverse account. If you do not have/want a thingiverse account please skip to Lesson 2
  2. Play around with the customizable elements. Try to make a box that has the following dimensions:
    • X: 30, Y: 50, Z:25
    • Wall thickness: 2
    • xCompartments: 4
    • yCompartments: 1

Img 1.0

3. Create an STL and download it later by clicking on the "Create Thing" link.

Questions:

  • What could you customize on this box?
  • Why is it useful to be able to customize objects?
  • In what cases would a designer not want to provide a customizable object?
  • What happened as you input different values?
  • Which features did not seem to work properly?
  • What features would you like to add to this object?

Lesson 2

Customizing in OpenSCAD

Using OpenSCAD to edit an OpenSCAD file is very similar to the customizer at the Thingiverse. The biggest difference is you have access to all the lines and elements. You can change anything and everything. If you are not careful in your edits, you may find that the code will no longer run properly. If you manage to completely break things, just delete the file and download a fresh copy.

  1. Download the OpenSCAD source for this thing.

Img 2.0

  1. Open the file in OpenSCAD and find the [ Outside Dimensions ] section
    • Locate the line that looks like: boxX = 40;
    • Change the line to match this: boxX = 50;
    • Press F5 to render a preview
    • try adjusting the X, Y and Z values; hit F5 to render the model again. Make sure each line ends with a ;.
    • try entering a negative number
  2. Try adjusting settings in the [ Compartments ] section
    • You may find that you can only adjust one of the settings; we will look more at this in a latter lesson

Questions:

  • What could you customize here?
  • Which sections did not seem to work?
  • How is this different than using the customizer at Thingiverse?
  • What advantages/disadvantages does this method have over working at Thingiverse?

Lesson 3

Variables

This section is a little dry and doesn't have a lot of practical things to do. It is pretty important though so this might be a good time to stretch your legs and get a cookie or an apple before you continue.

The changes you were making under the [ Outside Dimensions ] sections were to 'variables.'Variables in OpenSCAD are containers that can hold integers (1, 2, -99999990002), real numbers (-1.123, 6.022, 99.4), boolean (true, false), arrays ([0, 5, 100], [[3, 4 5], [55, 0, 2]]) and text ('Hello world!').

Variables are a convenient way to store values in an easily identifiable package. This method also makes OpenSCAD projects easier to edit and make adjustable. Compare the examples below:

Example 1:

union() {
      cube([5, 5, 30], center = true);
      cube([5, 30, 5], center = true);
      cube([30, 5, 5], center = true);
 }

Example 2:

short = 5;
long = 30;
union() {
       cube([short, short, long], center = true);
       cube([short, long, short], center = true);
       cube([long, short, short], center = true);
  }

Img 3.0 - *Example 1 & 2*

Both examples make exactly the same shape. Copy and paste example 1 into a new OpenSCAD file.

  1. Try and adjust Example 1 to match the image shown below.
    • Hint the values are 2 and 40.
  2. Now try with Example 2
    • If you're anything like me, you probably skipped the steps above and said, 'Yeah, yeah, I get it.'. I encourage you to give step 2 a try just so you can actually try out using variables in a clean space where you can't break too much.

Img 3.1 - *Example 1 & 2*

3. Try out example 3 below. This one is really surprising if you are new to OpenSCAD.

Example 3:

short = 5;
long = 30;
union() {
    cube([short, short, long], center = true);
    cube([short, long, short], center = true);
    cube([long, short, short], center = true);
}

short = 2;
long = 40;
color("red")
union() {
    cube([short, short, long], center = true);
    cube([short, long, short], center = true);
    cube([long, short, short], center = true);
}

You probably expected to get this:

Img 3.2 - *Example 3*

But you should have seen this:

Img 3.3 - *Example 3*

This is because OpenSCAD does not handle variables in the same way as say Python or another programing language you may have used. It calculates all the variables first and uses the last state they are in when it begins drawing. This means you need to be aware of the 'scope' of your variables. More on this later. I'm just planting the seeds here.

Something to keep in mind when you create variables is that they are not just for your reference NOW, but also for you and others in the future. Just because 'foo' and 'dog' look like great variables for a one-off project now, they won't be at all helpful in six hours when you come back to a section that started out as a test and turned into something useful. Try to use useful names. I like to be as descriptive as possible while keeping my variable names short. I also like to use cammelCappedNames or under_scored_names.

In many programming languages variables that start with a Capital Letter are treated in a special way. It is good habit to start your variables with a lower case. Also, most languages will try to interpret dashes as a literal subtraction. A variable named-like-this in OpenSCAD literally means: 'named' minus 'like' minus 'this'. Ugg.

Questions:

  • How can variables make your OpenSCAD designs better?
  • What are some things to think about when naming a variable? Explain to someone else how you will name your variables.
  • What happened in example 3? Explain to someone else why you got that result.

Lesson 4

Working with modules

This lesson has lots of opportunities to make mistakes and break stuff. It should be a bit more fun than the previous section. If you totally bork up the file, download another copy and start over.

Modules are sort of a special variable name that holds a recipe to do stuff. A module can do stuff and can also call to other modules and make them do stuff.

In this lesson you will work with the dividedBox() module that calls several other modules to draw the box, divide it up and add a lid. You are about to add some extra lids to the model. Maybe you want to make sure you have a backup lid?

1. Locate the module dividedBox() and find the section that looks like this:

translate([-boxX, 0, -boxZ/2+wallThick/2])
    rotate([0, 180, 0])
    lid();

This section is actually all one line that does three things:

  • moves the drawing 'pen' from 0, 0, 0 to the left side of the box
  • rotates the drawing surface
  • draws the lid()

2. Try to add a second lid to the right side of the box.

  • Hint 1: everything should be exactly the same except for one character.
  • Hint 2: you need to move the second lid in the positive direction

3. CHALLENGE: Add a third and fourth lid in front and behind the box.

  • Hint: most of the code is the same once again, but you will need to move in the Y axis.

Img 4.0 - Step 2

Lesson 5

Writing your own module

Remember way back to the customizer lessons? Probably not. I'll wait here while you go back and look at the part where I told you to play with the compartments. You'll probably notice something strange about the yCompartment variable.

Don't worry, I've got a cup of coffee. I can wait.

You probably noticed that you can adjust the xCompartment values, but that the yCompartment variable doesn't do antyhing at all. This is because the yCompartment module isn't finished. I left it for you to try writing!

A few notes about modules before you jump in:

  • Modules can receive variables by putting variables into the parenthesies. When the module is called it will expect a value to be 'passed' to it. In this case the (mostly useless) module 'sphereOmatic' expects to get the variable diameter. It will draw a colored sphere when called.

Example 1:

module sphereOmatic(diameter, myColor) {
  $fn = 36; // set the number of segments a curve should have
  color(myColor) sphere(r=diameter/2);} // set the color and draw a sphere
}

Img 5.0 - Example 1

Every time sphereOmatic is called, a new value for diameter and color can be sent. Try out the example below.

Example 2:

module SphereOmatic(diameter, myColor) {
  $fn = 36; color(myColor) sphere(r=diameter/2);
}

sphereOmatic(5, "yellow");
translate([0, 0, 20]) sphereOmatic(10, "blue");
translate([0, 0, -20]) sphereOmatic(4, "green");

Img 5.1 - Example 2

  1. Try the code out above. Change the sphere sizes and colors.
  2. Add a sphere to the left and right of the yellow sphere with the diameter 5 and the color silver and black.

Each time you call out the name of the module you send along with it a new diameter and a new color. These values are stuck inside the module. They are stored inside variables that are only available to sphereOmatic. No other part of the script is aware of the variable called 'color'. We say that the 'scope' of myColor is local to sphereOmatic. Variables like boxX and boxY are called 'global variables.' Any part of the OpenSCAD script can see them. They don't need to be passed around. We say the scope of these variables is global. This is a big topic that can take up an entire month in a Computer Science course. Don't panic if you don't get it yet. I just wanted to introduce you to the concept.

What you need to know is this: If you run a module from within another module you need to send any information along that it needs to know. In this case the yDividers module needs to know how big the innner box is so it can make the divders the right size.

The next section is really challenging and will probably take some trial-and-error to figure out exactly what you need to do. This would be a good opportunity to get some fresh air and a drink of water before continuing.

If you cannot solve this problem, don't worry, you can continue on with the rest of the lessons and come back to this later.

3. Start out with a fresh version of the code and find the module dividedBox()
4. Find where yDividers() is called; make sure you pass the size of the innerBox to it.

  • Hint: look at how xDividers() is called just above
    5. Find the module xDividers() and take a look at what it does.
    6. Copy and paste the contents of the xDividers module into the yDividers module. DOUBLE CHECK the opening and closing curly brackets. If you end up with too many your script will not run.
    7. You will need to change a few things to make the code work properly.
  • Hint 1: you are working with the yDividers now. Make sure you are working with the y dimensions everywhere inside this module.
  • Hint 2: you will need to adjust the cube() statement so the divider is drawn correctly
  • Hint 3: The red highlighted pars of your drawing are the part you are working on

Img 5.2 - Step 7

Questions:

  • Why could you adjust the columns, but not adjust the number of rows at first?
  • Why did you need to include the variable innerBox when you called yDividers()?
  • Why do you think there is an if statement inside the module?
  • What do you think the for statement does? Try to explain this to someone else.
  • Try to explain what scope means to someone.

Lesson 6

Begin your own Customizable Project

You have enough experience now to begin creating your own customizable project. Along the way we will learn about the Thingiverse customizer and adding your own customized projects. Part of each section will include some sample code and a problem to solve.

You will be creating a customizable name plate like the one shown here.

Img 6.0

Comment Blocks:
When OpenSCAD sees this // it ignores everything from the last slash to the end of the line. This is handy for leaving notes to yourself or others. Sometimes comments need to extend over multiple lines. When OpenSCAD sees /* */ everything between the stars is ignored. This is called a 'comment block.'

Thingiverse Customizer:
The customizer uses special comment blocks to help the customizer do its magic.

  1. Open a new OpenSCAD project and create header like the one below. This is a Tab header for the customizer.

 /* [Base] */

2. Look at the example image and think about the variables and values you will need to create the base. What variables should your users be able to adjust? Add some well named variables below that will set the X, Y and Z size of the base.
3. Create a module for drawing a base and call the module. Make sure this compiles.

module base() {
}

base();

4. Add instructions to the base module to draw a rectangular base using the variables you created earlier. If you used different variables, feel free to use them.

module base() {
  cube([xSize, ySize, zSize], center = true)
}

base();

5. Challenge: Use a roundedBox() instead of a cube() for the base. You will need to import MCAD/boxes.scad. Learn more at the OpenSCAD wiki.

Questions:

  • What other variables do you think you will need in creating this project?
  • Make a list of the variables you think you will need.
  • Make a list of the modules you think you will need as you complete this project.

Lesson 7

Add customizable mounting holes

You should have code that looks something like this now:

/* [Base] */
xSize = 45; // lenght of name tag
ySize = 15; // height of name tag
zSize = 3;  // thickness of name tag

module base() {
  cube([xSize, ySize, zSize], center = true)
}

module base()

Img 7.0 - Base plate

  1. Add a variable under the [Base] configuration for the hole diameter.
  2. Create a new module that makes two holes in the corners of the base. Start with the code provide below and try to move the holes so they are both 1/2 of the diameter from the edge. Copy and paste this just above the base() module.

module holes() {
  translate([-xSize/2, ysize/2, 0])
    // create a cylinder with 36 segments that is 2 times the thicknes of the base
    translate([-xSize/2+holeDia, ySize/2, 0])
      #cylinder(r = holeRad, h = 2*zSize, $fn = 36, center = true);
    translate([xSize/2-holeDia, ySize/2, 0])
      #cylinder(r = holeRad, h = 2*zSize, $fn = 36, center = true);
}

3. Add a call just below the base() call to make the holes appear. Your code should look like this:

Img 7.1 - Base plate with holes

Questions:

  • What did you do to make sure the holes were 1/2 of the diameter from the edge?
  • Why is this method better than hard-coding in a number for the placement of the holes?
  • How does using a formula or equation help make this thing more customizable?

Lesson 8

Adding extruded text

In openscad 2015.03 text support was added officially. Using the linear_extrude() built-in raised and embossed text can be easily added to projects.

The linear_extrude() module has many features. We will only be using it in the most simple form here. See the OpenSCAD wiki for more information on other features.

Your next task is to add a module that will provide extruded text. Sometimes it is helpful to turn everything else off while you are working on a new feature. This can be done by simply adding a // in front of any line that you do not wish to execute.

Think back to the list of variables you made in the previous lessons. What variables do you think will be needed for the text?

  1. Comment out the base() and holes() modules:

    //base();
    //holes();

2. Create a variable block for customizing text under the [Base] block:

*/ [Text] */
textHeight = 2; // height over base
textSize = 7.5; // text size
myColor = "yellow" // color in rendering
myFont = "Liberation Sans" // more on this later!

3. Create a module for creating extruded text:

module textExtrude() {
  // the following four lines are all actually one command that ends with the ';'
  color(myColor)
    linear_extrude(height = textHeight)
    text("My Name", halign = "center", valign = "center", size = textSize,
      font = myFont);
}

4. Test out your code; make sure everything else is commented out

//base();
//holes();
textExtrude();

5. This project is super boring with "My Name" on the plaque. Let's make that customizable. Add another variable under the [Text] block for customizing the text. Make sure you use that variable appropriately in the extrude module.

Questions:

  • What did you need to do to make the text more customizable?
  • What do you think we need to do to join all these pieces together?

Lesson 9

Joining it all together

Objectives:

  • Practice calling one module from another
  • Practice using union()

Right now we have three separate parts that look like they are joined together. In some cases, this can be exported as an STL and it will indeed print properly on a 3d Printer. The text is not correctly placed however. Also, if we've made any errors in our placement of objects we may end up with something that looks printable, but that is actually impossible to print.

We can solve this by joining everything together using OpenSCAD's union() and difference() modules. These are in the class of boolean opperations and could be a whole set of lessons in themselves.

  1. Create a module that contains all the separate modules we need to make the name plate. Call the module makeTag()
  2. Check that everything looks like the sample image. Notice that the holes are filled in and that the text is too low on the name plate. We will fix that now!

Img 9.0 - Step 2

3. In the module we need to union() the text and the base. The text needs to be raised up so it appears the proper height over the base. Start with the code below and try to figure out how to raise the text so it is EXACTLY the height of base from the origin. Also try to move the text so it doesn't run into the holes.

  module makeTag() {
    union() {
      base();
      translate([0, 0, 0]) textExtrude();
    }
    #holes() // turn on debug highlighthing to make this easier to see
  }

Lesson 10

Removing unwanted bits

Objectives:

  • Practice using difference()
  • Practice thinking parameterically

You were probably tempted to move the text using hard-coded values like this:

module makeTag() {
  union() {
    base();
    translate([0, -3, 1.5]) textExtrude();
  }
}

Img 10.0

That should put the text just about out of the way of the holes, but the text size is adjusted or the base size is changed, the text will look a bit odd.

Img 10.1

Instead consider moving the text so that it moves relative to the size of the base. Just like the holes, the text will move with the size of the base rather than being static. In this example the text moves down by 1/5 of the ySize and the text floats exactly at the surface of the base.

module makeTag() {
  union() {
    base();
    translate([0, -ySize/5 , zSize/2]) textExtrude();
  }
}

Finally you need to add the mounting holes using difference(). Difference starts with the top level object (first listed) and then begins removing each subsiquent object from the first any where the objects intersect. In this case the union() of base and text makes an new single object.

1. Add a difference() statement to module makeTag()

module makeTag() {
  difference() {
    union() {
      base();
      translate([0, -3, 1.5]) textExtrude();
    } //end union
  } // end difference
} // end makeTag()

2. Check that the result looks like the image above. Nothing should have been subtracted yet.
3. Add a call to the holes() module below the union()statement to make the mounting holes

module makeTag() {
  difference() {
    union() {
      base();
      translate([0, -3, 1.5]) textExtrude();
    } //end union
  } // end difference
    #holes(); // turn on debuging to check the location, remove the '#' once done
}  // end makeTag()
  1. The final model should look like this:

Img 10.2

Challenge:

  • Make the base a different color
  • Use multiple fonts
  • Use multiple shapes for the base
  • Make a hexagonal base or a star shaped base

Questions:

  • What are some of the benefits for making models parametric?
  • What are some of the disadvantages of hard-coding values?
  • Explain how you think the difference and union commands work to someone else.

Lesson 11

Preparing to publishing to Thingiverse

Objectives:

  • Setup variables for Customizer

The last step is to publish this thing onto the Thingiverse. Once you have published it anyone with an account can use the Customizer to make derivative things. This is great! You can share you ideas with other people and they can run with your ideas and make them bigger, more atristic, more rediculous and generally more awesome.

The first step is making sure your thing is easy to customize. We've started out on the right foot by creating logical variable tabs and giving the variables sensible names:

/* [Base] */
xSize = 45; // length
ySize = 15; // height
zSize = 3; //thickness
holeDia = 3.5; // hole diameter

/* [Text] */
textHeight = 2;
textSize = 7.5;
myFont = "Liberation Sans";
myColor = "yellow";

The next step is to take advantage of some of the Customizer Markup. Any variable without specific markup will simply be a user-input field.

Sometimes we want to limit the range of valid inputs. This can be done by using a range.

1. Add a range using the following format: // [minimu:maximum] description

 /* [Text] */
 textHeight = 2; // [1:10] height of text over base
 textSize = 7.5; // [1:50]

It is also possible to add a drop down menu of pre-populated options using list. Here's an opportunity to return to the font face choice. In version 2015.03-2 it is possible to use all of the system-installed fonts, but those fonts are not available on Thingiverse. Check the documenation wiki for more information on [fonts](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#Text] and colors.

2. Add a list of options using the following format: // [option1, option2, option3]

myFont = "Liberation Sans"; // [Liberation Mono, Liberation Sans, Liberation Sans Narrow and Liberation Serif]
myColor = "yellow"; // [green, yellow, blue, red, silver, black] Text color

One other useful customizer section is the /[Hiden]/ section. This section, as the name implies is hidden from view. This is a great spot to do calculations or set up variables for use elsewhere. If you know that you will be dividing a variable by 2 every time you use it Such as the holeDiameter, set this value in the Hidden section.

When writing a program, if you do something more than twice by hand, you should consider finding another way of doing it. Every time you divide by 2, or add two variables together manually you risk a typo that you will need to find and correct later. By limiting the number of times you make a particular calculation debugging and changes become much, much easier.

3. Add a /* [Hidden] */ section and add a variable for holeRad = holeDia/2;
4. Update your code to use holeRad in the holes() module.

Questions:

  • What types of variables in this project should be set as a range?
  • What things should be set as a drop down list? Why?
  • Can you think of a specific instance where you would want to prevent a user from inputting a specific value? What about when division is involved?
  • How can the [Hidden] section be useful to you as a designer? How is it useful to other people that review your designs?
  • How can setting variables under the Hidden section save you from errors later?

Lesson 12

Getting ready to publish

Objectives:

  • Create an account on thingiverse
  • Become familiar with Copyright licenses
  • Choose an appropriate copyright license for this project

The final step in this is to upload your project to Thingiverse so other people can play with it, improve on it and share their work. There are a few things you will need to do before you can share this project.

Creating an account should be pretty self-explanitory. If you want to skip this step, continue on for some last little tid-bits.

Here's a really interesting fact about Copy Right. You already have it. Once you hit the save key, you created a piece of work that can be copyrighted. The act of creation is all it takes. You have the sole right to decide who will use your work and how it will be used. Most of the stuff you see on the Thingiverse is copyrighted, but copyrighted in such a way that preserves the creators reputation, but allows anybody to make stuff and have fun with it. This is done through chosing a license that matches how you feel about your work.

Is your work super secret and the basis of your billion dollar business plan? Don't share it! Keep that to your self! Or is your work a good idea based on the good ideas of all those that have come before you? Or something in between? How would you feel about someone using your idea to make something new? How would you feel about someone profiting from your work? Once you've answered those questions the next steps should be easy.

Take a look at the Creative Commons license page and see which license works best for you. There's a nice little 3 minute video that explains the basics of the licenses.

Choosing a license is not complex, but does require a bit of thought. This set of lessons that you have been reading is released under the Creative Commons Attribute-Share-Alike License. This means that if you want to publish your own version of the sliding top box or the name tag you should give me credit and you need to share your designs under the same terms, allowing others to modify and share the work as well. It also means that you can't sell the design. You are welcome to make real objects based on the design and sell them, but you can not take credit for the designs and sell those as your own.

Giving credit is as simple as providing a user name, or an email address somewhere in your project. When you share your project on Thingiverse, or any other web site, you should also mention that your project is licensed under the Creative Commons Attribute-Share-Alike license so other people know where it came from.

Thingiverse also provides GPL licenses and BSD license. These are more specific and apply more to software than creative works, but can be applied to almost anything.

Because this project was originally released under the CC Share-Alike license, you really should choose the same license. I won't hunt you down and point a loaded lawyer at you, but I might give you a hard time if I come across one of your designs that is licensed in a more restrictive way.

Questions:

  • Why would you bother to copyright your work at all?
  • Why should you respect the copyright of other's work?
  • Which license did you choose for this project? Why? Hint: there are only a few right answers to this questions.
  • Which license is best for work that you intend to share with the community?

Lesson 13

Uploading your project for customization

Objectives:

  • Publish a customizable project to Thingiverse

The final step is to get your project up on the Thingiverse and get the customizer running. You will probably need to do some debugging and upload the files a few times; that's pretty normal.

  1. Create an STL and a PNG of your design in OpenSCAD; this will give you a nice image to share
    • F6 to Render
    • File > Export > Export as STL
    • File > Export > Export as Image
  2. Sign in to your Thingiverse account and choose 'Create > Upload a Thing'
  3. Drag or Browse to upload your STL, PNG and SCAD file for your project
    • Drag the thumbnails to organize the images in the order that suits you
  4. Give your project a catchy name that is descriptive but short
  5. Select a category. This fits well under Art > Signs and Logos
  6. Choose a license. This project was originally distributed under the CC Atrrib-Share-Alike license. It would be best to share this project under the same license as that is keeping in the spirit of the Creative Commons and the original author's (my) wishes.
  7. Tick the 'This is a Remix' box because you derived this from someone else's project
    • In the box below you can specify the project this was derived from (1201466)
    • This helps others see the lineage of the project and locate other users that are working on similar projects.
    • This is also nice for me because I get a little notice every time someone uses my work. It's like a little tip in my jar, but I can't spend it. It just makes me feel good.
  8. Tick 'This is a Customizer' to make sure this project is customizable.
  9. Add one or two sentences summary that explains what this project is all about
  10. If you would like to add any other instructions or notes you can use the Design section and the custom sections. This is not necessary, but can be nice.
  11. Save and view your project.
    -Now's the time to test the customizer.
    -Make sure the customizer options appear as you expect. Make sure that things work like you hope.
    -If you need to make changes, edit the project and remove the SCAD file. Replace it with a revised version and then repeat step 11 as needed.
  12. Publish your thing using the link at the top of the page and share it with all your friends.

Congratulations! You've just created your first customizable, parametric project and shared
it on Teh Intertubes!

Closing

Thanks for making it this far. I hope you found this text useful and feel more confident using OpenSCAD and making parametric designs.

The next step is to download other people's libraries and SCAD projects and play with them. You can learn more from experimenting with other projects than I can teach you here. If you get stuck, don't hesitate to contact the person who created a project. Most authors will be thrilled to hear from someone who found their project useful. The urge to share ideas and learn from others is why most authors publish their works in places like the Thingiverse.

If you have any questions or comments for me please don't hesitate to contact me either through the Thingiverse or via email. I am happy to answer questions and would love to fix any mistakes you find.

Apendix

Solution for sliding top box yDividers:

module yDividers(innerBoxDim) {
// paste below this point.  Be careful that you pay attention to the curly brackets

  echo ("This is the xDividers module");
  echo ("innerBoxDim=", innerBoxDim);
  // the number of dividers is always one less than the number of compartments
  cols = yCompartments - 1;

  // calculate the spacing of the dividers based on the dimensions of the inner box
  // element 0 of the innerBoxDim variable contains the X dimension
  // element 1 of the innerBoxDim variable contains the Y dimension
  increment = innerBoxDim[1]/yCompartments;

  // if the number of y compartments is bigger than 1, do this:
  if ( yCompartments > 1) {
    // this loops several times to make each divider from 1 to the number of columns
    for ( i = [1 : cols]) {
      // move each divider into place
      // The translate statement needs to be updated so it moves in the Y axis
        translate([0, -innerBoxDim[1]/2+i*increment, 0])
          // draw a cube - this needs to draw the cube in an orientation 90
          // degrees from the xDividers
          cube([innerBoxDim[0], ,dividerThick, innerBoxDim[2]], center =true);

    } // this bracket is the end of the "for" loop
  } // this bracket is the end of the IF statement
} // end module

Name Tag Solution

A final version of the name tag can be found on the Thingiverse for reference and download.

More from Containers

view more

All Apps

Customizer is the easiest way to take great 3D printable designs and make them your own. Make your OpenSCAD designs infinitely more valuable by empowering the community to customize them.

App Info Launch App
Customizer Thing App

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App

A lot of info around this rectangle. This project is worth of 10-15 minutes of designing actually. I mean nothing is wrong with designing a BOX, but it's so simple, not worth naming it a "project" in my opinion. It's a box for God's sake lol. How does thingiverse pick "featured" designs I wonder. I think they pick the easiest that they can print for money :)

You're right! It is simple! I wanted to make sure anyone could jump right in to the code and have a play.
What would you change to make it better? Feel free to modify and remix it! If you want to give it a try, I'd be happy to give you some pointers or answer any questions.
Happy making.

I think you completely missed the point of this project. Think about it.

I may have run into a bug. I used the Customizer to create: https://www.thingiverse.com/thing:2377120 and the dividers are not attached to the base (verified in Cura and Slic3r). I didn't notice until the print was in progress but enough plastic drooped into the gap that the box is still usable. There were 3 layers at 0.2mm (0.6mm gap) from the end of the base to the start of the internal dividers.

I'll put a warning on the model but leave it around for a week or two in case you want to have a look.

Very nice project and a funny reading! Thank you!!!

The print quality in those screenshots looks terrible :-/

You're right! I never did get my old Thing-o-Matic dialed in 100%. I'll post some better pictures if you provide them.

Thanks for your introduction

The lid would print so much nicer if it was flipped. I use F360 to separate the mesh between lid and box, export them out as separate files so I can flip the lid. Flipping the lid also makes a nicer looking top. Just a suggestion.

Agree, flip and separate the lid. I don't want to loose time with coding.

Time spent learning is never time lost! If you do decide to take a crack at the code, and get stuck, I'm happy to help!

Jassper,

Great idea! The point of this thing is to teach you about OpenSCAD. I'd encourage you to try to adjust the code and make this feature a reality! There's a module lid() that you can adjust.

Let me know if you need any help.

Hah i was the guy hew gave this the 1112th like

wow that is impressive

Thanks for sharing this code and with good comments. I was able to go in and add a few features to put the lid on the same plan as the box and also put the thumb slot on the other side of the lid.

I'm glad to hear you could work with the code.

Have you published your code on Thingiverse? I'm always excited when derivatives show up.

The lidSnugness parameter must not affect opening size but must affect lid size. I think so because change opening size leads to thinning of the wall. Furthermore the nozzle size affect overall dimensions reducing inner and increasing outer sizes.

Take a look in module lid() and feel free to make the changes.

I tried to document the code in such a way to make changes easy. Let me know if you have questions or need some advice. I'd love if you posted a derivative and improved work.

i'm a parametric drafter / programmer so I skimmed over this just to see what it contains and I have to say: a difficult job well done. Thanks for taking the time to share your knowledge!

It's my pleasure. What software do you work in? I'm curious to move out of OpenSCAD and into something more robust, but not sure where to go next.

Mostly Inventor ;)

A really great tutorial. Thank you.

By my side, I've just printed the box (in ABS) and not for using it as pills box. It's perfect, except that it's lid is a bit larger than the box. I will ajust it. Have a nice week end.

Great tutorial! Thanks for all your work.

PLEASE NOTE! Make sure you use a food-safe filament like PETG, as many filaments (PLA, ABS, etc.) are not food-safe.

https://en.wikipedia.org/wiki/Polylactic_acid

Says here pla is used for food packaging and disposable tableware.

PLA, the material, is used for food-related things. PLA, the filament, often has non-food-safe chemicals added, and is very porous. This means it'll pick up bacteria after its first use and be very difficult to sanitize after that, meaning if it's safe at all (re: aforementioned checmical additives), it won't be for long. Generally speaking, don't consume things from 3D printed PLA.

any way you can make the lid and the box an option in customizer ? Just saying as i run out of printer bed space when trying to make a large box. If i could print the lid and box separately it would solve that problem. Thanks.

You sure can! Download the OpensSCAD code and take a look inside.

You'll find a few different modules. One is called "lid()"

You can run that module separately. There is another that builds the box. All the customization happens at the top. You'll probably notice that the Y dividers are broken. That's on purpose. It's up to you to fix them!
The attached lessons are pretty much all you should need to get going.

Let me know if you have questions. I'll do my best to help.

When wall thickness is less than 2, then the box and the lid are not on a plane and are hence not printable. Please fix this.

I'm in the process of fixing this. Thanks for pointing it out.

I hope you took a look at the code and learned something interesting.

Sorry to hear you're having trouble with this design. It looks like I made an error somewhere in my calculations.

Thanks for noticing! I think I know what the solution is, but you're welcome to take a look at the attached lessons and give it a shot too! That's the beauty of parametric design!

I suspect the problem is around lines 240 and 130. The rest of the math look good. See if you can figure out what the problem is. I suspect it will be very satisfying if you sort out the problem for yourself. After all, this Thing is all about learning something new!

The only thing that made my spidey senses tingle is that you might consider referring to variable scope in a way that introduces the student to instance variables. This is an important distinction should the student later study object oriented languages.

Indeed that is a good point! I never formally studied CS and so my technical knowledge and ability to describe such topics is a bit weak. I personally am a little unclear about what makes OpenSCAD different from a language like Python. I understand that OpenSCAD does all of it's calculations ahead of time, but other than that I don't really appreciate how they are different in a meaningful way.

If you have a suggested edit to make this more clear I'd really appreciate the help!

Aside from the fact that OpenSCAD assigns variable values at compile time rather than at run time, I don't think there's any difference. Local versus global variables behave the same way they do in an object oriented language. (99% sure on this; I usually name my local variables differently anyway, just to avoid confusion.)

I think what he's saying is that he'd like to see more clear explanation about variable scope in your (awesome) lesson content, not that there's an error in the way it's implemented.

Ahhh! That's what I thought. My understanding of variable scope is functional, but I'm going to need to do some of the hard thinking if I add this to the lesson.

Great stuff. What age can this be used for? Im teaching junior high

It was written for high school kids in a self paced class, but I imagine 6-7th graders could cope with enough help.
Let me know if you use it.

Nice box! I had to re-size the lid separately, but I'll get it at some point :)

First of all... great customized box. Love it. However, there is an issue with the lid. The angled edge is going the wrong way and if you print or use the customize app, it will also be wrong.

Please note that the lid pints upside down within the reference frame of the box. This is to provide a cleaner slot for the closing tab. The angled edge is under 45 degrees for most reasonable customizer settings; most printers should manage this without trouble.

Whoa! Talk about going the extra mile to write out multiple days worth of well thought out lesson plans. Bravo!

Wonderful work ! Very well done !

Thanks for the compliment. If you use my tutorial with a class, I'd love to hear about it!

This tutorial has been great! thanks for the info. Regarding the box now, I noticed the nail recess seems to be on the wrong side of the lid! or was it just my idea? The top of the lid as I see in your pictures should be the one in the short parallel face of the trapezoid but in the file is on the long one. What i did with this was to add the recess to create a protuberance and move it a bit so it helps me to keep the box closed and i added a new recess on the other side of the lid :)

I was looking at another issue and just realized what you meant! The slot is on the wrong face!
Thanks for pointing this out!

Actually, the nail slot was originally on the side farthest from the opening due to a small catch that I built into previous designs. You basically did the same thing in your design.
Check out this (version)[http://www.thingiverse.com/thing:201304] - you'll see a slot on the "bottom" of the lid that allows the catch to fit into it. I found it mostly unnecessary as long as the lid fit was snug enough. I removed it in this version to make the design simpler and easier to understand.

I'm glad you found the instructions useful and actually created something with them. Nice work on your version. I really like that you changed the height of the dividers. A nice next step might be to make that a customizer option.

Box with Sliding Top
by txoof

Yes, I found your other design after I did my change :P
I'm taking your advice and allowing the separation height to be customisable. Actually, if you see that part of the code, it is not hidden, but i think that it was not modificable because I'm using a calculated value to initialise it. I thought that those values which were not hidden were all customisable, but that is not the case.
My next step is to provide a finger opening so the items near the end of the case can be retrieved! My fat fingers don't fin in the 1mm space I left...

I'm glad it's working out for you. I look forward to seeing your updated version.

y compartments not working.

Very astute! This box is part of a greater set of lesson plans that teach about customization, parametric design and functions.

Please see the summary for more information:

Please Note: Some features have been left incomplete as an exercise for the reader. For a complete version please see the original box with sliding lid

Box with Sliding Top
by txoof

I would appreciate any feedback that you have on the lessons if you work through them.

remove or reduce parts of guide / tutorial not related to box. :)

I'm not quite sure what you mean. The guide is not only related to the box, but rather an introduction to parametric design and some practices that will make your models easier to modify.

If you are only interested in the box, try the following lessons: 2, 4, 5. Though the other lessons will probably help you have a better understanding of OpenSCAD and parametric design.

Comments deleted.
Top