[OpenSCAD] Unexpected behavior of difference()

Michael Marx michael.marx at tpg.com.au
Mon Jul 22 20:07:55 EDT 2019


Well that picture sort of overwhelmed the forum, resending...

 

Here is the picture, you just copy the /file/... part and add it to forum.openscad.org

 

 

 



 

 

 

That is doing what you have told it to do.

Your hole has a d=8 cylinder hollowed out by d=6 cylinder, so you have a tube.

You then difference the tube from the lid. You get a tube 'hole' with the pin in the middle.

 

 

> -----Original Message-----

> From: Discuss [mailto:discuss-bounces at lists.openscad.org] On Behalf Of GeorgeFlorian

> Sent: Mon, 22 Jul 2019 20:17

> To: discuss at lists.openscad.org

> Subject: [OpenSCAD] Unexpected behavior of difference()

> 

> Hello !

> 

> I am trying to make a screw hole inside a box lid.

> 

> The screw hole:

> 

> *module lid_screw_hole() {

>     difference() {

>         color("pink") cylinder(h=14,d=8,center=false);

>         color("blue") cylinder(h=14,d=6,center=false);

>     }

> }*

> 

> And the lid:

> 

> *module plain_lid() {

> translate([box_side-empty_space+10,0,0]) {

>     color("red") plain_box(box_side-empty_space, box_side, 4);

> 

>     difference() {

>         translate([wall,wall,0]) {

>             color("green") plain_box(box_side-empty_space-(wall*2),

> box_side-(wall*2), 14);

>         }

>         translate([wall*2,wall*2,0]) {

>             color("yellow") plain_box(box_side-empty_space-(wall*2)*2,

> box_side-(wall*2)*2, 14);

>         }

>     }

> }

> }*

> 

> 

> Naturally, I wanted to make a difference out of these two modules but

> something strange happens:

> 

> *difference() {

>     plain_lid();

>     translate([182, wall+2, 0]) lid_screw_hole();

> }*

> 

> </file/t2610/openscad1.png>

> 

> Making a *union()* doesn't help either. It just puts them together with no

> actual hole inside the cylinder.

> 

> Any thoughts ?

> 

> 

> 

> --

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

> 

> _______________________________________________

> OpenSCAD mailing list

> Discuss at lists.openscad.org

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



---
This email has been checked for viruses by AVG.
https://www.avg.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190723/0b51b9a2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 5843 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190723/0b51b9a2/attachment.jpg>


More information about the Discuss mailing list