Skip to content

Instantly share code, notes, and snippets.

@arnholm
Last active May 21, 2018 10:41
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/23739f7e0fb48f477aaf1b6bbeee968f to your computer and use it in GitHub Desktop.
Save arnholm/23739f7e0fb48f477aaf1b6bbeee968f to your computer and use it in GitHub Desktop.
// AngelCAD

shape@ manyballs_flat(uint n)
{
   solid@ s = sphere(25);
   double delta=45;
   solid@[] zs;
   for(uint i=0; i<n; i++) {
      double x = i*delta;
      for(uint j=0; j<n; j++) {
        double y = j*delta; 
        for(uint k=0; k<n; k++) {
           double z = k*delta;
           zs.push_back(translate(x,y,z)*s);
        }
      }
   }
   return union3d(zs);
}

void main()
{
   shape@ obj = manyballs_flat(n:16);
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.18);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment