For command line options see the RapCAD manual

Basic Values

Number

Example
a=1;
b=5.1;
c=-0.6;

Text

Example
a="Hello World!";

Boolean

Examples
a=True;
b=False;

Vector

In RapCAD commas are not allowed at the end of a vector because it it often a sign of error.

Examples
a=[,10,10]; // means [undef,10,10]
b=[10,10];  // means [10,10]
c=[10,,10]; // means [10,undef,10]
d=[10,10,]; // syntax error use [10,10,undef] <1>
  1. Since index out of bounds errors are not desired, RapCAD will treat vectors containing less elements than expected as though the elements exist but are undefined. Thus if we expect a 3D vector, but are given a 2D vector such as [10,10] RapCAD will treat this as [10,10,undef] you can therefore treat [10,10,undef] as synonymous to [10,10] so in the example above you could simply write d=[10,10] if you prefer.

Range

Examples
a=[1:5];    // 1,2,3,4,5
b=[0:2:10]; // 2,4,6,8,10

3D Primitives

RapCAD supports a set of built in 3D primitives. The primitives are modules that take arguments which specify the size and shape of the primitive. A module is instanciated by writing its name followed by parenthesis which enclose the arguments. Since it is also a statement it must be followed by a semicolon.

Cube

Examples
cube(size,center);
cube(s,c);

Sphere

Examples
sphere(radius);
sphere(r);

Cylinder

RapCAD suports legacy r1 and r2 parameters on cylinder. The Cone module is more appropriate for drawing cones.

Examples
cylinder(radius,height,center);
cylinder(r,h,c);

Cone

Examples
cone(radius1,radius2,center);
cone(r1,r2,c);

Prism

Examples
prism(height,sides,apothem);
prism(height,sides,radius);

Polyhedron

RapCAD supports a legacy triangles parameter, but the name is a bit misleading since polygons with more than three points can be specified using this parameter. The name surfaces was chosen in preference to polygons so as not to have a single letter name conflict with points.

Examples
polyhedron(points,surfaces);
polyhedron(p,s);

2D Primitives

Square

Examples
square(size,center);
square(s,c);

Circle

Examples
circle(radius);
circle(r);

Polygon

RapCAD supports a legacy parameter paths this however conflicts with the single letter parameter name points.

Examples
polygon(points,lines);
polygon(p,l);

Polyline

Examples
polyline(points);

Bezier Surface

Examples
bezier_surface(mesh);

Control modules

Echo

The echo module allows you to debug values that are evaluated as part of your script. You can pass more than one argument to echo and it will be output to the console. Named arguments are allowed but the names will not be echo’ed.

Examples
echo(53+9);
echo([32,24,10]);
echo(a=1,b=2);

Bounds

Examples
bounds()cube(10);

Child

Examples
child();

Operations

Union

Examples
union() { module1(); module2(); }

Group

Examples
group() { module1(); module2(); }

Difference

Examples
difference() { module1(); module2(); }

Symmetric Difference

Examples
symmetric_difference() { module1(); module2(); }

Intersection

Examples
intersection() { module1(); module2(); }

Minkowski Sum

Examples
minkowski() { module1(); module2(); }

Glide

Examples
glide() { module1(); module2(); }

Hull

Examples
hull() { module1(); module2(); }

Sub Division

Examples
subdiv() module1();

Transformations

Linear Extrude

Examples
linear_extrude(h=10) square([10,10]);

Mirror

Examples
mirror() translate([0,20,0]) cylinder(r=5,h=10);

Offset

Examples
offset() module1();

Rotate

Examples
rotate([0,0,90]) module1();

Scale

Examples
scale([0.1,0.1,0.1]) module1();

Shear

Examples
shear() module1();

Translate

Examples
translate([0,20,0]) module1();

Compiling

The following instructions will allow you to compile RapCAD from source on various platforms.

Prerequisites

The source code is hosted in a git repository so you might want to install git first

linux
sudo apt-get install git-core

Linux

Dependencies
sudo apt-get install g++ libcgal-dev libqt4-dev bison flex
dxflib
wget ftp://anonymous:anonymous@ribbonsoft.com/archives/dxflib/dxflib-2.2.0.0-1.src.tar.gz

tar -xzf dxflib-2.2.0.0-1.src.tar.gz &&
cd dxflib-2.2.0.0-1.src &&
sed "s/<string>/<string.h>/" -i src/*.h &&
CFLAGS=-fPIC ./configure --prefix=/usr &&
make depend &&
make &&
gcc -shared -Wl,-soname,libdxflib.so.2 -o lib/libdxflib.so.2.2.0 src/*.o &&
sudo make install &&
sudo install -m 644 lib/libdxflib.so.2.2.0 /usr/lib &&
sudo ldconfig -n /usr/lib
RapCAD
git clone git://git.rapcad.org/rapcad

cd rapcad &&
qmake &&
make

Windows

MinGW

  • Download the MinGW Automated installer package mingw-get-inst-20111118.exe

  • Check the C++ compiler checkbox.

  • Check the msys checkbox

  • Install to C:\MinGW\

Qt (MinGW)

CMake

  • Download CMake installer cmake-2.8.7-win32-x86.exe

  • Check the Add cmake to the system path for the current user checkbox

  • Install to default location C:\Program Files\CMake 2.8

Boost

  • Download Boost source boost_1_49_0.zip

  • Extract all to C:\ (sources will end up in C:\boost_1_49_0\ )

  • Use the QT Development Command Prompt
    Start→Program Files→Qt by Nokia v4.8.0 (MinGW OpenSource)→QT 4.8.0 Command Prompt

cd C:\boost_1_49_0\
bootstrap.bat
.\bjam toolset=gcc release thread
CGAL
https://gforge.inria.fr/frs/download.php/30386/CGAL-4.0-Setup.exe
Note
CGAL-4.0-Setup.exe is not a binary distribution, just an installer that installs the source.
  • No need for CGAL Examples and Demos

  • Make sure mpfr and gmp precompiled libs is checked

  • Install to C:\CGAL-4.0\

  • Make sure CGAL_DIR environment checked.

  • Use the QT Development Command Prompt
    Start→Program Files→Qt by Nokia v4.8.0 (MinGW OpenSource)→QT 4.8.0 Command Prompt

set PATH=%PATH%;"C:\Program Files\CMake 2.8\bin"
cd "C:\CGAL-4.0\"
cmake -G"MinGW Makefiles" -DBOOST_ROOT="C:\boost_1_49_0" -DBOOST_LIBRARYDIR="C:\boost_1_49_0\bin.v2\libs\thread\build\gcc-mingw-4.6.2\release\threading-multi\" .
make
dxflib
ftp://anonymous:anonymous@ribbonsoft.com/archives/dxflib/dxflib-2.2.0.0-1.src.tar.gz

Mac OS X 10.6.2

Xcode 3.2

Register with apple and download Xcode 3.2.2. Install the package accepting the default options.

MacPorts

Download the MacPorts Installer. Install the package accepting the default options.

Dependencies
sudo port install cgal qt4-mac
dxflib
tar -xzf dxflib-2.2.0.0-1.src.tar.gz &&
cd dxflib-2.2.0.0-1.src &&
./configure --prefix=/opt/local &&
make depend &&
make &&
sudo make install
RapCAD
qmake CONFIG+=official
make
cp -R /opt/local/lib/Resources/qt_menu.nib rapcad.app/Contents/Resources/
macdeployqt rapcad.app -dmg
hdiutil internet-enable -yes rapcad.dmg