Trouble with a hollow sphere
September 04, 2014 07:13PM
I am new to this, so please be patient....

I would like to create a hollow 1" sphere with a 1mm hole running through it (think: bobber to attach the boat keys to). To that end, I have gotten this far:
(The CODE tags seem to edit the formatting a bit - sorry)

union ()
	{
		difference ()
			{
				sphere(12.7,$fn=100,center=true);
				cylinder(55,.75,.75,$fn=100,center=true);
			}
		difference ()
			{
				cylinder(25.4,1,1,$fn=100,center=true);
				cylinder(55,0.75,0.75,$fn=100,center=true);
				
			}
	}

That creates the sphere with a "tube" in the middle that would seal the hollow interior but allow the attachment for the keyring to run through the middle.

No matter what I do, however, I can't get the rest of the sphere to be hollow (1-2mm walls). When I slice it with Slic3r, the interior is solid.

Anyone have any advice on how to achieve this?

Thanks in advance,

Andy


"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"

-Stephen Hawking
Re: Trouble with a hollow sphere
September 04, 2014 11:54PM
to make a sphere hollow, you need to difference it with another smaller sphere:
difference() {
    sphere(r=10, center=true);
    sphere(r=9, center=true);
}


and the sphere will be hollow with 1 millimeter walls. To do the while thing:

union() {
    difference() {
        sphere(r=10, center=true);
        sphere(r=9, center=true);
        cylinder(r=1, h=21, center=true);
    }
    difference() {
        cylinder(r=2, h=20, center=true);
        cylinder(r=1, h=21, center=true);
    }
}
I made the subtracted cylinders height 21 just so there was no issue with coincident faces at the top and bottom. This will give you a hollow sphere with a tube down the center. All walls will be 1mm.

You might have to play around a bit with the height of the tube. It will probably extend outside the sphere at its outer perimeter, but reducing the length a bit will solve it.

Edited 2 time(s). Last edit at 09/04/2014 11:57PM by jbernardis.
Re: Trouble with a hollow sphere
September 05, 2014 03:03PM
Thanks for that! It worked. I think I just need to figure out the order that things go in. It will get easier as time goes on.


"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"

-Stephen Hawking
Re: Trouble with a hollow sphere
September 17, 2014 11:10AM
I find using modules helps me keep in my head what I am doing. Instead of getting the central cylinder the exact length, I made it far too long so it protrudes and trimmed it off with a "negative shape" afterwards.
N.B. - OpenScad will not make a correct STL from this design because it has a completely enclosed void which OpenScad's STL convertor won't handle correctly.
If you need an STL, puncture the outer sphere with a very tiny hole so the void is not completely enclosed. A very small hole (e.g.0.01mm) will be ignored by many processes (e.g. 3D printing).

Here's my solution for that design ...


// This creates the desired object
// The hollow cylinder is made far too long but trimmed off afterwards by the "SphereN" module

difference()
{
union()
{
HollowSphere();
cylinder(r=5,h=250,center=true);
}
cylinder(r=4,h=251,center=true);
SphereN();
}


// This creates the basic hollow sphere
module HollowSphere()
{
difference()
{
sphere(r=10,center=true);
sphere(r=9,center=true);
}
}

// This creates a large solid block with a void the size of the outer sphere to subtract and clean up
module SphereN()
{
difference()
{
cube([500,500,500],center=true);
sphere(r=10,center=true);
}
}


Dave
Re: Trouble with a hollow sphere
September 17, 2014 12:25PM
@Dave: I was suprised to find that OpenSCAD did indeed not create a proper STL file.

Use the following code to create a proper STL file:
// This creates the basic hollow sphere
module HollowSphere()
{
	difference()
	{
		sphere(r=10,center=true);
		sphere(r=9,center=true);
	}
}

module TopSphere()
{
	difference()
	{
		HollowSphere();
		translate([0,0,-50])
			cube([100,100,100], true);
	}
}

TopSphere();

rotate([180,0,0])
	TopSphere();


Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
Re: Trouble with a hollow sphere
September 18, 2014 11:21AM
Hmm - making it from two halves did appear to generate a correct STL when I viewed it in a different application - however OpenScad failed to import its own generated STL!

Dave
Re: Trouble with a hollow sphere
September 18, 2014 02:29PM
That is why you have to load it in another program (such as netfabb Basic), repair the file and then save the repaired object.
THEN OpenSCAD can load it.
A lot of extra work but at least it gets around the problem.


Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
Re: Trouble with a hollow sphere
September 22, 2014 08:36PM
And yet, when I exported the orginal suggestion as an STL and loaded it into Repetier Host, it seemed to work. I sliced it with Slic3r and went through the layers and all looked ok.

What am I missing here?


"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"

-Stephen Hawking
Re: Trouble with a hollow sphere
September 23, 2014 04:36AM
It depends on the program.
If you use netfabb Basic you can see that STL is not manifold.
This is a problem with OpenSCAD in that it could no longer properly differentiate what was inside/outside.
Some programs will work right, others not and some may even crash!


Bob Morrison
Wörth am Rhein, Germany
"Luke, use the source!"
BLOG - PHOTOS - Thingiverse
Sorry, only registered users may post in this forum.

Click here to login