discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Newbie Hull problem

M
MDFChris
Sun, Jan 28, 2018 7:46 PM

Hi All

I've just started using OpenSCAD and so far I'm liking it, it suits my
engineering mind however I'm having an issue with a simple hull ?

I'm designing a nozzle for my 3D printer which seems simple enough using a
difference of two'd hull'd cubes:

//Nozzle
nozzle();
module nozzle(){
difference(){
port(1);
port(0);
}
}
module port(d){
hull() {
cube([19.5+d2,15+d2,2],center=true);
translate([-10,4,15])
rotate([0,-45,0])
cube([7+d2,14+d2,2],center=true);
}
}
however if I increase the rotation angle of the outlet port beyond -45 (i.e.
-50 or more) the open end starts to close up ?, I can't figure if I'm doing
something wrong or is this some sort of rounding error ?

Chris

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

Hi All I've just started using OpenSCAD and so far I'm liking it, it suits my engineering mind however I'm having an issue with a simple hull ? I'm designing a nozzle for my 3D printer which seems simple enough using a difference of two'd hull'd cubes: //Nozzle nozzle(); module nozzle(){ difference(){ port(1); port(0); } } module port(d){ hull() { cube([19.5+d*2,15+d*2,2],center=true); translate([-10,4,15]) rotate([0,-45,0]) cube([7+d*2,14+d*2,2],center=true); } } however if I increase the rotation angle of the outlet port beyond -45 (i.e. -50 or more) the open end starts to close up ?, I can't figure if I'm doing something wrong or is this some sort of rounding error ? Chris -- Sent from: http://forum.openscad.org/
JB
Jordan Brown
Sun, Jan 28, 2018 8:14 PM

On 1/28/2018 11:46 AM, MDFChris wrote:

I've just started using OpenSCAD and so far I'm liking it, it suits my
engineering mind however I'm having an issue with a simple hull ?

I'm designing a nozzle for my 3D printer which seems simple enough using a
difference of two'd hull'd cubes:

//Nozzle
nozzle();
module nozzle(){
difference(){
port(1);
port(0);
}
}
module port(d){
hull() {
cube([19.5+d2,15+d2,2],center=true);
translate([-10,4,15])
rotate([0,-45,0])
cube([7+d2,14+d2,2],center=true);
}
}
however if I increase the rotation angle of the outlet port beyond -45 (i.e.
-50 or more) the open end starts to close up ?, I can't figure if I'm doing
something wrong or is this some sort of rounding error ?

It looks like your two top-end cubes have their top faces in the same
place.  This causes an effect called Z-fighting, where the rendering
program can't quite decide whether or not there's something there.  Note
the shimmery yellow/green nature of that area; you don't want that.  At
the higher angles it does indeed look like there's some kind of rounding
area that is making part of the surface be "real" and infinitesimally thin.

The usual trick is, when you difference or intersect objects, to ensure
that the objects protrude a bit so that they don't do that, so that the
surface is cleanly removed or not-removed, e.g.:

    difference() {
        cube(10, center=true);
        cylinder(d=5, h=10.1, center=true);
    }

Here's a quick change that will make the effect go away in your model:

module port(d){
    hull() {
        fudge = d ? 0 : 0.1;
        cube([19.5+d*2,15+d*2,2 + fudge],center=true);
        translate([-10,4,15])
        rotate([0,-60,0])
        cube([7+d*2,14+d*2,2 + fudge],center=true);
    }
}

Note that you have the same issue on the bottom too, which is why I put
in the fudge factor there too.

That 0.1 difference slightly changes the geometry of the model.  If
that's important to you then you might need something more complex.

