discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Can't get difference() to work

L
lmcc
Thu, Apr 28, 2016 6:49 PM

When I run this I just see a solid 6x6x6 inch cube. Why is it not hollowed
out?
I'm on Ubuntu 14.04 and version 2014.01.29 (from the ppa).

itomm = 25.4;                  // conversion factor from inches to mm

length = 6 * itomm;            // x
width = 6 * itomm;            // y
height = 6 * itomm;            // z
thickness = .35 * itomm;      // thickness of the walls

module hollow_box(xlen, ylen, zlen, thikness)  {
difference()  {
cube([xlen, ylen, zlen]);
translate([thikness, thikness, thikness])  {
cube(xlen-2thikness, ylen-2thikness, zlen+100);
}
}
}

hollow_box(length, width, height, thickness);        // x, y, z

--
View this message in context: http://forum.openscad.org/Can-t-get-difference-to-work-tp17218.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

When I run this I just see a solid 6x6x6 inch cube. Why is it not hollowed out? I'm on Ubuntu 14.04 and version 2014.01.29 (from the ppa). itomm = 25.4; // conversion factor from inches to mm length = 6 * itomm; // x width = 6 * itomm; // y height = 6 * itomm; // z thickness = .35 * itomm; // thickness of the walls module hollow_box(xlen, ylen, zlen, thikness) { difference() { cube([xlen, ylen, zlen]); translate([thikness, thikness, thikness]) { cube(xlen-2*thikness, ylen-2*thikness, zlen+100); } } } hollow_box(length, width, height, thickness); // x, y, z -- View this message in context: http://forum.openscad.org/Can-t-get-difference-to-work-tp17218.html Sent from the OpenSCAD mailing list archive at Nabble.com.
GG
Gaston Gloesener
Thu, Apr 28, 2016 7:07 PM

You forgot the brackets [] in the second cube statement

-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
lmcc
Sent: Thursday, April 28, 2016 8:49 PM
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Can't get difference() to work

When I run this I just see a solid 6x6x6 inch cube. Why is it not
hollowed out?
I'm on Ubuntu 14.04 and version 2014.01.29 (from the ppa).

itomm = 25.4;                  // conversion factor from inches to mm

length = 6 * itomm;            // x
width = 6 * itomm;            // y
height = 6 * itomm;            // z
thickness = .35 * itomm;      // thickness of the walls

module hollow_box(xlen, ylen, zlen, thikness)  {
difference()  {
cube([xlen, ylen, zlen]);
translate([thikness, thikness, thikness])  {
cube(xlen-2thikness, ylen-2thikness, zlen+100);
}
}
}

hollow_box(length, width, height, thickness);        // x, y, z

--
View this message in context: http://forum.openscad.org/Can-t-get-
difference-to-work-tp17218.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

You forgot the brackets [] in the second cube statement > -----Original Message----- > From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of > lmcc > Sent: Thursday, April 28, 2016 8:49 PM > To: discuss@lists.openscad.org > Subject: [OpenSCAD] Can't get difference() to work > > When I run this I just see a solid 6x6x6 inch cube. Why is it not > hollowed out? > I'm on Ubuntu 14.04 and version 2014.01.29 (from the ppa). > > itomm = 25.4; // conversion factor from inches to mm > > length = 6 * itomm; // x > width = 6 * itomm; // y > height = 6 * itomm; // z > thickness = .35 * itomm; // thickness of the walls > > > module hollow_box(xlen, ylen, zlen, thikness) { > difference() { > cube([xlen, ylen, zlen]); > translate([thikness, thikness, thikness]) { > cube(xlen-2*thikness, ylen-2*thikness, zlen+100); > } > } > } > > hollow_box(length, width, height, thickness); // x, y, z > > > > > > -- > View this message in context: http://forum.openscad.org/Can-t-get- > difference-to-work-tp17218.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
L
lmcc
Thu, Apr 28, 2016 7:48 PM

Thank you. It works now.

--
View this message in context: http://forum.openscad.org/Can-t-get-difference-to-work-tp17218p17220.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thank you. It works now. -- View this message in context: http://forum.openscad.org/Can-t-get-difference-to-work-tp17218p17220.html Sent from the OpenSCAD mailing list archive at Nabble.com.