discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

how to create a hollow sphere

KE
Karl Exler
Sat, Nov 7, 2026 4:01 PM

Dear all,

actually I think I know such basics:

kugel();
module kugel()
{
difference()
{
%sphere(r=12);
sphere(r=10);
}
};

But if I look at this I can see the smaller sphere and even in the
slicer it is viewable.. I also tried it with spheroid,,, same story. Is
the smaller sphere subtracted or not?
thank you very much

Karl

Dear all, actually I think I know such basics: kugel(); module kugel() { difference() { %sphere(r=12); sphere(r=10); } }; But if I look at this I can see the smaller sphere and even in the slicer it is viewable.. I also tried it with spheroid,,, same story. Is the smaller sphere subtracted or not? thank you very much Karl
RW
Raymond West
Sat, Nov 7, 2026 4:28 PM

difference(){
kugel();
cube(50);
}
module kugel()
{
difference()
{
sphere(r=12);
sphere(r=10);
}
};

//any clearer?

On 07/11/2026 16:01, Karl Exler via Discuss wrote:

kugel();
module kugel()
{
difference()
{
%sphere(r=12);
sphere(r=10);
}
};

difference(){ kugel(); cube(50); } module kugel() { difference() { sphere(r=12); sphere(r=10); } }; //any clearer? On 07/11/2026 16:01, Karl Exler via Discuss wrote: > kugel(); > module kugel() > { > difference() > { > %sphere(r=12); > sphere(r=10); > } > };
SL
Steve Lelievre
Sat, Nov 7, 2026 4:37 PM

Is OpenSCAD's display the source of your question, vs the actual
geometry generated?
On render, the % means the larger sphere is excluded so the first clause
of the difference() is the smaller sphere, and there is nothing
subtracted. The inner sphere is all that is generated and is solid.

On preview, the % means the larger sphere shows semi-transparent grey
and you see the wall of the (to-be-subtracted) inner sphere.
Intuitively, I guess, once the smaller sphere is removed you might
expect the inner wall to be a shade of semi-transparent grey rather than
colored. Is it the presence of the solid-color inner wall that gives
rise to your question?

The geometry is rendered as would be expected if you remove the $
operator - taking a projection shows the expected hollow ring (annulus).

projection(cut=true) difference()
{
sphere(r=12);
sphere(r=10);
};

On 2026-11-07 9:01 AM, Karl Exler via Discuss wrote:

difference()
{
%sphere(r=12);
sphere(r=10);
};

Is OpenSCAD's display the source of your question, vs the actual geometry generated? On render, the % means the larger sphere is excluded so the first clause of the difference() is the smaller sphere, and there is nothing subtracted. The inner sphere is all that is generated and is solid. On preview, the % means the larger sphere shows semi-transparent grey and you see the wall of the (to-be-subtracted) inner sphere. Intuitively, I guess, once the smaller sphere is removed you might expect the inner wall to be a shade of semi-transparent grey rather than colored. Is it the presence of the solid-color inner wall that gives rise to your question? The geometry is rendered as would be expected if you remove the $ operator - taking a projection shows the expected hollow ring (annulus). > projection(cut=true) difference() > { > sphere(r=12); > sphere(r=10); > }; On 2026-11-07 9:01 AM, Karl Exler via Discuss wrote: > difference() > { > %sphere(r=12); > sphere(r=10); > };
KE
Karl Exler
Sat, Nov 7, 2026 5:22 PM

thank you very much for explaining.. I didn´t know that the % has
different functions on rendering and preview
yours
Karl

Am 07.11.26 um 17:37 schrieb Steve Lelievre via Discuss:

Is OpenSCAD's display the source of your question, vs the actual
geometry generated?
On render, the % means the larger sphere is excluded so the first
clause of the difference() is the smaller sphere, and there is nothing
subtracted. The inner sphere is all that is generated and is solid.

On preview, the % means the larger sphere shows semi-transparent grey
and you see the wall of the (to-be-subtracted) inner sphere.
Intuitively, I guess, once the smaller sphere is removed you might
expect the inner wall to be a shade of semi-transparent grey rather
than colored. Is it the presence of the solid-color inner wall that
gives rise to your question?

The geometry is rendered as would be expected if you remove the $
operator - taking a projection shows the expected hollow ring (annulus).

projection(cut=true) difference()
{
sphere(r=12);
sphere(r=10);
};

