Todays OpenSCAD tips and tricks starts with a circle that looks like a hexgon, but we will fix that later.
circle(r = 1);
translate([2, 0, 0])
circle(r = 1);
Now we can perform a linear extrude to produce a cylinder.
linear_extrude(height = 10, center = true, convexity = 10, twist = 0)
translate([2, 0, 0])
circle(r = 1);
The twist parameter appears to be left handed and is in units of degrees. A parameter of twist=360 will extrude one full rotation around the Z-Axis.
linear_extrude(height = 10, center = true, convexity = 10, twist = -100)
translate([2, 0, 0])
circle(r = 1);
Here is a twist of 100 degrees.
linear_extrude(height = 10, center = true, convexity = 10, twist = 100)
translate([2, 0, 0])
circle(r = 1);
A -500 degree twist shows how the 2d projection on the X-Y Plane is swept around the Z-Axis. The extrusion of the 2D shape is not perpendicular to the path of extrusion.
linear_extrude(height = 10, center = true, convexity = 10, twist = -500)
translate([2, 0, 0])
circle(r = 1);
If center = false the extrusion will start at the position of the original circle. If center = true then after extrusion the solid will be centered after extrusion.
linear_extrude(height = 10, center = false, convexity = 10, twist = -500)
translate([2, 0, 0])
circle(r = 1);
The shape of the circle can be improved by setting one of the special parameters $fn, $fs, and $fa. $fn is the number of fragments, $fs is the size of the fragments and $fa is the angle of the fragments.
linear_extrude(height = 10, center = false, convexity = 10, twist = 360)
translate([2, 0, 0])
circle(r = 1, $fn=100);
The shape of the extrusion can be improved by setting the $fn parameter of the extrude and this value is passed to the shape of the circle.
linear_extrude(height = 10, center = false, convexity = 10, twist = 360, $fn=100)
translate([2, 0, 0])
circle(r = 1);
The slices parameter is similar to the $fn special variable, expect it does not apply to the 2D shape.
linear_extrude(height = 10, center = false, convexity = 10, twist = 360, slices=100)
translate([2, 0, 0])
circle(r = 1);
A rotational extrusion of the circle will produce a torus.
rotate_extrude(convexity = 10)
translate([2, 0, 0])
circle(r = 1);
Similarly to a linear extrude, the rotational mesh results can be refined.
rotate_extrude(convexity = 10)
translate([2, 0, 0])
circle(r = 1, $fn=100);
Further refinement is possible and increases the amount of time required to compile and render the model.
rotate_extrude(convexity = 10, $fn=100)
translate([2, 0, 0])
circle(r = 1, $fn=100);
The convexity parameter is best explained by the following image.
The OpenSCAD manual has been updated to include these examples.
Hopefully in the future there will be a way to produce helical sweeps so threaded parts such as worm gears can be produced.
3 comments:
Excellent tutorial.
Is there a parameter to modify the helix_radius formed by 'twist'?
translate([2, 0, 0])
sets the radius of the helix
Post a Comment