discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Unexpected behavior of difference()

G
GeorgeFlorian
Mon, Jul 22, 2019 10:17 AM

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-(wall2), 14);
}
translate([wall
2,wall2,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/

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/
A
arnholm@arnholm.org
Mon, Jul 22, 2019 10:56 AM

On 2019-07-22 12:17, GeorgeFlorian wrote:

Any thoughts ?

Your code fragments are incomplete (many variables are undefined), there
is no way to know. Try attaching the complete source.

Carsten Arnholm

On 2019-07-22 12:17, GeorgeFlorian wrote: > Any thoughts ? Your code fragments are incomplete (many variables are undefined), there is no way to know. Try attaching the complete source. Carsten Arnholm
NH
nop head
Mon, Jul 22, 2019 11:22 AM

Also the picture isn't visible because the forum software is broken at the
moment.

Why are you drilling a hole with a tube and not a cylinder?

The inner cylinder making the tube should be longer than the outer cylinder
to prevent shimmering ends.

On Mon, 22 Jul 2019 at 11:57, arnholm@arnholm.org wrote:

On 2019-07-22 12:17, GeorgeFlorian wrote:

Any thoughts ?

Your code fragments are incomplete (many variables are undefined), there
is no way to know. Try attaching the complete source.

Carsten Arnholm


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

Also the picture isn't visible because the forum software is broken at the moment. Why are you drilling a hole with a tube and not a cylinder? The inner cylinder making the tube should be longer than the outer cylinder to prevent shimmering ends. On Mon, 22 Jul 2019 at 11:57, <arnholm@arnholm.org> wrote: > On 2019-07-22 12:17, GeorgeFlorian wrote: > > Any thoughts ? > > Your code fragments are incomplete (many variables are undefined), there > is no way to know. Try attaching the complete source. > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
MM
Michael Marx
Mon, Jul 22, 2019 11:22 PM

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@lists.openscad.org] On Behalf Of GeorgeFlorian

Sent: Mon, 22 Jul 2019 20:17

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 ?

--


OpenSCAD mailing list


This email has been checked for viruses by AVG.
https://www.avg.com

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@lists.openscad.org] On Behalf Of GeorgeFlorian > Sent: Mon, 22 Jul 2019 20:17 > To: discuss@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@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
MM
Michael Marx
Tue, Jul 23, 2019 12:07 AM

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@lists.openscad.org] On Behalf Of GeorgeFlorian

Sent: Mon, 22 Jul 2019 20:17

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 ?

--


OpenSCAD mailing list


This email has been checked for viruses by AVG.
https://www.avg.com

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@lists.openscad.org] On Behalf Of GeorgeFlorian > Sent: Mon, 22 Jul 2019 20:17 > To: discuss@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@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