Skip to content

Instantly share code, notes, and snippets.

@arnholm
Last active January 4, 2020 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnholm/02200ed911910fdb22173edcc11bf093 to your computer and use it in GitHub Desktop.
Save arnholm/02200ed911910fdb22173edcc11bf093 to your computer and use it in GitHub Desktop.
// AngelCAD code. https://arnholm.github.io/angelcad-docs/

shape@ main_shape()
{
   double ball_height = 56;
   double top_radius = 20;
   double head_minkow = 3;
   double threw_hole = 11;

   // a few cylinders in an array
   array<solid@> cyls;
   cyls.push_back(cylinder(r:9, h:top_radius));
   for(uint i=0;i<300;i+=72) {
      cyls.push_back(rotate_z(deg:i)*rotate_x(deg:60)*cylinder(r:9, h:top_radius));
   }
   
   // difference between sphere and union of cylinders
   solid@ s = sphere(r:top_radius) - union3d(cyls);
   
   // round off edges with minkowski
   return minkowski3d(s,sphere(r:head_minkow));
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.04);
}
Display the source blob
Display the rendered blob
Raw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment