Welcome! Log In Create A New Profile

Advanced

how can i prevent those sliver things on substraction?

Posted by emaayan 
how can i prevent those sliver things on substraction?
February 18, 2018 03:49PM
this happens on preview when i try to subtract objects
but after doing render it looks ok, i keep, have to play with offseting z or the height of object by a fraction of 0.001 or 0.0002 to make it look ok in preview as well..


Re: how can i prevent those sliver things on substraction?
February 18, 2018 04:13PM
You need to make sure that the object you are subtracting extends beyond the surface of the object you are subtracting it from, instead of the two surfaces coinciding. Example:

overlap = 0.02;

module tube(outer_radius, inner_radius, height) {
  difference() {
    cylinder(r=outer_radius, h=height);
    translate([0, 0, -overlap]) cylinder(r=inner_radius, h=height+2*overlap);
  }
}

tube(10,8,5);

In this code the cylinder we are subtracting extends by 'overlap' above and below the one we are subtracting it from. I always use a variable called 'overlap' for this so that it is clear in the code what adding these small amounts is for.

Edited 2 time(s). Last edit at 02/18/2018 04:14PM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: how can i prevent those sliver things on substraction?
February 18, 2018 05:13PM
thanks, couldn't there be a generic method with some form of scale and resize play here?
Re: how can i prevent those sliver things on substraction?
February 19, 2018 05:41PM
well for some reason i'm still getting this, and i have no idea what's it's even called, but i can see through the walls..
Attachments:
open | download - FE5O0t1[1].png (210.6 KB)
open | download - test_sin.scad (2.4 KB)
Re: how can i prevent those sliver things on substraction?
February 20, 2018 12:10AM
the following minor changes works for me...

module main(){  
      
     difference(){               
            drawHoles(manArr){                            
                  cylinder(d=holderDiameter,h=8);                                       
            }                                     
             difference(){
                drawHoles(manArr){
                    translate([0,0,-1]) cylinder(d=cellDiameter-1,h=10);       
                 }
             }
     }       
}

h of 10 is just your 8+2 translated down 1mm so 1mm protrudes top and bottom so it draws cleanly

Edited 2 time(s). Last edit at 02/20/2018 12:14AM by Dust.
Re: how can i prevent those sliver things on substraction?
February 20, 2018 01:55AM
thanks i was trying to come up with a generic module for this..
Re: how can i prevent those sliver things on substraction?
February 20, 2018 01:57AM
thanks i was trying to come up with a generic module for this..that's what the overlap module was for, i started searching and thought it was a bug in openscad
Sorry, only registered users may post in this forum.

Click here to login