is it possible to print one piece spheres with a hole of a specific size?
thank you
Printable View
is it possible to print one piece spheres with a hole of a specific size?
thank you
Yes. But you need to start with a solid model that's watertight.
Fire up OpenScad and put this code in... You will get what you want.
Attachment 6060
I was able to draw a sphere with the "follow me" tool in Sketchup.
The details are in the Sketchup knowledge base.
You may need to draw 2, an inner wall and an outer wall.
You can easily draw a circle on the surface and push it through the 2 walls with the extruder tool.
hey roxy,
this is fun. i like entering code to get models or a mesh i guess. new to all this. the openscad user manual seems well written. this is making sense.
i played with the code you gave me because i need a sphere with one hole only.
i was able to accomplish this as shown, but had some questions.
i don't understand why the second hole would not disappear until i reduced the cylinder height to 60
and how is this connected to the translate variables?
and i was wondering what makes the cylinder a child of the sphere?
Attachment 6075
Normally, it is easier to see what is going on in OpenScad. But you picked a particularly difficult idea to see. However, if you go back to the original code I posted I'll walk you through it. Grab that original code and put it back into OpenScad. Then change this line to have a # in front of it:
# translate([0,0,-50]) cylinder(r=5, h=100,$fn=50);
When ever you put a # in front of something it will display that object. So you will see a cylinder translated down to z=-50 and going up to z=+50. That object is being subtracted from the hollow sphere. You might have to do a Design/Render followed by a View/Animate to see the # object.
You can't see inside of the hollow sphere very well, but you could make it so you just get one hole by changing that line to:
# cylinder(r=5, h=100,$fn=50);
Now the cylinder is just as tall but it starts with its bottom at the origin. If you want to see inside the sphere and how the cylinder is positioned, you might try cutting away the first quadrant. Try this code so you can look inside:
sphere_with_holes();
module sphere_with_holes() {
difference() {
sphere(r=20, $fn=40);
sphere(r=18, $fn=40);
#cylinder(r=3.375, h=100, $fn=50);
cube([500,500,500]); // cut away the 1st quadrant
}
}
Well, nicely defined by the code....I will try this code later. Generally, as a standard printer needs directions to let it know what to do ordinarily from some kind of word preparing archive the printing.Quote:
# translate([0,0,-50]) cylinder(r=5, h=100,$fn=50);
When ever you put a # in front of something it will display that object. So you will see a cylinder translated down to z=-50 and going up to z=+50. That object is being subtracted from the hollow sphere. You might have to do a Design/Render followed by a View/Animate to see the # object.
You can't see inside of the hollow sphere very well, but you could make it so you just get one hole by changing that line to:
# cylinder(r=5, h=100,$fn=50);
Now the cylinder is just as tall but it starts with its bottom at the origin. If you want to see inside the sphere and how the cylinder is positioned, you might try cutting away the first quadrant. Try this code so you can look inside:
sphere_with_holes();
module sphere_with_holes() {
difference() {
sphere(r=20, $fn=40);
sphere(r=18, $fn=40);
#cylinder(r=3.375, h=100, $fn=50);
cube([500,500,500]); // cut away the 1st quadrant
}
}
couple of things that should make it easier.
You can use diameters instead of radii. This means that you don't have to mentally double the size of a sphere or cylinder every time you want one.
That and putting a module before you've defined it - make no sense to me :-)
I'm not a programmer, so a lot of the ways other people use openscad just strikes me as confusing and the wrong way round.
But that's the beauty of openscad - everyone can use it the way that makes sense to them.
Also for a rounder shape use a higher '$fn=' value.
I usually use the max: $fn-100;
Which gives you very round things. Takes a little longer to f6 render. But the models are better.
Another thing you can do is to use variables to create parametric objects.
Because I used variables - whenever you change one of the numbers - the other automatically adapt.Quote:
$fn=100;
sd=10; //sphere diameter
wt=2; // thickness of sphere wall
hs=3; // hole size
difference() {
sphere(d=sd); //create sphere with diameter set by sd
sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
translate([0,0,-sd/2])cylinder(d=hs,h=wt*4); // remove hole from bottom of sphere - diameter defined by hs
}
Also for printing you want the sphere to be hole down.
The other thing that I find essential is to put a lot of coments into a script.
// can be put anywhere to write a comment to explain what you've done. Otherwise you'll come back to a script and it won't make any sense at all :-)
I know the maths can probably be improved - but the above script does work :-)
howdy folks,
sorry for the delay in responding. thank you for everyone's input.
thank you, curious aardvark, for your suggestions. i was about to post where i had gotten to when i saw your post and knew i should
rework my approach. using variables as you did makes it easier to enter the variables that one uses and receives from the formula.
also creating the sphere upside down. thanx...
there are two sphere types i am concerned with. one with just a sound hole and one with a hollow cylindrical neck as a sound hole.
here is the scad code for the first one, adapted with your help.
here was my approach for spheres with a neck.Quote:
// Spherical Resonator
// The formula below can be entered into a
// calculator that can do expressions, like google,
// and the result will be the diameter of the sphere in meters.
// 17.87*((d/(f^2))^(1/3))
// Where:
// d= diameter of sound hole in meters
// f= frequency(Hz)
// Example: A 220Hz
// in millimeters
$fn=100;
sd=143.38; //sphere diameter
wt=2; // thickness of sphere wall
hs=25; // hole size
difference() {
sphere(d=sd); //create sphere with diameter set by sd
sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
}
i attempted to use your variable approach for the neck in the following manner and was unsuccessful.Quote:
// Spherical Resonator With Neck
// The formula below can be entered into any
// calculator that can do expressions, like google, and the
// result will be the diameter of the sphere in meters.
// ((3*(d^2)*(343.59^2))/(8*L*(f^2)*(3.14^2)))^(1/3)
// Where:
// d= diameter of sound hole in meters
// L= length of the neck in meters
// f= frequency(Hz)
// Example: A 220Hz
// in millimeters
//Sphere
difference() {
sphere(r=68.24, $fn=40);
sphere(r=66.24, $fn=40); // The radius of the second sphere is the target radius
cylinder(r=12.5, h=68.24, $fn=50); // The height of the cylinder is the radius of the first sphere
}
//Neck
difference() {
translate([0,0,66.24]) // Cylinders are translated the radius of the second sphere.
cylinder(r=14.5, h=25, $fn=50);
translate([0,0,66.24])
cylinder(r=12.5, h=25, $fn=50); // Second cylinder radius is the target radius.
}
and thank you roxy. your help gave me a base to work from and the courage to think i could actually do this.Quote:
$fn=100;
sd=132.48; //sphere diameter
wt=2; // thickness of sphere wall
hs=25; // hole size
ln=25; // length of neck
//Sphere
difference() {
sphere(d=sd); //create sphere with diameter set by sd
sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
}
//Neck
difference() {
translate([0,0,-sd/2])cylinder(d=hs+wt,h=ln);
translate([0,0,-sd/2])cylinder(d=hs,h=ln);
}
"most magic tricks are easy once you know the secret"
-marshall broudien
I see what you mean the neck shouldn't be that hard to fit to the hole.
Right try this:
Basically you have to move the cylinder by it's own height and then by half the diameter and then by the wall thickness. If you see I've got % in front of the sphere script. This makes the sphere transparent so you can see where the cylinder actually is. Very useful.Quote:
$fn=100;
sd=132.48; //sphere diameter
wt=2; // thickness of sphere wall
hs=25; // hole size
ln=25; // length of neck
//Sphere
%difference() {
sphere(d=sd); //create sphere with diameter set by sd
sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
}
//Neck
difference() {
translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs+wt,h=ln);
translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs,h=ln);
}
But you must remove the '%' before f6 rendering, otherwise it ignores everything with % in front of it.
so final renderable script:
Attachment 6210Quote:
$fn=100;
sd=132.48; //sphere diameter
wt=2; // thickness of sphere wall
hs=25; // hole size
ln=29; // length of neck
//Sphere
difference() {
sphere(d=sd); //create sphere with diameter set by sd
sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
}
//Neck
difference() {
translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs+wt,h=ln);
translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs,h=ln);
}
Looks like a classic anarchist's bomb All we need is a plug, some black powder and a fuse :-)
Also looks like the gourd Asterix carries his magic potion in :-)
reminds me of the bombs in the game stratego and of course these two instruments
balifon
Attachment 6214
timbila with an unseen necked sound hole and a membrane covered trumpet
Attachment 6215
tanx eh?
oh, and i haven't met this asterix individual of which you speak.
a couple thoughts came to mind.
the inner diameter of the sphere is the target diameter.
so i added twice the wall thickness to the diameter of the first sphere.
also, if a 25mm long neck is placed on top of a 2mm thick sphere
the effective length of the neck will be 27mm. so i tried
subtracting the wall thickness from neck length for the cylinder height.
seems functional.
also, aren't variables actually constants? sorta like constant variables...
// Example: A 220Hz
$fn=100; // fragment number
sd=132.48; // sphere diameter from formula
wt=2; // wall thickness
hd=25; // sound hole diameter
nl=25; // neck length
// Sphere
difference() {
sphere(d=sd+(2*wt)); // create sphere to be hollowed
sphere(d=sd); // hollow the sphere to diameter from formula
translate([0,0,-(sd/2)-wt])cylinder(d=hd,h=wt*2); // create sound hole
}
// Neck
difference() {
translate([0,0,-nl-(sd/2)+wt])cylinder(d=hd+(2*wt),h=nl-wt);
translate([0,0,-nl-(sd/2)+wt])cylinder(d=hd,h=nl-wt);
}
yeah if you want to be pedantic they're not what programmers call variables. I call them variables because you can vary them and I'm not a programmer and couldn't give a rats arse what the technical term should or shouldn't be:-)
length of neck would probably be 25mm.
You have to embed the neck into the shell to form a solid join. It doesn't actually sit directly on top of the hole. It wouldn't seal if you did that.
Seriously you've never heard of Asterix The Gaul ?
https://en.wikipedia.org/wiki/Asterix_%28character%29
One of the big 'flaws' in OpenScad was the fact symbols could not change value. The current version has addressed this issue. I'm not sure the OpenScad people would call those 'variables', but they are getting pretty close to that now.
it's not a flaw if you're not a programmer :-)
The biggest issue with the new version I've got is it can't render more than about 6 facets (okay maybe 6,000).
Trying to make a golf ball (I have my reasons lol) and it just crashes long before I even get close to a decent number of dimples.
Worse than the pinboard.
Just signed up for the openscad 'forum' - not a frigging forum it's a bloody mailing list.
I really don't want a thousand bloody emails a day from openscad. And from what I've seen I can't post without signing up to the poxy mailing list.
Think I'm going to reinstall an older version and see if it can handle basic iterations.