Skip to content
Sven edited this page Mar 1, 2015 · 2 revisions

API

The following documentation describes the statements and modifiers that are possible to use with OpenScad2D.

Primitives

Circle

circle( <radius>, [<resolution>] );
circle( r=<radius>, [$fn=<resolution>] );
circle( radius=<radius>, [$fn=<resolution>] );

Rectangle

rect( <width>, <height>] );
rect( w=<width>, h=<height>] );
rect( width=<width>, height=<height>] );

Path

Not yet implemented!

path( <x1>, <y1>, <x2>, <y2>, ... );

Modifiers

Modifiers influence the following statement

Translate

translate( <x>, <y> );
translate( x=<x>, y=y );

Rotate

rotate( <angle>, [<origin x>], [<origin y>], [<use radian>] );
rotate( a=<angle>, [x=<origin x>], [y=<origin y>], [rad=<use radian> );
rotate( angle=<angle>, [xorigin=<origin x>], [yorigin=<origin y>], [use_radian=<use radian> );

Scale

scale( <x>, <y> );
scale( x=<x>, y=y );

### Simplify
Produces a simplified geometry using the Douglas-Puecker algorithm.
Coordinates of the simplified geometry will be no more than the tolerance distance from the original. 
Unless the topology preserving option is used, the algorithm may produce self-intersecting or otherwise invalid geometries.

```OpenSCAD
simplify(1, False)
circle(30);

Scope Modifiers

Scope Modifiers influence all it's child statements.

Translation Scope

translate(5, 10) {
  rect(10, 10);

  circle(30);
}

Rotation Scope

rotate(45) {
  rect(10, 10);

  circle(30);
}

Scale Scope

scale(1, 2) {
  rect(10, 10);

  circle(30);
}

Hull Scope

hull() {
  rect(10, 10);

  circle(30);
}

Union

union() {
  rect(10, 10);

  circle(30);
}

Difference

difference() {
  rect(10, 10);

  circle(30);
}

Intersection

intersection() {
  rect(10, 10);

  circle(30);
}