Choosing an Operation
Choosing an operation is very easy. Once you have chosen what operation you want to use you just have to uncomment (remove the “//” preceding the operation) the line that operation is on.
Once you have uncommented the operation you can either press the F6 button on your keyboard or the render button in OpenScad to execute the operation.
NOTE: If you want to change operations make sure that you comment (add “//”) the lines that you uncommented. Otherwise, you will run several functions at the same time and end up with a combination of them.
How to Use the Batch File
The batch file allows you to get a .stl file for each individual piece. Understanding how this works isn’t really important as long as you know which variables to change.
The first set of variables that you will need to adjust are “a,” “b,” and “c.”
“a” is the starting position of the for loop and in almost all cases you will want to start at 0. The next variable “b” is the amount the loop should increment after every iteration. In most cases, you will want this to be set to 1 so that you get a .stl file for every piece. The third variable you need to adjust is “c” and this value will change depending on your array size. The simplest way to determine this value would be to set it to the product of the variables “n_elem” and “m_elem” inside the library.
Once you have adjusted all of the variables all that is left is to run the .bat file in command prompt. It is also very important that the .bat file is in the same folder as the preview.scad file otherwise this will not work properly. The first thing you need to do is open command prompt and find the directory containing the batch file and the other .scad files. This is done by using the “cd” command to go from directory to directory. If you are unsure of the contents of the directory you are in you can use the “dir” command to display all of the files in the current directory. Also, if you change into the wrong directory you can type “cd ..” to go back into the previous directory. Once you are in the correct directory you just have to type the name of the batch file, in our case “iterate,” and hit enter. The time it takes to generate all of the files will vary, but you should eventually see all of them in the same folder.
Importing and Translating an Object
The imported object will be centered around the origin by default. This is a problem because the library works in the first quadrant. To get around this the object needs to be shifted so that all of it fits on the first quadrant. To do this we can adjust the variables “t_x,” “t_y,” and “t_z.”
(Before the object is shifted)
(After the object is shifted)
In this case, the x and y position needed to be shifted by 425 units, but this value will change from object to object. You will have to play around with the numbers to get it into the first quadrant.
typ_e; Element type
typ_h; Hook type
s_e; Size of each element
n_elem; “x” (column) array size
m_elem; “y” (row) array size
s_h; Hook size
k_e; Element kerf
k_h; Hook kerf
t_x; Translate x
t_y; Translate y
t_z; Translate z
s_obj; Scaling the original .stl object file
fileName; Name of your imported file
height; This should always be higher than the object you are importing