Pages

Tuesday, June 20, 2017

Line and Polyline modules in OpenSCAD

Polygon in OpenSCAD

The polygon function of OpenSCAD is very cool but for some applications it just doesn’t cut it. For instance when polygon is used to draw a Starpolygon, a self intersecting polygon, the space between the polygon lines is filled, an undesired effect that cannot be negated. In case of the Starpolygon we just want to see the lines.

Line and Polyline

Luckily we can create our own polygon module in OpenSCAD that meets our needs. However before we can create a polygon we need to be able to create a single line. Also a single line can be created in OpenSCAD, actually in several ways. In the YouTube video below I'll show one such approach.

A Vase created with line, polyline and rotate_extrude in OpenSCAD.

Furthermore I’ll show how to create a line module and a polygon module that fit our needs but it doesn’t stop there. With the line and polyline a complete 2D-library in OpenSCAD can be created. Also, in combination with linear_extrude and rotate_extrude 3D objects can be created that are impossible to create with CSG alone.



In a next blogpost I’ll show you how to create a Bezier Spline with line and polyline. This Bezier Spline can then be used to create a smooth curve needed in a 3d printable vase for example.

I want to mention Justin Lin here. He has a great website www.openhome.cc where he, not only shares his OpenSCAD work, but also explains it in great detail. I think it’s a very useful resource for OpenSCAD.

The file of this video can be downloaded with the following link: https://drive.google.com/open?id=0Bwg0RBbuN0fMVkJISXdDQV9sekE

OpenSCAD is open source (GPLv2 license) and is well maintained by Marius Kintel et al. Besides the stable releases for Windows, OSX and Linux, development snapshots are available. I recommend using these development snapshots since they have all the latest features. 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.