Newbie question

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

Newbie question

witte1000
Hello Guy's,

Thank you all for this wonderfull piece of software !

Just started and checking around, doing some easy test and stuff to learn how to work with it.

I was looking on the documentation searching on youtube but don't see and understand it ...
So I just ask in the community if somebody can help me on my way.

For starting It's kind very complex and if you know how, it will be very easy ...

But for now I'm struggling with the following

difference() {
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=4);
}

difference() {   
    cylinder(h=30,r1=25,r2=16,central=true);
    cylinder(h=30,r1=23,r2=14,central=true);
}

What I want to accomplish is to combine the 2 cylinders into each other with the inside is smooth and off course having my hole in the second cylinder.

Tried things like hull, intersection, union, etc ...
Getting all of nice things but not what I want, with putting the intersection in it I get to opposite of what I want to accomplish,

Very funny and having a great time with it :)

But it doesn't help me in this case

Thank you very much for all your feedback, just take it easy on me please :)

Kind Regards,

Dirk


--
Veilig verzonden met Tutanota. Reserveer je versleutelde, advertentievrije mailbox:
https://tutanota.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

JackDesBwa

What I want to accomplish is to combine the 2 cylinders into each other with the inside is smooth and off course having my hole in the second cylinder.

I am not sure to understand what you try to get.
Do you mean something like this ?

difference() {
    union() {
        translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
        cylinder(h=30,r1=25,r2=16,central=true);
    }
    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=4);
    cylinder(h=30,r1=23,r2=14,central=true);
}


JackDesBwa

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

G. Wade Johnson
In reply to this post by witte1000
On Wed, 22 May 2019 22:00:23 +0200 (CEST)
Dirk Willems <[hidden email]> wrote:

> Hello Guy's,
>
> Thank you all for this wonderfull piece of software !
>
> Just started and checking around, doing some easy test and stuff to
> learn how to work with it.
>
> I was looking on the documentation searching on youtube but don't see
> and understand it ... So I just ask in the community if somebody can
> help me on my way.
>
> For starting It's kind very complex and if you know how, it will be
> very easy ...
>
> But for now I'm struggling with the following
>
> difference() {
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=4);
> }
>
> difference() {   
>     cylinder(h=30,r1=25,r2=16,central=true);
>     cylinder(h=30,r1=23,r2=14,central=true);
> }

The problem in both cases is a subtle issue that we all dealt with. The
shape you want to difference cannot be the exact same length as shape
you are subtracting from. Otherwise, you end up with a very thin
membrane at each end.

Try

difference() {
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=21,r=4);
}

I normally have a constant eps, defined at the top of my file, that I
add to the lengths like this to make it obvious that I am using a fudge
factor

eps=0.01;

difference() {
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20+eps,r=4);
}

The second example works the same way with a small addition (like eps),
Doesn't work as well, adding a 1. (Wall thickness is not what you
expect in that case.)

G. Wade

> What I want to accomplish is to combine the 2 cylinders into each
> other with the inside is smooth and off course having my hole in the
> second cylinder.
>
> Tried things like hull, intersection, union, etc ...
> Getting all of nice things but not what I want, with putting the
> intersection in it I get to opposite of what I want to accomplish,
>
> Very funny and having a great time with it :)
>
> But it doesn't help me in this case
>
> Thank you very much for all your feedback, just take it easy on me
> please :)
>
> Kind Regards,
>
> Dirk
>  
>


--
It is wise to remember that you are one of those who can be fooled some
of the time.                                      -- Laurence J. Peter

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

JordanBrown
In reply to this post by witte1000
On 5/22/2019 1:00 PM, Dirk Willems wrote:
But for now I'm struggling with the following

difference() {
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=4);
}

difference() {   
    cylinder(h=30,r1=25,r2=16,central=true);
    cylinder(h=30,r1=23,r2=14,central=true);
}

What I want to accomplish is to combine the 2 cylinders into each other with the inside is smooth and off course having my hole in the second cylinder.

You say in the second block "central=true".  Perhaps you meant "center=true", but that doesn't seem to do what you want.  (But maybe it would, if you took away the translate.)

