OpenSCAD sample from http://forum.openscad.org/OpenSCAD-performance-numbers-td4707.html
num=20;
for (i=[0:num-1])
rotate([0,0,i*360/num])
translate([40,0,0])
rotate([0,i*90,0])
scale([0.7,1,1])
OpenSCAD sample from http://forum.openscad.org/OpenSCAD-performance-numbers-td4707.html
num=20;
for (i=[0:num-1])
rotate([0,0,i*360/num])
translate([40,0,0])
rotate([0,i*90,0])
scale([0.7,1,1])
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;
Example using boundingbox in AngelCAD.
In this example we read an external model of unknown dimensions and use bounding box to center it on the origin. AngelCAD requires a quality checked model in OBJ,OFF or AMF format, so we use the polyfix utility to first convert from STL to OBJ and heal the model at the same time.
polyfix from https://github.com/arnholm/angelcad
Hook.stl from https://github.com/lar3ry/OpenSCAD---Move-STL-to-origin
polyfix Hook.stl -out=*.obj
Step one, download "gregs-large.stl" from https://www.thingiverse.com/thing:6713/files and convert it into OBJ format and read it into AngelCAD, and "melt" it
AngelCAD language reference https://arnholm.github.io/angelcad-docs/docs/annotated.html
// AngelCAD code.
shape@ main_shape()
// 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()
// 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;