I wanted to 3D-print some Christmas ornaments in the style of the blown-glass ones my parents had. Ryan A. Colyer's Plot Function library made it possible!
Code update Dec 13 '17: I have added an automatic calculation to fit the shape to the cap, but you can still adjust it yourself. Parameters to smooth ripples near the tip and/or cap can improve prinatbility. Several parameters have been moved to an "advanced-tweaks" section so you don't need to worry about them unless you want. Also, I reorganized the code and decomposed it into multiple functions to make it easier to understand if you want to edit it yourself.
(I'll try to come up with a better picture; we don't have a tree yet this year and while we bought a wreath, haven't hung even that so I just looped it over the end of the railing :-)
This is one of my projects imported from Thingiverse. They had an online customizer that was really neat but their server could never keep up with the demand and often wasn't working. But even better, someone integrated that Customizer directly into OpenSCAD. So, download the ornaments2.scad file from this project and from http://www.openscad.org/ download, install, and run OpenSCAD. Open the ornaments2.scad file, open the Customizer pane from Window menu, change any settings you wish, then preview, render, and export to STL.
This screenshot I pasted in isn't showing when I view the instructions, so I also added it to the files:
It is possible to set parameters that will produce shapes that are impossible to print.**
Please review the explanation of the settings (see below) before you begin, especially if you are new to 3D printing and can't tell just by looking whether a shape is likely to print well.
(I understand that leaving parameters is contrary to Thingiverse's best practices; if people find it too problematic, I would be willing to fork a safer version.)
Printer Brand:
Prusa
Printer:
i3 MK2S
Rafts:
No
Supports:
Doesn't Matter
Resolution:
0.15-0.20
Notes:
Print with 0 (none) bottom layers and 0% infill. "Vase mode" worked great except when I needed supports.
I like math best when it's pretty!
The primary shape is essentially the function radius=sin(z) , scaling the top to be 1 (radian).
The round-vs-taper shape control simply raises that sin(z) value to the indicated power. Because sine values are between 0 and 1 in this range, taking the square root with 0.5 puffs up the narrow ends and make it look more like a sphere. A value of 1.0 is the sine function "straight up" ; 2.0 gives sin(z)^2==sin(z)*sin(z) which shrinks the narrow tips even faster.
The ripples are also just the sine, this time as a function of the angle.
Units
OpenSCAD's units, when exported to .stl files, will be interpreted as millimeters by most slicers. If you find it more convenient to specify dimensions in centimeters or inches (I grew up with inches), select that value. All parameters you enter -- including values previously entered -- will be multiplied by 10 for cm or 25.6 for inches (or by 1 for millimeters) in the code.
Shape
The width of the shape is measured at its widest point, not considering any ripples or dimples (see below).
The height of the shape is measured from tip-to-tip. By default, one of those tips is inside the cap, and so this is also the total height of the ornament. (The ornament will be taller if you start the shape outside the cap)
You can also adjust the shape to be more round (set shape control to 0.5) or more tapered (2). (If the image below with examples is broken -- thingiverse seems to be having issues -- look for a copy in the files.)
Effect of Shape Control
Cap
The cap diameter and height should match the ornament caps you use to hang these. The ones I found are 1/2" diameter and between 1/4" and 3/8" tall (ignoring the wire loop). I used 0.25" as the default because the triangular tips that extend to 3/8" looked better against the tapering sides of the shape instead of on straight cylinder sides.
TheCap Shape Transition parameter is important to smooth and support layers between the cylinder and the shape. In the picture below, the default 0.25" transition distance is not enough to prevent pinching of the curvy shape on the right and some of the layers on the round shape on the left would need supports. The two middle images show this transition extended to 0.50" which should make the ornament easier to print.
Improved printability with increased transition distance (middle ornaments)
Cap: Shape Start
When trying to get a spherical ornament, I found that I needed to start the shape at the end (1.0) of the cap instead of the default beginning (0.0) unless I wanted a mushroom. You can also use this parameter to try to tweak curvier shapes to minimize the transition length needed for stable printing.
Effect of Shape Start
Ripples
(Let me know if I need to add documentation beyond what's in the customizer.)
Dimples
(Let me know if I need to add documentation beyond what's in the customizer. The option to Show a preview of the spheres that cut out the dimples should help.)
Quality
I have never had to increase the quality, though you can do so. I did have to decrease the quality when I was going crazy with lots of thick ripples. If the preview doesn't render, try decreasing the quality.
Category: Decor
The author marked this model as their own original creation. Imported from Thingiverse.