Others have talked about the "Z fighting" issue of having a difference (or intersection) yield a zero-thickness piece.  The software can't quite decide whether or not there's something there.  (Suggestion to developers:  if you can detect this case... there's nothing there.  There's no practical reason for a zero-thickness piece; the intent is almost certainly that it's nothing.)

Here's a simple tweak to fix that.  It nudges the "negative" cylinders down a little and makes them a little longer so the boundaries of the result are unambiguous.  And while we're there, let's factor out the translate and rotate so we don't have to repeat them.
eps=0.01;
translate([0,37,15]) rotate([90,0,0]) {
    difference() {
        cylinder(h=20,r=5);
        translate([0,0,-eps]) cylinder(h=20+eps*2,r=4);
    }
}

difference() {   
    cylinder(h=30,r1=25,r2=16);
    translate([0,0,-eps]) cylinder(h=30+2*eps,r1=23,r2=14);
}

But if you look carefully, maybe that isn't what you want.  Note that the hole in the horizontal pipe doesn't go through; it's blocked by the cone's wall.  That's because you're taking a pipe and unioning it with a hollow cone.  You might also notice that the pipe protrudes into the hollow cone, which might not be what you want.

Here's a version that fixes both of those.  Alas, because of the regrouping we have to bring back the duplicated translate and rotate.

eps=0.01;
difference() {
    union() {
        translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
        cylinder(h=30,r1=25,r2=16);
    }
    union() {
        translate([0,37+eps,15]) rotate([90,0,0]) cylinder(h=20+eps*2,r=4);
        translate([0,0,-eps]) cylinder(h=30+2*eps,r1=23,r2=14);
    }
}

If you really did want the pipe to protrude into the cone, you have to regroup a little:

eps=0.01;
difference() {
    union() {
        difference() {
            cylinder(h=30,r1=25,r2=16);
            translate([0,0,-eps]) cylinder(h=30+2*eps,r1=23,r2=14);
        }
        translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
    }
    translate([0,37+eps,15]) rotate([90,0,0]) cylinder(h=20+eps*2,r=4);
}

  


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

lar3ry
In reply to this post by G. Wade Johnson
G. Wade Johnson wrote
> The problem in both cases is a subtle issue that we all dealt with. The
> shape you want to difference cannot be the exact same length as shape
> you are subtracting from. Otherwise, you end up with a very thin
> membrane at each end.

Are you speaking of the preview? If so, I would not consider that a
membrane. It's congruent surfaces interfering with the preview. The render
gives exactly what I would expect, a hollow cylinder.


> Try
>
> difference() {
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=21,r=4);
> }
>
> I normally have a constant eps, defined at the top of my file, that I
> add to the lengths like this to make it obvious that I am using a fudge
> factor
>
> eps=0.01;
>
> difference() {
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20+eps,r=4);
> }
>
> The second example works the same way with a small addition (like eps),
> Doesn't work as well, adding a 1. (Wall thickness is not what you
> expect in that case.)

I don't get it. The two examples you gave resulted in exactly the same
object.
Yes I do realize that this can sometimes create an STL that has errors, but
if that happens, THAT's when I take steps to get rid of the problem.

Larry



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

tjhowse
I've long incorporated a "zff = 0.0001" factor - Z-Fight Fudge, to get rid of the annoying tenuous pseudo-surfaces you get when subtracting with overlapping co-planar faces. It's not an elegant solution but it works.

On Thu, 23 May 2019 at 16:18, lar3ry <[hidden email]> wrote:
G. Wade Johnson wrote
> The problem in both cases is a subtle issue that we all dealt with. The
> shape you want to difference cannot be the exact same length as shape
> you are subtracting from. Otherwise, you end up with a very thin
> membrane at each end.

Are you speaking of the preview? If so, I would not consider that a
membrane. It's congruent surfaces interfering with the preview. The render
gives exactly what I would expect, a hollow cylinder.


