standard logo    Personal Education

3D Central



piggy

This Little Piggy

Anybody need a cute little pig? I decided that I did. You may decide this critter isn't right for you, of course.
After you look at my code, improve it and make your own version!

The basic body is made of three spheres connected in a hull(), one for the head/chest, one for the rump and a third in the middle for the belly.

body


// body
hull(){
    // chest/head
translate([0,20,20])
sphere(9);
    // belly
    translate([0,-2,16])
  //      scale([1.5,1,1])
    sphere(10);
    //rump
translate([0,-16,19])
sphere(11);
}

Then came legs, ears, a snout with nostrils, eyes and even a tail.

I had designed a tusk for an earlier elephant figurine. Unfortunately it was designed flat, curving around on the flat surface with no clear connection to the center "point of origin" and that made repositioning it a REAL PAIN. It turns out that every component that you design to reuse later works best if the "base" of it starts centered on the point of origin like the second image below.

original   redesign

The ear is also an interesting design. It is formed by doing a triangle with three hulled spheres and then using difference to remove the "inner" space of the ear as a scaled down version of the larger. See the code below. The eyes do use the same trick to difference the pupil out of the eye proper, but both eye parts are just spheres.

ear


module ear(){
    difference(){
hull(){
translate([0,0,5])
sphere(1.5);
translate([2,-1,1])
sphere(2);
translate([-2,-1,1])
sphere(2);
}

//inner
hull(){
translate([0,1.2,5])
sphere(1.1);
translate([2,0.4,1])
sphere(1.5);
translate([-2,0.4,1])
sphere(1.5);
}
}
}

The feet sit nicely on the print surface, but the chest and belly between the legs will probably produce a lot of filaments that sag badly. It is possible to let your slicer software create a standard support matrix, but I have found it is often difficult to cleanly remove it when there are legs involved, so I generally use conical pegs to give support instead. The pegs do not entirely prevent sag, but they snap off easily with very little further cleanup to do.

side view side view

Available Files:

(In most browsers, right click each file you wish to download and select "save-as" from the menu options.)

SCAD files for study/modification and STL files for quick prints

piggy03.scad - piggy03.stl - This little piggy stayed home, no trip to the market this time.
GPL3 License