On 2026-11-07 9:01 AM, Karl Exler via Discuss wrote:

difference()
{
%sphere(r=12);
sphere(r=10);
};


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

thank you very much for explaining.. I didn´t know that the % has different functions on rendering and preview yours Karl Am 07.11.26 um 17:37 schrieb Steve Lelievre via Discuss: > Is OpenSCAD's display the source of your question, vs the actual > geometry generated? > On render, the % means the larger sphere is excluded so the first > clause of the difference() is the smaller sphere, and there is nothing > subtracted. The inner sphere is all that is generated and is solid. > > On preview, the % means the larger sphere shows semi-transparent grey > and you see the wall of the (to-be-subtracted) inner sphere. > Intuitively, I guess, once the smaller sphere is removed you might > expect the inner wall to be a shade of semi-transparent grey rather > than colored. Is it the presence of the solid-color inner wall that > gives rise to your question? > > The geometry is rendered as would be expected if you remove the $ > operator - taking a projection shows the expected hollow ring (annulus). > >> projection(cut=true) difference() >> { >> sphere(r=12); >> sphere(r=10); >> }; > > > > On 2026-11-07 9:01 AM, Karl Exler via Discuss wrote: >> difference() >> { >> %sphere(r=12); >> sphere(r=10); >> }; > > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
RW
Rogier Wolff
Sat, Nov 7, 2026 6:03 PM

On Sat, Nov 07, 2026 at 05:01:57PM +0100, Karl Exler via Discuss wrote:

Dear all,

actually I think I know such basics:

kugel();
module kugel()
{
difference()
{
%sphere(r=12);
sphere(r=10);
}
};

I tried:

module kugel (r, wt)
{
difference () {
sphere (r);
sphere (r-wt);
}
}

difference () {
kugel (12, 1);
cube (13);
}

and I can see clearly that the sphere is hollow. I prefer to look at
it this way to verify my geometry. Of course the main "difference"
with the cube is "for viewing only". It goes away for final STL
rendering.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Verl. Spiegelmakerstraat 37 2645 LZ  Delfgauw, The Netherlands.
** KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a** is going up.  -- Chris Hadfield about flying up the space shuttle.
**  'a' for accelleration.

On Sat, Nov 07, 2026 at 05:01:57PM +0100, Karl Exler via Discuss wrote: > Dear all, > > actually I think I know such basics: > > kugel(); > module kugel() > { > difference() > { > %sphere(r=12); > sphere(r=10); > } > }; I tried: module kugel (r, wt) { difference () { sphere (r); sphere (r-wt); } } difference () { kugel (12, 1); cube (13); } and I can see clearly that the sphere is hollow. I prefer to look at it this way to verify my geometry. Of course the main "difference" with the cube is "for viewing only". It goes away for final STL rendering. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Verl. Spiegelmakerstraat 37 2645 LZ Delfgauw, The Netherlands. ** KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a** is going up. -- Chris Hadfield about flying up the space shuttle. ** 'a' for accelleration.
JB
Jordan Brown
Sat, Nov 7, 2026 6:23 PM

On 11/7/2026 9:22 AM, Karl Exler via Discuss wrote:

thank you very much for explaining.. I didn´t know that the % has
different functions on rendering and preview

Yeah, one of its primary roles is to create a "ghost" object that
doesn't end up in the render, for things like measuring sticks,
alignment checks, labels, et cetera.  If you want to peek inside, #
might be a better choice.

It generates a sort of strange "emptier than empty" geometry - it's the
absence of a set rather than the empty set.  That's the same thing that
echo() and failing if generate.  It counts as a child for purposes of
$children and children(), but is ignored by difference() and
intersection().  (And union(), but union with an empty shape is the same
behavior.)

On 11/7/2026 9:22 AM, Karl Exler via Discuss wrote: > > thank you very much for explaining.. I didn´t know that the % has > different functions on rendering and preview > Yeah, one of its primary roles is to create a "ghost" object that doesn't end up in the render, for things like measuring sticks, alignment checks, labels, et cetera.  If you want to peek inside, # might be a better choice. It generates a sort of strange "emptier than empty" geometry - it's the absence of a set rather than the empty set.  That's the same thing that echo() and failing `if` generate.  It counts as a child for purposes of $children and children(), but is ignored by difference() and intersection().  (And union(), but union with an empty shape is the same behavior.)