Robot Car – p3: Designing the car body

Using OpenSCAD:

There are multiple tools to do 3D Design. Some are language based some are point and click and some try to mix the two approaches. I personally like to use OpenSCAD because it is language based and gives you the capability to build modules and assemble them into objects. Since everything is based on 3D coordinates you can precisely scale, rotate and translate each element.

Body Design:

Building a nice looking object using only 3D geometric shapes like cubes, spheres and cylinders is not obvious but OpenSCAD proposes some advanced transformation feature that make this type of easier.

The hull operator connects different objects with a surface. For example you can connect a square and a disk:

hull() {
   cube([20,20,1],center=true);
   translate([0,0,20]) cylinder(1,8,8);
}

Gives:

Hull example

But this still has sharp angles. To make a smoother surface you can use an other transformation called minkowski. This transformation circulates a object like a sphere on the surface of the object to create a new one.

minkowski($fn=64) {
   hull() {
       cube([20,20,1],center=true);
       translate([0,0,20]) cylinder(1,8,8);
    }
   sphere(r=5);
}

Hull + Minkowski example

So for the car body we start from:

Car body base

And we get:

Car body full

This is a good start but the form is full and we need to carve some place to make room for the electronic components. I found a nice trick using the minkowski function. I first create a module describing my object but I use a parameter for the minkowski sphere radius. So I can subtract from the original object an object smaller by few millimeters.

module body(r) {
    minkowski() { 
      hull() {
       translate([10,0,0]) rotate([0,45,0]) 
             translate([-50,-30,0]) cube([50,60,2]); 
       translate([-150,0,7]) rotate([0,-21,0]) 
             translate([0,-25,5]) cube([20,50,2]); 
        translate([-120,0,0]) cylinder(10,40,40); 
        translate([0,0,0])
       scale([0.3,1,1]) cylinder(10,40,40);
    }
    sphere(r);
   }
  }

intersection() {
  difference() {
        body(r=6);
        translate([0,0,-1]) body(r=3);
  }
 translate([-200,-100,0]) cube([300,200,100]);
 }
 

Carved car body

Starting from there I guess you can imagine how to built the car body.

For more details check the SCAD file on the github repository:

 

Printing the car body:

If you are familiar with 3D printing you know that from a design to an object that you can assemble there are some steps that require experience.

 

First the slicing is the transformation of a 3D volume to a sequence of 2D slices that can be printed. The material used for the car body in PLA (polylactic acid). It can support small size bridges and 45° overhangs but not she shape that we have here. For printing the object you need to add some support material. Slicer programs li slicr (the one I use) are capable to generate the right support for you object. There are two options for the support. Some printer with 2 hot ends can print with two material one (PLV) can be diluted in hot water have the print. In my case I have a simple one nozzle printer. So I use PLA for both support and print. Slicr offer the possibility to generated a light wait support enough for supporting the bridges and overhangs and easy to remove after the print. The main drawback is that the surface in contact with the support is not very smooth. So I recommend to keep the support inside the body to the not good looking surface will be inside and not visible.

You can see on this picture the support material in black with a very sparse structure to limit the material waste.

Car slice witj SLICR

 

The second difficulty is the sizing of the object. With all the transformations: hull and minkowski it is sometimes difficult to know the de precise dimension for your object. For that I used another trick: OpenSCAD offers a resize function that will make your object fits exactly the expected dimensions.

The last difficulty is the overall size of the object. My printer has a 20cm x 20cm wide bed which is two small for the main piece which is 280mm x 210mm. So I had to cut the body in 3 pieces one for the front and 2 for the back.

carparts

Cutting the object in pieces is easy. You can do it with a cube intersection in OpenSCAD or directly in the slicr program. The difficulty is more to assemble them together after printing. I found the proposer glue to fix the PLA but you want each piece to be very precisely aligned. It is very difficult to place them in a vice because the pieces are not rectangular. I decided to design and print some locking pieces that will keep the parts tied while the glue is drying.

module rivet(shift) {
    linear_extrude(height=3+shift) {
     polygon(points=[[-10-shift,2.5+shift/2],[0,1.5+shift],
  [10+shift,2.5+shift/2],[10+shift,-2.5-shift/2],
 [0,-1.5-shift],[-10-shift,2.-5-shift/2]]);
 }
    
 }
 
 color("blue") translate([0,-0.1,-0.2]) rivet(0);
 difference() {
    translate([-15,-10,0]) cube([30,20,20]);
    translate([0.2,-10,0]) cube([0.4,30,30]);
    translate([0,0,-0.1]) rivet(0.4);
 }

Rivet

As you can see in the code the shape of the male and female parts are not exactly the same. Of course there is some gap because of the precision of the 3D printer but also the angle is a little bit wider on the rivet. The idea is to create a pressure between the two parts of the object and stick them together.