> Try
>
> difference() {
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=21,r=4);
> }
>
> I normally have a constant eps, defined at the top of my file, that I
> add to the lengths like this to make it obvious that I am using a fudge
> factor
>
> eps=0.01;
>
> difference() {
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
>    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20+eps,r=4);
> }
>
> The second example works the same way with a small addition (like eps),
> Doesn't work as well, adding a 1. (Wall thickness is not what you
> expect in that case.)

I don't get it. The two examples you gave resulted in exactly the same
object.
Yes I do realize that this can sometimes create an STL that has errors, but
if that happens, THAT's when I take steps to get rid of the problem.

Larry



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

witte1000
Thank you all guy's for all your's kindly feedback and examples, this make
things very clear and do see now how to play with the different combinations
is just amazing, love it very much

For making things clear, I'm trying to re-design my protein skimmer inlet,
because I'm convince that my design will work much smoother, better mixing
of air and water and the most important less noise  ...

But for knowing I've to put it to the test ...

What I already accomplished is the following


$fn=100;
eps=0.01;

// Skimmer_Inlet_Cone1
// cylinder 1
sic11h=30;
sic11r1=25;
sic11r2=16;

sic111h=sic11h;
sic111r1=sic11r1-2;
sic111r2=sic11r2-2;

// cylinder 2

sic12h=20;
sic12r=5;

sic122h=sic12h;
sic122r=sic12r-1;

// Skimmer_Inlet_Cone2

sic22h=30;
sic22r1=25;
sic22r2=12;

sic222h=sic22h;
sic222r1=sic22r1-1;
sic222r2=sic22r2-1;

// Skimmer_Large_Pipe
slph=105;
slphr1=16;
slphr2=14;



// Skimmer_Inlet_Cone1

difference() {
    union() {
        translate([0,37,15]) rotate([90,0,0]) cylinder(h=sic12h,r=sic12r);
        cylinder(h=sic11h,r1=sic11r1,r2=sic11r2);
    }
    union() {
        translate([0,37+eps,15]) rotate([90,0,0])
cylinder(h=sic122h+eps*2,r=sic122r);
        translate([0,0,-eps])
cylinder(h=sic111h+2*eps,r1=sic111r1,r2=sic111r2);
    }
}

//difference() {
//  union() {
//   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
//   cylinder(h=30,r1=25,r2=16,central=true);
//}
//    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=4);
//    cylinder(h=30,r1=23,r2=14,central=true);
//}

// Skimmer_Inlet_Cone2

difference() {
 cylinder(h=sic22h,r1=sic22r1,r2=sic22r2,central=true);
 cylinder(h=sic222h,r1=sic222r1,r2=sic222r2,central=true);
}

// Skimmer_Large_Pipe

difference() {
translate([0,0,30]) cylinder(h=slph+2*eps,r=slphr1,central=true);
translate([0,0,30]) cylinder(h=slph+2*eps,r=slphr2,central=true);
}


which give me the result I've in my mind, don't know if it is all correct
with the overlays etc ....

The next thing I want is to smooth rounded the edge's of the front of the
cone and the large pipe, trying with hull and minkowski but I've to play
more with it ...

Also some more ambition is to have wings inside the cone for accelerator the
water ....

Great appreciate very much all your kind feedback ...

Thank you very much for teaching me all this amazing great stuff !!!

Kind Regards,
Dirk



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

lar3ry
One thing that baffles me is that with your code, I get the following error:
  WARNING: variable central not specified as parameter

If I change central to center, all is well. I am running 2019.05

I got curious about the internals of the object, and did a little
investigating. I often use difference() to cut away part of an object to see
if I have the internals right. In case you are not familiar with this
technique, here's my modification to allow you to see exactly what's inside.
I would be interested to know if this inside view is what you expected.

$fn=100;
eps=0.01;

// Skimmer_Inlet_Cone1
// cylinder 1
sic11h=30;
sic11r1=25;
sic11r2=16;

sic111h=sic11h;
sic111r1=sic11r1-2;
sic111r2=sic11r2-2;

// cylinder 2

sic12h=20;
sic12r=5;

sic122h=sic12h;
sic122r=sic12r-1;

// Skimmer_Inlet_Cone2

sic22h=30;
sic22r1=25;
sic22r2=12;

