Author Topic: Radiator fix  (Read 29 times)

Carsten Arnholm

  • Administrator
  • Newbie
  • *****
  • Posts: 15
    • View Profile
Radiator fix
« on: 2019-10-06, 20:24:44 »
AngelCAD was used to design a part in order to fix a broken radiator, and the result turned out well, the radiator can be used again! Image of printed part is attached.

More images as well as STL for this part can be found at  https://www.thingiverse.com/thing:3900987

Source code for the part follows
The code illustrates 2d and 3d features of AngelCAD, plus using variables for parametric modeling.

// AngelCAD code: radiator_fix.as

shape@ main_shape()
{
   double dx  = 59.0;
   double dy  = 26.0;
   double dy1 = 6.0;
   double th  = 2.0;   // thickness
   double h1  = 13.0;  // height of circular part
   
   double r_hscrew = 2.3;     // radius of horizontal screw holes
   double r_vscrew = 2.0;     // radius of vertical screw holes
   double x_screw = 20.0;     // x-coordinate of screw holes
   double y_screw = dy - 8.5; // y-coordinate of vertical holes
   double z_screw = 7.0;      // z-coordinate of horizontal holes
   
   double r_power = 10.5/2;   // radius of power hole
   double y_power = dy - 8.5 - 5.0;
   
   double x_flange = 10.0;

   // bottom plate is intersection between curcle and rectangle
   shape2d@ rect = translate(-dx/2,0)*rectangle(dx,dy);
   circle@  circ = circle({-dx/2,dy1},{0,0},{+dx/2,dy1});
   
   // main part consiste of horizontal and vertical pieces
   solid@  horiz = linear_extrude(rect & circ,th);
   solid@  vert  = linear_extrude(rect & (circ - translate(0,th)*circ),h1);
   solid@ main_part = horiz + vert;
   
   // holes for the vertical screws
   solid@ v_screw = cylinder(r:r_vscrew,h:50,center:true);
   @main_part = main_part - translate(+x_screw,y_screw,0)*v_screw;
   @main_part = main_part - translate(-x_screw,y_screw,0)*v_screw;
   
   // holes for the horizontal screws
   solid@ h_screw = cylinder(r:r_hscrew,h:50,center:true);
   @main_part = main_part - translate(+x_screw,0,z_screw)*rotate_x(deg:90)*h_screw;
   @main_part = main_part - translate(-x_screw,0,z_screw)*rotate_x(deg:90)*h_screw;
   
   // slot for the power wire
   solid@ power1 = cylinder(r:r_power,h:50,center:true);
   solid@ power2 = translate(0,dy,0)*power1;
   @main_part = main_part - translate(0,y_power)*hull3d(power1,power2);
   
   // slots for the flanges in the radiator plastic
   solid@ flange = rotate_x(deg:45)*cuboid(dx:3.0,dy:18,dz:15,center:true);
   @main_part = main_part - translate(+x_flange,0,0)*flange;
   @main_part = main_part - translate(-x_flange,0,0)*flange;
   
   // add triangular flanges for increased stiffness
   solid@ triangle = translate(0,3,1)*rotate_y(deg:-90)*linear_extrude(polygon({0,0},{10,0},{0,10}),th);
   
   @main_part = main_part + translate(+x_flange+5,0,0)*triangle;
   @main_part = main_part + translate(-x_flange-3,0,0)*triangle;

   @main_part = main_part + translate(+x_flange+17,3,0)*triangle;
   @main_part = main_part + translate(-x_flange-15,3,0)*triangle;

   return main_part;
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.01);
}