Skip to content

Instantly share code, notes, and snippets.

View fillet_plates.md
// AngelCAD code. Demonstrate fillet between two plates
// https://arnholm.github.io/angelcad-docs/

solid@ fillet(solid@ obj, double r)
{
   // create a cube enclosing the object completely
   // with an internal void shaped by the object
   boundingbox@ box = obj.box();
   pos3d@ c  = box.center(); 
@arnholm
arnholm / lens.md
Last active Nov 4, 2019
Concave-convex lens from 2 point clouds
View lens.md
shape@ main_shape()
{
   // create 2 convex hull bodies
   solid@ upper =  polyhedron("posterior-lenticle-surface.xyz");
   solid@ lower =  polyhedron("anterior-lenticle-surface.xyz");
  
   // subtract upper from lower to create convex-concave lens body
   return lower-upper;
}
View wishlist.md
  1. Mutable variables. Variables are mutable in AngelCAD, since it is using the AngelScript language. One is not restricted to lists and recursion, but those are also available.

  2. Better data structures. Classes would be beautiful. User defined classes are supported in AngelCAD, also with inheritance. Also a dictionary an a map similar to C++ map.

2b. data structure for polyhedron vertices-and-faces. https://arnholm.github.io/angelcad-docs/docs/classpolyhedron.html

  1. passing functions as a first class object. In AngelCAD one can define function pointers and pass them as arguments https://gist.github.com/arnholm/7061458777913e5795585eee46fcb664 . Obviously, you can also pass handles to instances of user defined classes.

  2. Ability to rename built-in and existing modules/functions. There is namespace support in AngelScript, but adnittedly I have not explored it in much detail

View funcdef.md
// AngelCAD code, showing use of function pointer

funcdef double CALLBACK(int i);

solid@ object(CALLBACK@ f,int i) 
{ 
   return sphere(f(i)); 
}
@arnholm
arnholm / csg_wikipedia.md
Last active Aug 16, 2019
csg_wikipedia - Constructive Solid Geometry
View csg_wikipedia.md
// AngelCAD code sample: csg_wikipedia.as
// https://en.wikipedia.org/wiki/Constructive_solid_geometry
// https://arnholm.github.io/angelcad-docs/

shape@ main_shape()
{
   // intersection of cube and sphere
   cube@       cu = cube(size:45,center:true);
   sphere@     sp = sphere(r:30);
View bracelet_1.md
View 1_openscad_polygon.md

We use AngelCAD to generate OpenSCAD input :-)

Generate a polygon witn N sides, from an array of positions

// AngelCAD code: openscad_polygon.as
shape@ main_shape()
{
   // build an array from np points
   array<pos2d@> p;
View boundingbox1.md
View melting.md
@arnholm
arnholm / wikipedia_csg.md
Last active May 6, 2019
AngelCAD code for Wikipedia CSG model
View wikipedia_csg.md
You can’t perform that action at this time.