why does rotate_extrude fill in holes?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

why does rotate_extrude fill in holes?

David Goodenough
A while ago I asked how to make a bend in a pipe, and was told to use
rotate_extrude on a circle.  Then repeat and position the inside correctly
and difference give you a pipe.  All well and good, but it is quite
difficult to position the inside properly.

So I thought if I define a pipe by taking the difference of two circles
and then rotate_extrude it I will get the same effect, but no, I get a
solid torus.  Surely I should get a hollow one?

The code I used was-

        intersection() {
                // torus
                rotate_extrude()
                        translate([bendR + innerR, 0, 0])
                                difference() {
                                        circle(r=outerR);
                                        circle(r=innerR);
                                        }
                translate([0,0,-50])
                        cube([100, 100, 100]);
                }

Where bendR is the bend radius, innerR is the inside radius of the
pipe and outerR is the outside radius.

I then sliced the result, and there is no hollow in the middle of the torus.

David

Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

nophead
Add this and it sort of works with F5 but is still solid with F6: rotate_extrude(convexity = 5)



On 10 May 2012 13:26, David Goodenough <[hidden email]> wrote:
A while ago I asked how to make a bend in a pipe, and was told to use
rotate_extrude on a circle.  Then repeat and position the inside correctly
and difference give you a pipe.  All well and good, but it is quite
difficult to position the inside properly.

So I thought if I define a pipe by taking the difference of two circles
and then rotate_extrude it I will get the same effect, but no, I get a
solid torus.  Surely I should get a hollow one?

The code I used was-

       intersection() {
               // torus
               rotate_extrude()
                       translate([bendR + innerR, 0, 0])
                               difference() {
                                       circle(r=outerR);
                                       circle(r=innerR);
                                       }
               translate([0,0,-50])
                       cube([100, 100, 100]);
               }

Where bendR is the bend radius, innerR is the inside radius of the
pipe and outerR is the outside radius.

I then sliced the result, and there is no hollow in the middle of the torus.

David
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

nophead
This works:

innerR = 10;

outerR = 12;

bendR = 50;


difference() {

  intersection() {

   // torus

   rotate_extrude(convexity = 5)

      translate([bendR + innerR, 0, 0])

          circle(r=outerR);

   translate([0,0,-50])

      cube([100, 100, 100]);

   }

   rotate_extrude(convexity = 5)

      translate([bendR + innerR, 0, 0])

          circle(r=innerR);

}



On 10 May 2012 13:42, nop head <[hidden email]> wrote:
Add this and it sort of works with F5 but is still solid with F6: rotate_extrude(convexity = 5)



On 10 May 2012 13:26, David Goodenough <[hidden email]> wrote:
A while ago I asked how to make a bend in a pipe, and was told to use
rotate_extrude on a circle.  Then repeat and position the inside correctly
and difference give you a pipe.  All well and good, but it is quite
difficult to position the inside properly.

So I thought if I define a pipe by taking the difference of two circles
and then rotate_extrude it I will get the same effect, but no, I get a
solid torus.  Surely I should get a hollow one?

The code I used was-

       intersection() {
               // torus
               rotate_extrude()
                       translate([bendR + innerR, 0, 0])
                               difference() {
                                       circle(r=outerR);
                                       circle(r=innerR);
                                       }
               translate([0,0,-50])
                       cube([100, 100, 100]);
               }

Where bendR is the bend radius, innerR is the inside radius of the
pipe and outerR is the outside radius.

I then sliced the result, and there is no hollow in the middle of the torus.

David
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

David Goodenough
Wonderful, that works a treat.  Thank you.

David

On Thursday 10 May 2012, nop head wrote:

> This works:
>
> innerR = 10;
>
> outerR = 12;
>
> bendR = 50;
>
>
> difference() {
>
>   intersection() {
>
>    // torus
>
>    rotate_extrude(convexity = 5)
>
>       translate([bendR + innerR, 0, 0])
>
>           circle(r=outerR);
>
>    translate([0,0,-50])
>
>       cube([100, 100, 100]);
>
>    }
>
>    rotate_extrude(convexity = 5)
>
>       translate([bendR + innerR, 0, 0])
>
>           circle(r=innerR);
>
> }
>
> On 10 May 2012 13:42, nop head <[hidden email]> wrote:
> > Add this and it sort of works with F5 but is still solid with
> > F6: rotate_extrude(convexity = 5)
> >
> > On 10 May 2012 13:26, David Goodenough
<[hidden email]>wrote:

> >> A while ago I asked how to make a bend in a pipe, and was told to use
> >> rotate_extrude on a circle.  Then repeat and position the inside
> >> correctly and difference give you a pipe.  All well and good, but it is
> >> quite difficult to position the inside properly.
> >>
> >> So I thought if I define a pipe by taking the difference of two circles
> >> and then rotate_extrude it I will get the same effect, but no, I get a
> >> solid torus.  Surely I should get a hollow one?
> >>
> >> The code I used was-
> >>
> >>        intersection() {
> >>        
> >>                // torus
> >>                rotate_extrude()
> >>                
> >>                        translate([bendR + innerR, 0, 0])
> >>                        
> >>                                difference() {
> >>                                
> >>                                        circle(r=outerR);
> >>                                        circle(r=innerR);
> >>                                        }
> >>                
> >>                translate([0,0,-50])
> >>                
> >>                        cube([100, 100, 100]);
> >>                
> >>                }
> >>
> >> Where bendR is the bend radius, innerR is the inside radius of the
> >> pipe and outerR is the outside radius.
> >>
> >> I then sliced the result, and there is no hollow in the middle of the
> >> torus.
> >>
> >> David
> >> _______________________________________________
> >> OpenSCAD mailing list
> >> [hidden email]
> >> http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

nophead
I don't know why the original doesn't work. Looks like a bug in rotate_extrude to me.

On 10 May 2012 14:03, David Goodenough <[hidden email]> wrote:
Wonderful, that works a treat.  Thank you.

David

On Thursday 10 May 2012, nop head wrote:
> This works:
>
> innerR = 10;
>
> outerR = 12;
>
> bendR = 50;
>
>
> difference() {
>
>   intersection() {
>
>    // torus
>
>    rotate_extrude(convexity = 5)
>
>       translate([bendR + innerR, 0, 0])
>
>           circle(r=outerR);
>
>    translate([0,0,-50])
>
>       cube([100, 100, 100]);
>
>    }
>
>    rotate_extrude(convexity = 5)
>
>       translate([bendR + innerR, 0, 0])
>
>           circle(r=innerR);
>
> }
>
> On 10 May 2012 13:42, nop head <[hidden email]> wrote:
> > Add this and it sort of works with F5 but is still solid with
> > F6: rotate_extrude(convexity = 5)
> >
> > On 10 May 2012 13:26, David Goodenough
<[hidden email]>wrote:
> >> A while ago I asked how to make a bend in a pipe, and was told to use
> >> rotate_extrude on a circle.  Then repeat and position the inside
> >> correctly and difference give you a pipe.  All well and good, but it is
> >> quite difficult to position the inside properly.
> >>
> >> So I thought if I define a pipe by taking the difference of two circles
> >> and then rotate_extrude it I will get the same effect, but no, I get a
> >> solid torus.  Surely I should get a hollow one?
> >>
> >> The code I used was-
> >>
> >>        intersection() {
> >>
> >>                // torus
> >>                rotate_extrude()
> >>
> >>                        translate([bendR + innerR, 0, 0])
> >>
> >>                                difference() {
> >>
> >>                                        circle(r=outerR);
> >>                                        circle(r=innerR);
> >>                                        }
> >>
> >>                translate([0,0,-50])
> >>
> >>                        cube([100, 100, 100]);
> >>
> >>                }
> >>
> >> Where bendR is the bend radius, innerR is the inside radius of the
> >> pipe and outerR is the outside radius.
> >>
> >> I then sliced the result, and there is no hollow in the middle of the
> >> torus.
> >>
> >> David
> >> _______________________________________________
> >> OpenSCAD mailing list
> >> [hidden email]
> >> http://rocklinux.net/mailman/listinfo/openscad

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

David Goodenough
Its all a matter of getting right magic incantations.  But it is good
to hear that I am not alone in thinking it should have worked.  BTW
convexity is not really documented in the manual, its there, but not
documented.  It would be nice if it were documented.

David

On Thursday 10 May 2012, nop head wrote:
> I don't know why the original doesn't work. Looks like a bug in
> rotate_extrude to me.
>
> On 10 May 2012 14:03, David Goodenough
<[hidden email]>wrote:

> > Wonderful, that works a treat.  Thank you.
> >
> > David
> >
> > On Thursday 10 May 2012, nop head wrote:
> > > This works:
> > >
> > > innerR = 10;
> > >
> > > outerR = 12;
> > >
> > > bendR = 50;
> > >
> > >
> > > difference() {
> > >
> > >   intersection() {
> > >  
> > >    // torus
> > >    
> > >    rotate_extrude(convexity = 5)
> > >    
> > >       translate([bendR + innerR, 0, 0])
> > >      
> > >           circle(r=outerR);
> > >    
> > >    translate([0,0,-50])
> > >    
> > >       cube([100, 100, 100]);
> > >    
> > >    }
> > >    
> > >    rotate_extrude(convexity = 5)
> > >    
> > >       translate([bendR + innerR, 0, 0])
> > >      
> > >           circle(r=innerR);
> > >
> > > }
> > >
> > > On 10 May 2012 13:42, nop head <[hidden email]> wrote:
> > > > Add this and it sort of works with F5 but is still solid with
> > > > F6: rotate_extrude(convexity = 5)
> > > >
> > > > On 10 May 2012 13:26, David Goodenough
> >
> > <[hidden email]>wrote:
> > > >> A while ago I asked how to make a bend in a pipe, and was told to
> > > >> use rotate_extrude on a circle.  Then repeat and position the
> > > >> inside correctly and difference give you a pipe.  All well and
> > > >> good, but it
> >
> > is
> >
> > > >> quite difficult to position the inside properly.
> > > >>
> > > >> So I thought if I define a pipe by taking the difference of two
> >
> > circles
> >
> > > >> and then rotate_extrude it I will get the same effect, but no, I get
> > > >> a solid torus.  Surely I should get a hollow one?
> > > >>
> > > >> The code I used was-
> > > >>
> > > >>        intersection() {
> > > >>        
> > > >>                // torus
> > > >>                rotate_extrude()
> > > >>                
> > > >>                        translate([bendR + innerR, 0, 0])
> > > >>                        
> > > >>                                difference() {
> > > >>                                
> > > >>                                        circle(r=outerR);
> > > >>                                        circle(r=innerR);
> > > >>                                        }
> > > >>                
> > > >>                translate([0,0,-50])
> > > >>                
> > > >>                        cube([100, 100, 100]);
> > > >>                
> > > >>                }
> > > >>
> > > >> Where bendR is the bend radius, innerR is the inside radius of the
> > > >> pipe and outerR is the outside radius.
> > > >>
> > > >> I then sliced the result, and there is no hollow in the middle of
> > > >> the torus.
> > > >>
> > > >> David
> > > >> _______________________________________________
> > > >> OpenSCAD mailing list
> > > >> [hidden email]
> > > >> http://rocklinux.net/mailman/listinfo/openscad
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

donbright
i opened an issue on this, hope nobody minds...  a speculative
possible solution might be to split the 2d object using CGAL's 2d
'shell iteration' code into 'hole' and 'body' shapes. In your example,
this would result in one small circle (the hole) and one large circle
(the body). Then have the code rotate-extrude each circle
individually, resulting in two 3d shapes - a small torus and a large
torus. Then ask CGAL to subtract the 'hole' 3d shape (small torus)
from the 'body' 3d shape (large torus), resulting in a CGAL 3d hollow
torus. Dont have time to implement this ATM but I thought I'd write it
down in case I ever do.

Reply | Threaded
Open this post in threaded view
|

Re: why does rotate_extrude fill in holes?

donbright
In reply to this post by nophead
just realized the 'solution' i posted is simply a restatement of nop
head's idea that he implemented in openscad code. . . im proposing to
automate and generalize what he did using CGAL 2d/3d features, and put
it in the C++ of OpenSCAD itself. . . to fix the bug in
rotate_extrude.

-DB

On Thu, May 10, 2012 at 8:05 AM, nop head <[hidden email]> wrote:

> I don't know why the original doesn't work. Looks like a bug in
> rotate_extrude to me.
>
>
> On 10 May 2012 14:03, David Goodenough <[hidden email]>
> wrote:
>>
>> Wonderful, that works a treat.  Thank you.
>>
>> David
>>
>> On Thursday 10 May 2012, nop head wrote:
>> > This works:
>> >
>> > innerR = 10;
>> >
>> > outerR = 12;
>> >
>> > bendR = 50;
>> >
>> >
>> > difference() {
>> >
>> >   intersection() {
>> >
>> >    // torus
>> >
>> >    rotate_extrude(convexity = 5)
>> >
>> >       translate([bendR + innerR, 0, 0])
>> >
>> >           circle(r=outerR);
>> >
>> >    translate([0,0,-50])
>> >
>> >       cube([100, 100, 100]);
>> >
>> >    }
>> >
>> >    rotate_extrude(convexity = 5)
>> >
>> >       translate([bendR + innerR, 0, 0])
>> >
>> >           circle(r=innerR);
>> >
>> > }
>> >
>> > On 10 May 2012 13:42, nop head <[hidden email]> wrote:
>> > > Add this and it sort of works with F5 but is still solid with
>> > > F6: rotate_extrude(convexity = 5)
>> > >
>> > > On 10 May 2012 13:26, David Goodenough
>> <[hidden email]>wrote:
>> > >> A while ago I asked how to make a bend in a pipe, and was told to use
>> > >> rotate_extrude on a circle.  Then repeat and position the inside
>> > >> correctly and difference give you a pipe.  All well and good, but it
>> > >> is
>> > >> quite difficult to position the inside properly.
>> > >>
>> > >> So I thought if I define a pipe by taking the difference of two
>> > >> circles
>> > >> and then rotate_extrude it I will get the same effect, but no, I get
>> > >> a
>> > >> solid torus.  Surely I should get a hollow one?
>> > >>
>> > >> The code I used was-
>> > >>
>> > >>        intersection() {
>> > >>
>> > >>                // torus
>> > >>                rotate_extrude()
>> > >>
>> > >>                        translate([bendR + innerR, 0, 0])
>> > >>
>> > >>                                difference() {
>> > >>
>> > >>                                        circle(r=outerR);
>> > >>                                        circle(r=innerR);
>> > >>                                        }
>> > >>
>> > >>                translate([0,0,-50])
>> > >>
>> > >>                        cube([100, 100, 100]);
>> > >>
>> > >>                }
>> > >>
>> > >> Where bendR is the bend radius, innerR is the inside radius of the
>> > >> pipe and outerR is the outside radius.
>> > >>
>> > >> I then sliced the result, and there is no hollow in the middle of the
>> > >> torus.
>> > >>
>> > >> David
>> > >> _______________________________________________
>> > >> OpenSCAD mailing list
>> > >> [hidden email]
>> > >> http://rocklinux.net/mailman/listinfo/openscad
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> [hidden email]
>> http://rocklinux.net/mailman/listinfo/openscad
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>