After short time playing with OpenSCAD I have to say I am amazed since I tried it.
I gues this is due to the concept of programming objects through a script, ans in addition this reminds me a lot stuf I did with POV (Persistence of Vision Raytracer) back in the early 90s.
This week I made a simple object, but practical.
The cork of my oil container (a very typical shape in Catalonia, see below) is broken and I need a replacement. Why not in PLA?
And by the way, I can do it with improvements.
So caliper at hand and let’s work to get measurements.
In OpenSCAD this is a simple cylinder. You can specify the size of both cylinder faces so make elements with angle, at the limit you can make a cone.
cylinder(h=10,r1=5, r2=0, center=true);
(code for a cone)
Then comes when you make things more complicated.. .time for an upgrade. The upgrade of a cork is just adding a hole that lets the air in and the oil leak with continuity.
This is just another small cylinder and by difference with the bigger one you obtain the hole.
Next teak comes in the hole positioning. I did not want it in the center but in the side and with the same angle of the cork. Easy and quick, just trial and error modifying the angle parameter until you get it right.
But as i had the intention to upload the object to Thingiverse, I wanted to leave it with input parameters.
And this means the angle and position of the hole needs to be formula calculated.
Well, here google is our friend as always to refresh memory of maths quite buried in my brain. Finally, arctan is what I need.
With the translation of the hole in the cork face I have to do something similar to ensure it stays near the edge according to the input measurements.
radius1=29/2; //larger width radius
radius2=24.5/2; //shorter width radius
height=21.4; // height
angle=atan((radius1-radius2)/height);//angle for the air hole
cylinder(h=height,r1=radius1, r2=radius2, center=true);
The oil container and the upgraded cork
You can find it here in Thingiverse.
To finish, I still need to modify the code to be able to use Customizer.
If you don’t know it it is worth having a look, really recommended. By following defined rules Customizer is able to identify the input parameters for an OpenSCAD object, and the values range for each one. So any user, with no knowledge at all of the program, can modify the object in the Thingiverseweb to suit his own needs based on the parameters defined by the designer. After that it generates the STL file for you.
I printed in PLA. It is not ideal but I read that it is better than ABS if in contact with food.