sic222h=sic22h;
sic222r1=sic22r1-1;
sic222r2=sic22r2-1;

// Skimmer_Large_Pipe
slph=105;
slphr1=16;
slphr2=14;

//put a ! at the beginning of Skimmer(); to render normally
Skimmer();

//put a ! at the beginning of difference to see inside
!difference() {
        Skimmer();
        translate([0,-30,-30])
                cube([60,70,150]);
}

// Skimmer_Inlet_Cone1
module Skimmer() {
        difference() {
                        union() {
                                        translate([0,37,15]) rotate([90,0,0]) cylinder(h=sic12h,r=sic12r);
                                        cylinder(h=sic11h,r1=sic11r1,r2=sic11r2);
                        }
                        union() {
                                        translate([0,37+eps,15]) rotate([90,0,0])
        cylinder(h=sic122h+eps*2,r=sic122r);
                                        translate([0,0,-eps])
        cylinder(h=sic111h+2*eps,r1=sic111r1,r2=sic111r2);
                        }
        }

        //difference() {
        //  union() {
        //   translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=5);
        //   cylinder(h=30,r1=25,r2=16,center=true);
        //}
        //    translate([0,37,15]) rotate([90,0,0]) cylinder(h=20,r=4);
        //    cylinder(h=30,r1=23,r2=14,center=true);
        //}

        // Skimmer_Inlet_Cone2

        difference() {
         cylinder(h=sic22h,r1=sic22r1,r2=sic22r2,center=true);
         cylinder(h=sic222h,r1=sic222r1,r2=sic222r2,center=true);
        }

        // Skimmer_Large_Pipe

        difference() {
        translate([0,0,30]) cylinder(h=slph+2*eps,r=slphr1,center=true);
        translate([0,0,30]) cylinder(h=slph+2*eps,r=slphr2,center=true);
        }
}





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

witte1000
Dear lar3ry,

Thank you very much for your feedback !

I see I'm running OpenSCAD version 2015.03-2, did the install from the ppa
repo

Your code is mindblowing holy crap, this is a really nice trick !!! exactly
what i was looking for

And yes you are true if I change central to center or the other way around,
don't have the warning but the center way is not the picture in my mind,
with central it is 100% what i have in my mind, so I messed up with the
central, to be honest I don't understand what the meaning is of central ( my
apologize I'm from Belgium and English is not my mother langue) but it
worked like in my mind lol

The purpose of this inlet is to mix the air with the water, so the first
cone with the small pipe suck in the air and created the air chamber, the
second cone inside the first cone create the hole for the water flow, on the
end of the cone beginning of the large pipe the air meet and mixed with the
water and together they suck into the pump from the large pipe

The water flow will create a venturie (don't know in English) sucking in
whereby the little pipe sucking in the air to mix with the water, so the
front side of the cone most be closed only the hole for the water can be
open no 2 cons on the pipe, the pipe has to remove  ...

The front side where the water is sucking in is de beginning of the cone and
the end what goes into the pump is the large pipe

Hopefully this make sense ?

I'm sorry it's difficult to explain from mail ...

Once again thank you very much already for teaching me this amazing trick
!!! I'm very happy with this :)

Kind Regards,
Dirk



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question

JordanBrown
On 5/23/2019 8:36 AM, witte1000 wrote:
And yes you are true if I change central to center or the other way around,
don't have the warning but the center way is not the picture in my mind,
with central it is 100% what i have in my mind

"central" doesn't mean anything and is being ignored.  (Hence the error message.)  You can remove it.

The "center" option means to center the object on the origin.  Exactly what that means depends on the object.  Spheres are always centered.  Cylinders default to being centered in X and Y - that is, the circle is centered on the origin - but extend from zero up in positive Z; setting center=true has them extend from -height/2 up through the origin to +height/2.  Cubes default to having one corner at the origin and extending in +X/+Y/+Z; setting center=true centers them on the origin.

venturie (don't know in English)

Venturi.  It's named after an Italian scientist named Venturi, so it wouldn't be surprising if it's very similar in many languages.

Have fun.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org