Pages

Sunday 24 August 2014

3D Modelling for 3D Printing #3

In this video we finish off the OpenScad Model and start with creating the same model in SketchUp to show the comparison and some of the the required tips and trick.


The final object can be found on thingiverse.com


Below is the code which you should get to by the end of the video if you were following along.

OpenScad
/*
Created by David Taylor as part of a video series
Video are available at http://bit.ly/GineerTube
*/

include <libraries/MCAD/boxes.scad>

hw=40;
d=20;
t=5;
hr=3;
cr=2.5;

difference()
{
 union()
 {
  translate([(hw/2)-(t/2),0,0])
  {
   //cube([hw,d,t], center=true);
   roundedBox([hw,d,t],cr,true);
  }
  translate([0,0,(hw/2)-(t/2)])
  {
   rotate([0,90,0])
   {
    //cube([hw,d,t], center=true);
    roundedBox([hw,d,t],cr,true);
   }
  }
  translate([((hw/2)*sqrt(2))/2,0,((hw/2)*sqrt(2))/2])
  {
   rotate([0,45,0])
   {
    cube([hw,d,t], center=true);
   }
  }
  cube([t,d,t],center=true);
 }
 translate([(hw/4),0,0])
 {
  cylinder(h=(t*2), r=hr, $fn=100, center=true);
 }
 translate([(hw/4)*3,0,0])
 {
  cylinder(h=(t*2), r=hr, $fn=100, center=true);
 }
 rotate([0,-90,0])
 {
  translate([(hw/4),0,0])
  {
   cylinder(h=(t*2), r=hr, $fn=100, center=true);
  }
  translate([(hw/4)*3,0,0])
  {
   cylinder(h=(t*2), r=hr, $fn=100, center=true);
  }
 }
 translate([(hw/4),0,(hw/2)+(t/2)+0.1])
 {
  cylinder(h=(hw), r=(hr*2), $fn=100, center=true);
 }
 translate([(hw/2)+(t/2)+0.1,0,(hw/4)])
 {
  rotate([0,90,0])
  {
   cylinder(h=(hw), r=(hr*2), $fn=100, center=true);
  }
 }
 translate([(hw/4)*3,0,(hw/2)+(t/2)])
 {
  cylinder(h=(hw), r=(hr*2), $fn=100, center=true);
 }
 translate([(hw/2)+(t/2),0,(hw/4)*3])
 {
  rotate([0,90,0])
  {
   cylinder(h=(hw), r=(hr*2), $fn=100, center=true);
  }
 }
 translate([(hw/4)+(hw/2),0,(hw/4)+(hw/2)])
 {
  cube([hw,(hr*4),hw], center=true);
 }
 translate([(hw)-sqrt(pow(hw/8,2)-pow(t/2,2)),0,(t)])
 {
  rotate([0,20,0])
  {
   cube([(hw/4),d,t],center=true);
  }
 }
 translate([(t),0,(hw)-sqrt(pow(hw/8,2)-pow(t/2,2))])
 {
  rotate([0,-20,0])
  {
   cube([t,d,(hw/4)],center=true);
  }
 }
}

No comments:

Post a Comment