OpenSCAD
Lines, hull()
Now that
hull() works with 3D objects you can use this function to create lines.
How do I do this?
- If you do not have OpenSCAD installed, download the application from openscad.org
- So how does hull() help you in OpenSCAD?
Here is a simple line.
hull(){
translate([0,0,0])
cube([.5,.5,.5]);
translate([20,10,0])
cube([.5,.5,.5]);
}
or
linear_extrude(height=1)
hull(){
translate([0,0,0])
circle(.5);
translate([20,10,0])
circle(.5);
}
- You can and should create a module for drawing lines:
module line(start=[0,0,0],end,thickness=.5){
hull(){
translate(start)
cube([thickness,thickness,thickness]);
translate(end)
cube([thickness,thickness,thickness]);
}
}
or
$fn=128;
module line(start=[0,0,0],end,thickness=.5){
linear_extrude(height=thickness)
hull(){
translate(start)
circle(thickness/2);
translate(end)
circle(thickness/2);
}
}
- Save this file as lineMaker.scad
- Create a new OpenSCAD document and save it in the same location as lineMaker.scad
- The first line of your new document should be:
- Then to create a line that starts at 0,0,0 with a thickness of .5 you would type:
To create the same line, but with a thickness of 2, type
line([0,0,0],[20,10,0],2);
- Using your line() make a square where your lines are 1mm thick:
Create a new form that uses the line() module.
Why am I doing this?
OpenSCAD allows you to generate interesting forms by working parametrically and with external files. This tutorial also demonstrated how to take advantage of the
hull() function.
Now what?
- Upload your form that takes advantage of lineMaker.scad and line() to Thingiverse
- Come back tomorrow for more information and inspiration!