On 1/28/2018 11:46 AM, MDFChris wrote: > I've just started using OpenSCAD and so far I'm liking it, it suits my > engineering mind however I'm having an issue with a simple hull ? > > I'm designing a nozzle for my 3D printer which seems simple enough using a > difference of two'd hull'd cubes: > > //Nozzle > nozzle(); > module nozzle(){ > difference(){ > port(1); > port(0); > } > } > module port(d){ > hull() { > cube([19.5+d*2,15+d*2,2],center=true); > translate([-10,4,15]) > rotate([0,-45,0]) > cube([7+d*2,14+d*2,2],center=true); > } > } > however if I increase the rotation angle of the outlet port beyond -45 (i.e. > -50 or more) the open end starts to close up ?, I can't figure if I'm doing > something wrong or is this some sort of rounding error ? It looks like your two top-end cubes have their top faces in the same place.  This causes an effect called Z-fighting, where the rendering program can't quite decide whether or not there's something there.  Note the shimmery yellow/green nature of that area; you don't want that.  At the higher angles it does indeed look like there's some kind of rounding area that is making part of the surface be "real" and infinitesimally thin. The usual trick is, when you difference or intersect objects, to ensure that the objects protrude a bit so that they don't do that, so that the surface is cleanly removed or not-removed, e.g.:     difference() {         cube(10, center=true);         cylinder(d=5, h=10.1, center=true);     } Here's a quick change that will make the effect go away in your model: module port(d){ hull() { fudge = d ? 0 : 0.1; cube([19.5+d*2,15+d*2,2 + fudge],center=true); translate([-10,4,15]) rotate([0,-60,0]) cube([7+d*2,14+d*2,2 + fudge],center=true); } } Note that you have the same issue on the bottom too, which is why I put in the fudge factor there too. That 0.1 difference slightly changes the geometry of the model.  If that's important to you then you might need something more complex.
AB
Antonio Bueno
Sun, Jan 28, 2018 8:25 PM

Hello Chris.

Other than the flicker of coincident faces, I have no problem going down to
-90.

I've added a "scale(1.001)" before "port(0)" as a workaround for them and I
get this with -90:
[image: Imágenes integradas 1]

2018-01-28 20:46 GMT+01:00 MDFChris openscad@oddys.plus.com:

Hi All

I've just started using OpenSCAD and so far I'm liking it, it suits my
engineering mind however I'm having an issue with a simple hull ?

I'm designing a nozzle for my 3D printer which seems simple enough using a
difference of two'd hull'd cubes:

//Nozzle
nozzle();
module nozzle(){
difference(){
port(1);
port(0);
}
}
module port(d){
hull() {
cube([19.5+d2,15+d2,2],center=true);
translate([-10,4,15])
rotate([0,-45,0])
cube([7+d2,14+d2,2],center=true);
}
}
however if I increase the rotation angle of the outlet port beyond -45
(i.e.
-50 or more) the open end starts to close up ?, I can't figure if I'm doing
something wrong or is this some sort of rounding error ?

Chris

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
Saludos,
Antonio

Hello Chris. Other than the flicker of coincident faces, I have no problem going down to -90. I've added a "scale(1.001)" before "port(0)" as a workaround for them and I get this with -90: [image: Imágenes integradas 1] 2018-01-28 20:46 GMT+01:00 MDFChris <openscad@oddys.plus.com>: > Hi All > > I've just started using OpenSCAD and so far I'm liking it, it suits my > engineering mind however I'm having an issue with a simple hull ? > > I'm designing a nozzle for my 3D printer which seems simple enough using a > difference of two'd hull'd cubes: > > //Nozzle > nozzle(); > module nozzle(){ > difference(){ > port(1); > port(0); > } > } > module port(d){ > hull() { > cube([19.5+d*2,15+d*2,2],center=true); > translate([-10,4,15]) > rotate([0,-45,0]) > cube([7+d*2,14+d*2,2],center=true); > } > } > however if I increase the rotation angle of the outlet port beyond -45 > (i.e. > -50 or more) the open end starts to close up ?, I can't figure if I'm doing > something wrong or is this some sort of rounding error ? > > Chris > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > -- Saludos, Antonio
M
MDFChris
Mon, Jan 29, 2018 7:10 PM

Thanks  for the fixes, glad it wasn't something I was doing wrong, I can
understand how what I'm asking has pushed the sums close to the edge !

Chris

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

Thanks for the fixes, glad it wasn't something I was doing wrong, I can understand how what I'm asking has pushed the sums close to the edge ! Chris -- Sent from: http://forum.openscad.org/