Using OpenSCAD to model 3D structures
|
Conclusions
It only takes a few lines to generate complex geometric structures with OpenSCAD. Thanks to the STL transformation, other programs can also understand the results. Most of the Slicer programs can successfully implement the results for a 3D print provided the user specifies the dimensions for the length.
The 3D renderer Blender dresses up the SLT models with lighting effects and reflections and in doing so utilizes the dimensional accuracy of the models. If you are thinking of trying OpenSCAD out online without installing it, you should take a look at Openjscad [6].
Listing 3
Plotting Earthquakes
$fn=100; $vpd=5500; // camera distance $vpr=[88,0,300]; // camera orientation r=1000; // Radius // The file eq03.scad contains two arrays // with the positions (eqlock) and the derivative // sizes for earthquake magnitude and depth (eqspec). include <eq03.scad> // coordinates of some selected points plock=[ [52, 13, 0], // Berlin [48, 11, 0], // Munich [35, 139, 0], // Tokyo [21, -157, 0] // Honolulu ]; // Designation of the selected points plockname=["Berlin", "Munich", "Tokyo", "Honolulu"]; // Output for eqlock and eqspec for (i=[0:len(eqlock)-1]){ translate(ku2ka(eqlock[i])) color([eqspec[i][0],1-eqspec[i][0],0]) sphere(eqspec[i][1]); } // Output of the selected points for (i=[0:len(plock)-1]){ translate(ku2ka(plock[i])) color("black") sphere(10); translate(ku2ka(plock[i])) color("black") text(text=plockname[i], size=30); } sphere(450); //draws inner sphere grid(15); //draws grid // transforms sphere coordinates into function ku2ka(v)= [ cos(v.y) * (r-v.z) * sin(90-v.x), sin(v.y) * (r-v.z) * sin(90-v.x), (r-v.z) * cos(90-v.x)]; // draws a height and width grid module grid(d=30){ mirrorc() rotate_extrude(){ for (i=[0:d:85]){ a= ku2ka([0,i,0]); translate(a) circle(5); }; }; for (i=[0:d:185]) rotate([0,0,i]) rotate([90,0,0]) rotate_extrude() translate([r,0,0]) circle(5); } // Help module, for mirroring a block module mirrorc(v=[0,0,1]){ children(); mirror(v) children(); };
Infos
- Downloading OpenSCAD: http://www.openscad.org/downloads.html
- Library for Lego Bricks: http://www.thingiverse.com/thing:178627
- Photograph of a key: https://commons.wikimedia.org/wiki/File:Zwei_gleiche_Schl%C3%BCssel_von_Abus.JPG?uselang=de
- Earthquake data: http://earthquake.usgs.gov/earthquakes/
- Command overview: http://www.openscad.org/cheatsheet/index.html?version=2015.03
- OpenJSCAD: http://openjscad.org
« Previous 1 2 3 4 Next »
Buy this article as PDF
Pages: 6
(incl. VAT)