Credit: http://openscad.org
OUR EXPERT
Tam Hanna’s minimal creative capability makes him ideally suited to teaching all kinds of workarounds for problems that require the use of creativity.
OUR EXPERT
Tam Hanna’s minimal creative capability makes him ideally suited to teaching all kinds of workarounds for problems that require the use of creativity.
Part two!
Catch up by ordering back issues on page 58!
Part two!
Catch up by ordering back issues on page 58!
The experiments performed in last month’s tutorial proved that OpenSCAD can create T all kinds of models consisting of primitive geometries. This is a complete understatement – in this instalment, we are modifying our approach to use 2D/3D-combinatorial techniques.
When applied correctly, they permit the creation of highly intricate models with what, in practice, could not be a more straightforward set of base geometries. While this might initially sound confusing, please take our word that nothing is quite as complex as it seems.
Incidentally, the object created in the following steps can be, and has been, used for practical purposes. When Tam needs to provide a set of cigars or candy sticks to his clients, these 3D-printed objects not only catch attention but also serve as a great first demonstration of the additive-manufacturing capabilities of his company.
Should you continue to work directly from the excursus in the last issue, click the menu option File > New File to start a new design. For reasons of simplicity, we will start afresh – our first victim, then, is the following bit of code:
centeredtri();
module centeredtri(){
polygon([[-0.866,-0.5], [0.866, -0.5], [0, 1]]);
}
The core of the method is an invocation of polygon with an array of three points; the mathematically inclined will quickly recognise that it creates an equilateral triangle.
Using the module syntax permits the geometry to be boxed up for use – the invocation centeredtri(); motivates the parser to create the geometry contained in the module.
Interestingly, the screenshot (above-right) shows that performing a preview and the production rendering now yield entirely different results.
For now, it suffices to say that methods such as polygon – incidentally, quite a few additional ones can be found in the documentation at https://en.wikibooks. org/wiki/OpenSCAD_User_Manual/2D_Primitives – create two-dimensional objects. When a preview rendering is done, the parser assigns them some height in the direction of the Z axis to yield a more satisfying rendering. Our next job involves the creation of three instances of the triangle: