Stumped on a shape

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

Stumped on a shape

Alan Cox

I'm trying to build a model which has a small and large pipe merging snd
the join has a flange. With a pipe into a flat surface it's easy enough
as the flange can be modelled by cutting a circle out of a square and
then rotate extruding it.

With a join of two curved pipes however the flange follows a vastly more
complicated path and continually changes shape and size

The effect I'm trying to get is something like the funnel and dome on this
image

http://www.shutterstock.com/pic-9376726/stock-photo-close-up-of-the-boiler-and-chimney-on-an-old-steam-locomotive.html

Alan

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

David Goodenough
On Wednesday 27 Jun 2012, Alan Cox wrote:

> I'm trying to build a model which has a small and large pipe merging snd
> the join has a flange. With a pipe into a flat surface it's easy enough
> as the flange can be modelled by cutting a circle out of a square and
> then rotate extruding it.
>
> With a join of two curved pipes however the flange follows a vastly more
> complicated path and continually changes shape and size
>
> The effect I'm trying to get is something like the funnel and dome on this
> image
>
> http://www.shutterstock.com/pic-9376726/stock-photo-close-up-of-the-boiler-
> and-chimney-on-an-old-steam-locomotive.html
>
> Alan
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
I hit a lot of these problems and in the end, I gave up.  I hulled the
round pipe into a square one, put a 90 degree bend in that (with two
little overlap sections properly aligned with the next stage) and it
worked a treat.  It actually even flows the water in the pipe through
it quite well too.  

The problem of having to overlap things is a problem for some of the
more complex real world shapes, and fixing it would be a great boon
to the world.

David

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Alan Cox
> I hit a lot of these problems and in the end, I gave up.  I hulled the
> round pipe into a square one, put a 90 degree bend in that (with two
> little overlap sections properly aligned with the next stage) and it
> worked a treat.  It actually even flows the water in the pipe through
> it quite well too.

I'm a model maker so that approach doesn't work. I did have a think about
using hull() last night and once I realised I could create a series of
segments and do

        hull() {
                A
                B
        }

        hull() {
                B
                C
        }

        hull() {
                C
                D
        }

to create the proper curves it sort of works.

I've not sat down and worked the maths out yet so it's an approximation
for a specific case but I did it this way


module pipe(rad,thick, len) {
        difference() {
                cylinder(r = rad, h = len, $fn = 32, center=true);
                if (rad - thick > 0)
                        cylinder(r = rad - thick, h = len + 0.1, $fn =
32, center=true); }
}

module dome(rad, height) {
        sphere(r=rad, $fn=32);
        // the 0.2 is a fudge factor we seem to need for
        // a clean edge
        translate([0, 0, rad])
                cylinder(r = rad, h = height - rad + 0.2, $fn=32,
                                center = true);
}

module flange(r1, r2) {
        intersection() {
                pipe(r1, 0.1, 5);
                translate([0, r1, 0])
                        rotate([90,0,0])
                                pipe(r2, 0.1, 5);
        }
}

translate([0,7,0])
  rotate([90,0,0])
         dome(1.5, 4);

difference() {
        union() {
                hull() {
                        translate([0, 4.5,0])
                                rotate([90,0,0])
                                        pipe(1.5, 0.1, 0.1);
                        translate([0,-3.7,0])
                                flange(8, 1.7);
                }

                hull() {
                        translate([0,-3.7,0])
                                flange(8, 1.7);
                        translate([0,-1.9,0])
                                flange(6, 2.1);
                }

                hull() {
                        translate([0,-1.9,0])
                                flange(6, 2.1);
                        translate([0,-1,0])
                                flange(5, 2.5);
                }
        }
        translate([0,-1.2,0])
                cylinder(r=5, h=10, center=true, $fn=32);
}


Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Peter Falke
In reply to this post by Alan Cox
Hi Alan,

I wrote a little program that may do what you want, but I sort of crushed OpenSCAD when I tried to get rid of the little ledge at the lower edge. And I hadn`t saved it, yet.


Inline-Bild 1
But beware, it F5's in a few seconds, but it probably will F6 not under a few hours.
(I used a brute force approach.)

It is still running, so maybe it will get out of number-crunching land and allow me to save it.
I'll take a break now and see if OpenSCAD will came back by it self.

Enjoy,

TakeItAndRun


2012/6/27 Alan Cox <[hidden email]>

I'm trying to build a model which has a small and large pipe merging snd
the join has a flange. With a pipe into a flat surface it's easy enough
as the flange can be modelled by cutting a circle out of a square and
then rotate extruding it.

With a join of two curved pipes however the flange follows a vastly more
complicated path and continually changes shape and size

The effect I'm trying to get is something like the funnel and dome on this
image

http://www.shutterstock.com/pic-9376726/stock-photo-close-up-of-the-boiler-and-chimney-on-an-old-steam-locomotive.html

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



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

H P Ladds
Wow, that certainly seems to do the trick. Ouch! was the code lost when you "crushed OpenSCAD?" 



Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Peter Falke
Hi all

Ok, here is the code for a beveled joint of two different size pipes. All is parametric.

This is a brute force approach, so the render times will be quiet long.

There are 3 parameter that set the resolution:

fn :number of faces of the pipes
fnbit: number of faces of the 'bit'. The 'bit' is the 'tool' that cuts away pieces of the joint.
fnbevel: number of times that the 'bit' cuts into the joint, as it rotates around the second pipe

I used these parameter
fn=30;

fnbit=10;

fnbevel=40;

to make this picture:Inline-Bild 1

The joint looks OK, but quiet choppy.

I tried a higher resolution (100/30/120) but OpenSCAD is stuck at 10% for a while, now
(On a Acer Aspire One 522, 2*1Ghz AMD C-50 , 2GB, running on one leg, only)

Enjoy,

TakeItAndRun


P.S.: I'm using OpenSCAD 2012.04.01 (git c869c6e).


2012/6/28 H P Ladds <[hidden email]>
Wow, that certainly seems to do the trick. Ouch! was the code lost when you "crushed OpenSCAD?" 




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




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!


Beveled Pipe Joint.scad (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Whosawhatsis
The "correct" way to do it is with minkowski. The following should work, but minkowski takes a long time to render with all but the simplest of shapes, and I didn't have the patience (or the pain threshold with a hot MBP on my lap) to properly test it.

big = 10;

big_l = 20;

small = 5;

small_l = 10;

r = 2;


difference() {

cube([big + r * 2 + 1, big_l, big + small_l * 2], center = true);

minkowski() {

difference() {

cube([big + r * 2 + 1, big_l, big + small_l * 2], center = true);

rotate([90, 0, 0]) cylinder(r = big/2 + r, h = big_l + 1, center = true);

cylinder(r = small/2 + r, h = small_l + big/2 + 1);

}

sphere(r);

}

}


On Thursday, June 28, 2012 at 1:46 PM, Peter Falke wrote:

Hi all

Ok, here is the code for a beveled joint of two different size pipes. All is parametric.

This is a brute force approach, so the render times will be quiet long.

There are 3 parameter that set the resolution:

fn :number of faces of the pipes
fnbit: number of faces of the 'bit'. The 'bit' is the 'tool' that cuts away pieces of the joint.
fnbevel: number of times that the 'bit' cuts into the joint, as it rotates around the second pipe

I used these parameter
fn=30;

fnbit=10;

fnbevel=40;

to make this picture:Inline-Bild 1

The joint looks OK, but quiet choppy.

I tried a higher resolution (100/30/120) but OpenSCAD is stuck at 10% for a while, now
(On a Acer Aspire One 522, 2*1Ghz AMD C-50 , 2GB, running on one leg, only)

Enjoy,

TakeItAndRun


P.S.: I'm using OpenSCAD 2012.04.01 (git c869c6e).


2012/6/28 H P Ladds <[hidden email]>
Wow, that certainly seems to do the trick. Ouch! was the code lost when you "crushed OpenSCAD?" 




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




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list

Attachments:
- Beveled Pipe Joint.scad

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Alan Cox
On Thu, 28 Jun 2012 15:06:33 -0700
whosawhatsis <[hidden email]> wrote:

> The "correct" way to do it is with minkowski.

Thanks. I really don't "get" minkowski, and your example leaves me even
more confused 8)

Alan

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

nophead
It places the centre of the second shape (often a sphere) in every possible position on the surface of the first shape. If the first shape was a cube you get a bigger cube with rounded corners.

On 29 June 2012 10:32, Alan Cox <[hidden email]> wrote:
On Thu, 28 Jun 2012 15:06:33 -0700
whosawhatsis <[hidden email]> wrote:

> The "correct" way to do it is with minkowski.

Thanks. I really don't "get" minkowski, and your example leaves me even
more confused 8)

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

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Peter Falke
Hi,
 
I always worry about how long the programms need to run for higher resolution (greater values of $fn).
 
I tested this program (attached) on my Acer, Aspire One 522, 2*1Ghz AMD C-50 (running on one core only),1GB, under Win7Starter and OpenSCAD 2012.04.01 (git c869c6e)
 
I got the following render times:
 
// circle have $fn facets

fn=30;

fnbit=40;

fnbevel=60;

// only one fourth of the bevel is calculated and than mirrored , thus only fnbevel/4 times are calculated


// 30/10/40 2min36 F5

// 30/10/60 4min20 F5

// 30/10/60 9min20 F6

// 30/10/40 5min17 F6

// 30/10/120 23min36 F6

// 30/20/60 15min38 F6
// 30/40/60 40min47 F6
 
Inline-Bild 1
Could someone please run this program on his/her computer and give me a feedback how long it takes?
Please flush the caches every time before you  do an F6.
 
Thanks,
 
TakeItAndRun

2012/6/29 nop head <[hidden email]>
It places the centre of the second shape (often a sphere) in every possible position on the surface of the first shape. If the first shape was a cube you get a bigger cube with rounded corners.


On 29 June 2012 10:32, Alan Cox <[hidden email]> wrote:
On Thu, 28 Jun 2012 15:06:33 -0700
whosawhatsis <[hidden email]> wrote:

> The "correct" way to do it is with minkowski.

Thanks. I really don't "get" minkowski, and your example leaves me even
more confused 8)

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


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




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!


Beveled Pipe Joint v0_0.scad (3K) Download Attachment
Beveled Pipe Joint v0_0 30-40-60.png (63K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Peter Falke
In reply to this post by Whosawhatsis
Hi,
 
thats an ellegant way to do it for sure.
I used your code (with some small change to make the outcome look simmilar) for some speed test.
 
 
Inline images 1

This took 4 hours to render:
 
 
Inline images 2
 
 
So, minkowski may be the correct way to do it, but not really practical.
 
 
Enjoy,
 
TakeItAndRun
 
 
On 29 June 2012 00:06, whosawhatsis <[hidden email]> wrote:
The "correct" way to do it is with minkowski. The following should work, but minkowski takes a long time to render with all but the simplest of shapes, and I didn't have the patience (or the pain threshold with a hot MBP on my lap) to properly test it.

big = 10;

big_l = 20;

small = 5;

small_l = 10;

r = 2;


difference() {

cube([big + r * 2 + 1, big_l, big + small_l * 2], center = true);

minkowski() {

difference() {

cube([big + r * 2 + 1, big_l, big + small_l * 2], center = true);

rotate([90, 0, 0]) cylinder(r = big/2 + r, h = big_l + 1, center = true);

cylinder(r = small/2 + r, h = small_l + big/2 + 1);

}

sphere(r);

}

}


On Thursday, June 28, 2012 at 1:46 PM, Peter Falke wrote:

Hi all

Ok, here is the code for a beveled joint of two different size pipes. All is parametric.

This is a brute force approach, so the render times will be quiet long.

There are 3 parameter that set the resolution:

fn :number of faces of the pipes
fnbit: number of faces of the 'bit'. The 'bit' is the 'tool' that cuts away pieces of the joint.
fnbevel: number of times that the 'bit' cuts into the joint, as it rotates around the second pipe

I used these parameter
fn=30;

fnbit=10;

fnbevel=40;

to make this picture:Inline-Bild 1

The joint looks OK, but quiet choppy.

I tried a higher resolution (100/30/120) but OpenSCAD is stuck at 10% for a while, now
(On a Acer Aspire One 522, 2*1Ghz AMD C-50 , 2GB, running on one leg, only)

Enjoy,

TakeItAndRun


P.S.: I'm using OpenSCAD 2012.04.01 (git c869c6e).


2012/6/28 H P Ladds <[hidden email]>
Wow, that certainly seems to do the trick. Ouch! was the code lost when you "crushed OpenSCAD?" 




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




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list

Attachments:
- Beveled Pipe Joint.scad


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




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!


beveled pipe by whosawhatsis.scad (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Peter Falke
Hi,
 
here is a fast solution for the beveled pipe joint problem.
It is not 'perfect' as the angle between the bevel and the 'ridge' of the horizontal pipe is not zero.
But it is astonishingly fast.
It works by intersection() anf intersection_for().
(code in attachment)
 
Inline images 1
 
It took only 3min to render !
 
Inline images 2
 
 
Enjoy,
 
TakeItAndRun
 

Beveled Pipe by int.scad (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Giles Bathgate-2
In reply to this post by Peter Falke

I think ImplicitCAD does this really nicely. Something like union(r=3){ cylinder1(); cylinder2(); } where r is the fillet radius. I have no idea how cristopher olah does this, but its a feature I'd like to add to RapCAD.

Regards

Giles

Reply | Threaded
Open this post in threaded view
|

Re: Stumped on a shape

Alan Cox
On Sun, 1 Jul 2012 04:05:37 +0100
Giles Bathgate <[hidden email]> wrote:

> I think ImplicitCAD does this really nicely. Something like union(r=3){
> cylinder1(); cylinder2(); } where r is the fillet radius. I have no idea
> how cristopher olah does this, but its a feature I'd like to add to RapCAD.

The fillet is actually not a constant radius if you look at the picture,
its continuously changing around the join.