Skip to content

Instantly share code, notes, and snippets.

View cube minus sphere.md

Cube minus sphere

shape@ main_shape()
{
   solid@ myShape = cube(size:100,center:true) - sphere(r:64);
   return myShape;
}

void main()
{
View Drop with sweep.md

Drop with sweep (AngelCAD source code)

double pi = 4.0*atan(1.0);

// radius and height
double r(double t) { return 0.5*(1-cos(pi*t))*sin(pi*t) + 0.005; }
double z(double t) { return 80 + 80*cos(pi*t); }

// profile direction 
vec3d@ dir(double t, double exp) 
@arnholm
arnholm / mayan_haab_15_inch.scad
Created Jan 4, 2018
Mayan Haab calendar - OpenSCAD
View mayan_haab_15_inch.scad
This file has been truncated, but you can view the full file.
// OpenSCAD script
extrude_height = 0.5;
scale_factor = 1.0;
linear_extrude(height=extrude_height)
scale(scale_factor)
mayan_haab_15_inch_dxf();
module mayan_haab_15_inch_dxf()
@arnholm
arnholm / solid_math.md
Last active Jan 11, 2018
AngelCAD code (angelscript) - generate solid from math functions
View solid_math.md
// AngelCAD
double f(double sign, double x, double n)
{
   double xn  = pow(x,n);
   double x1n = pow(1-x,n);
   return sign*(xn/(xn+x1n) + 0.5);
}

shape@ main_shape()
View manyballs_flat.md
// 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;
View basic_octahedron.md
// AngelCAD sample: basic_octahedron.as
// Illustrate creation and use of octahedron

solid@ octahedron(double size)
{
   // An octahedron is a convex object so it can be defined 
   // as a polyhedron simply through an array of octahedron vertices
   pos3d@[] p = 
   {
View sweep_holes.md
// AngelCAD code. Sweep a profile with holes along a path

shape2d@ profile_with_holes()
{
   rectangle outer(100,100,center:true);  // outer border
   
   rectangle rl(65,10,center:true); // long rect. hole
   shape2d@ rl1   = rotate_z(deg:0)*translate(0,-40)*rl;
   shape2d@ rl2   = rotate_z(deg:90)*translate(0,-40)*rl;
View pyramid_round.md
// 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;
View a_manyballs_test.md

This is the manyballs performance test using 5x5x5 balls

AngelCAD

13697 > "as_csg"  "manyballs_angelcad.as" -outsub="xcsg" -include="~/.angelcad/libraries" 
as_csg started.

Created XCSG file: xcsg/manyballs_angelcad.xcsg
as_csg v1.3-00 finished, time used: 0d 00h 00m 00.012s
You can’t perform that action at this time.