[OpenSCAD] Newbie Hull problem

Jordan Brown openscad at jordan.maileater.net
Sun Jan 28 15:22:31 EST 2018


On 1/28/2018 12:14 PM, Jordan Brown wrote:
> 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 
Brain fart:  that should of course be "rounding error".
> 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.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180128/a4b44530/attachment-0002.html>


More information about the Discuss mailing list