Pages

Thursday, 21 August 2014

3D Modeling for 3D Printing #2

In this video we continue working on the bracket we started in the first video and cut the screw holes by using difference and union as well as introducing libraries. This vide continues on from the first video in this series which you can find at: http://youtu.be/rUwoMPB4Lv8


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

OpenScad
include <libraries/MCAD/boxes.scad>

hw=40;
d=20;
t=6;
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);
  }
 }
}

No comments:

Post a Comment