Skip to content

Instantly share code, notes, and snippets.

View arnholm's full-sized avatar

Carsten Arnholm arnholm

View GitHub Profile

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 p;
@arnholm
arnholm / aclib_sign_generator.md
Last active April 30, 2019 22:03
Demonstration of text fonts in AngelCAD library 'aclib'
// AngelCAD code: aclib_sign_generator.as
// 
// This sample requires the https://github.com/arnholm/aclib 
// library to be installed in the AngelCAD libraries folder.

// select the font to use from one of the available
#include "aclib/fonts/LiberationSerif_Bold.as"

shape@ main_shape()

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
// 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;
// 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;
// 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 = 
 {
// 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;