cylinder()

The Cylinder() primitive command will add a cylinder or tapered cylinder to your model.

In it’s basic form like the cube() and sphere(), the cylinder() command does not need any parameters.

cylinder();

You can create a cube with the unit measure of 1 by adding the above command, here is the result:

SO while that does not look like a cylinder, according to OpenSCAD it is a cylinder. OpenSCAD forms cylinders using faces. If you would like a smoother looking cylinder you can increase the resulting number of faces by changing the $fn variable.

$fn=25;

The $fn variable, fragment number, with a value of 25 will result in the following object. You can add the $fn before or after the object.

The cylinder in it’s basic form can receive a height and radius.

cylinder(h=5,r=4);

In it’s final form we can create cones and truncated cones. By providing two radii, r1 and r2.

cylinder( h=8,r1=5,r2=1);

2 Replies to “cylinder()”

    • admin

      To make the surfaces of the cylinder more “fine” you can either begin the script with the fn$ variable.

      To apply a number of facets ( i think that is what fn stands for, i forget now ) to all objects, place the $fn variable at top of code.

      $fn=50;

      or to specify the number of facets for an indivual object include it in the object defination:

      cylinder(h=5,r=4, $fn=50);

Leave a Reply

Your email address will not be published. Required fields are marked *