Skip to content

Instantly share code, notes, and snippets.

@arnholm
Last active April 26, 2019 18:42
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/248d9a14e92b05ab8942d5f9a6611851 to your computer and use it in GitHub Desktop.
Save arnholm/248d9a14e92b05ab8942d5f9a6611851 to your computer and use it in GitHub Desktop.
// AngelCAD code:  pyramid_round.as
pos3d@ p(double x, double y, double z) { return pos3d(x,y,z);}

shape@ main_shape()
{
   // pyramid dimensions
   double x = 50;
   double y = 50;
   double z = 50;
   // radius of rounding sphere
   double r=4;
   
   // triangular pyramid   
   array<pos3d@> pnts = {p(-x+r, -y+r, 0+r),
                         p( x-r, -y+r, 0+r),
                         p( 0  ,  y-r, 0+r),
                         p( 0  ,    0, z-r)
                        };
   solid@ pyramid = polyhedron(pnts);

   // if radius greater than zero, run minkowski
   if(r>0) return minkowski3d(pyramid,sphere(r));
   else    return pyramid;
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.01);
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment