Skip to content

Instantly share code, notes, and snippets.

View USB-winkeler.md
// AngelCAD code: USB-winkeler.as
// https://arnholm.github.io/angelcad-docs/
// (Adapted from USB-Winkeler-bug.scad by Dietrich)

// calbe diameter
double d1 = 5;
// 90º Radius
double r1= 20;
//wall thickness
View Repairing bad STL using AngelCAD polyfix.md

Original problem using OpenSCAD to import an STL fils

union()
{
  translate([0, 0, 6])
  scale([0.9842519685, 0.9842519685, 1])
  import("floor.stl");
  cube([50, 50, 6]);
}
View intersection_box.md
// AngelCAD code.

shape@ main_shape()
{
   // create cube & sphere in default positions
   double d = 100;
   solid@ mycub = cube(size:d);
   solid@ mysph = sphere(r:d*0.8);
View main.cpp
#include <iostream>
using namespace std;
#include "cf_serial/cf_serial_simple.h"
int main(int argc, char **argv)
{
try {
cf_serial_simple serial("COM8");
@arnholm
arnholm / minkowski3d_3_1.md
Last active Feb 9, 2020
minkowski3d_3.as - Demonstrates 3d filetting using minkowski
View minkowski3d_3_1.md
// AngelCAD sample: minkowski3d_3.as
// Demonstrates 3d filetting using minkowski3d

solid@ object(double sz)
{
   // cuboids extending in 3 axis directions
   return   translate(-sz,0,0) * cuboid(2*sz,sz,sz)
          + translate(0,-sz,0) * cuboid(sz,2*sz,sz)
          + cuboid(sz,sz,2*sz);
View minkowski_ball.md
// 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;
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)); 
}
You can’t perform that action at this time.