You are on page 1of 2

cube

Creates a cube at the origin of the coordinate system. When center is


true the cube will be centered on the origin, otherwise it is created in
the frst octant. The argument names are optional if the arguments
are given in the same order as specifed in the parameters
Parameters
size
Decimal or 3 value array. If a single number is given, the result will be
a cube with sides of that length. If a 3 value array is given, then the
values will correspond to the lengths of the , !, and " sides. Default
value is #.
center
$oolean. This determines the positioning of the ob%ect. If true, ob%ect
is centered at &',','(. )therwise, the cube is placed in the positive
*uadrant with one corner at &',','(. Defaults to false
Usage examples:
cube&si+e , #, center , false(-
cube&si+e , .#,/,30, center , true(-
sphere
Creates a sphere at the origin of the coordinate system. The argument
name is optional.
Parameters
r
Decimal. This is the radius of the sphere. The resolution of the sphere
will be based on the si+e of the sphere and the 1fa, 1fs and 1fn
variables.
d
Decimal. This is the diameter of the sphere.
$fa
2ragment angle in degrees
$fs
2ragment si+e in mm
$fn
3esolution
44 this will create a high resolution sphere with a /mm radius
sphere&/, 1fn,#''(-
44 will also create a /mm high resolution sphere but this one
44 does not have as many small triangles on the poles of the sphere
sphere&/, 1fa,5, 1fs,'.#(-
cylinder
Creates a cylinder or cone at the origin of the coordinate system. 6
single radius &r( ma7es a cylinder, two di8erent radi &r#, r/( ma7e a
cone.
h
Decimal. This is the height of the cylinder. Default value is #.
r
Decimal. The radius of both top and bottom ends of the cylinder. 9se
this parameter if you want plain cylinder. Default value is #.
r1
Decimal. This is the radius of the cone on bottom end. Default value is
#.
r2
Decimal. This is the radius of the cone on top end. Default value is #.
d
Decimal. The diameter of both top and bottom ends of the cylinder.
9se this parameter if you want plain cylinder. Default value is #.
d1
Decimal. This is the diameter of the cone on bottom end. Default
value is #.
d2
Decimal. This is the diameter of the cone on top end. Default value is
#.
center
boolean. If true will center the height of the cone4cylinder around the
origin. Default is false, placing the base of the cylinder or r# radius of
cone at the origin.
$fa
6ngle in degrees
$fs
6ngle in mm
$fn
3esolution :)T;< d,d#,d/ are only available in version later
than /'#=.'3. Debian is currently 7now to be behind this(
polyhedron
Create a polyhedron with a list of points and a list of faces. The point
list is all the vertices of the shape, the faces list is how the points
relates to the surfaces of the polyhedron.
note: if your version of OpenSCAD is lower than 2014.03 replace
"faces" with "trianles" in the !elow e"a#ples
Parameters
points
vector of points or vertices &each a 3 vector(.
triangles
&$eprecate$ in version 2014.03% use faces( vector of point triplets
&each a 3 number vector(. ;ach number is the '>inde?ed point number
from the point vector.
faces
&intro$uce$ in version 2014.03( vector of point n>tuples with n @, 3.
;ach number is the '>inde?ed point number from the point vector.
When referencing more than 3 points in a single tuple, the points must
all be on the same plane.
convexity
Integer. The conve?ity parameter specifes the ma?imum number of
front sides &bac7 sides( a ray intersecting the ob%ect might penetrate.
This parameter is only needed for correctly displaying the ob%ect in
)penCAB preview mode and has no e8ect on the polyhedron
rendering.
Syntax example
polyhedron&points , . .?, y, +0, ... 0, faces , . .p#, p/, p3..0, ... 0,
conve?ity , :(-
Point ordering for faces When loo7ing at the face from the outside
inwards, the points must be cloc7wise. !ou can rearrange the order of
the points or the order they are referenced in each tuple. The order of
faces is immaterial. :ote that if your polygons are not all oriented the
same way )penAC6D will either print an error or crash completely, so
pay attention to the verte? ordering. 6gain, remember that the Cp:C
components of the faces vector are '>inde?ed references to the
elements of the points vector.
;?ample, a s*uare base pyramid<
polyhedron&
points,. .#',#','0,.#',>#','0,.>#',>#','0,.>#',#','0, 44 the four points
at base
.',',#'0 0, 44 the ape? point
faces,. .',#,=0,.#,/,=0,./,3,=0,.3,',=0, 44 each triangle side
.#,',30,./,#,30 0 44 two triangles for s*uare
base
(-
Succinct description of a 'Polyhedron'
D Eoints defne all of the points4vertices in the shape.
D 2aces is a list of Fat polygons that connect up the points4vertices.
;ach point, in the point list, is defned with a 3>tuple ?,y,+ position
specifcation. Eoints in the point list are automatically given an
identifer starting at +ero for use in the faces list &',#,/,3,... etc(.
;ach face, in the faces list, is defned by selecting 3 or more of the
points &using the point identifer( out of the point list.
e.g. faces,. .',#,/0 0 defnes a triangle from the frst point &points are
+ero referenced( to the second point and then to the third point.
When loo7ing at any face from the outside, the face must list all points
in a cloc7wise order.

You might also like