discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Preserve "holes" in module objects

J
jellsworth
Sat, May 2, 2015 1:29 AM

Apologies if this is an old question or too basic. I have been looking, but I
have not found an answer.

My issue is, I am using a module to create a somewhat complex object, let's
say a cube with a threaded hole. I then want to use that module multiple
times in a union with a larger object, let's say to add feet to a larger
cube that can accept bolts. My obvious problem is that in the union, the
larger object fills in the threaded hole I carefully created in my module.

I realize that I could fix this by creating and calling separate modules for
the smaller cubes and the threaded holes, but that gets unwieldy quickly as
that module object gets more complex.

Is there a way to preserve critical "empty space" in an object created by a
module, even when embedded in another object?

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Apologies if this is an old question or too basic. I have been looking, but I have not found an answer. My issue is, I am using a module to create a somewhat complex object, let's say a cube with a threaded hole. I then want to use that module multiple times in a union with a larger object, let's say to add feet to a larger cube that can accept bolts. My obvious problem is that in the union, the larger object fills in the threaded hole I carefully created in my module. I realize that I could fix this by creating and calling separate modules for the smaller cubes and the threaded holes, but that gets unwieldy quickly as that module object gets more complex. *Is there a way to preserve critical "empty space" in an object created by a module, even when embedded in another object?* -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jellsworth
Sat, May 2, 2015 1:42 AM

Small example:
union() {        cube([300,300,300]);              translate([100, 100,
220]) { //only leaves 20mm hole            subpart();        }
}module subpart() {    difference() { //should have 90mm hole
cube([100,100,100]);        translate([50, 50, 10]) {
cylinder(r=10, h=100);        }    }}

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12540.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Small example: union() { cube([300,300,300]); translate([100, 100, 220]) { //only leaves 20mm hole subpart(); } }module subpart() { difference() { //should have 90mm hole cube([100,100,100]); translate([50, 50, 10]) { cylinder(r=10, h=100); } }} -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12540.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Sat, May 2, 2015 3:21 AM

On May 1, 2015, at 21:29 PM, jellsworth jerry.ellsworth@gmail.com wrote:

Is there a way to preserve critical "empty space" in an object created by a
module, even when embedded in another object?

Interesting question.
The typical way of solving this is to perform unions first, then differences. This would require you to split up your modular objects in two though.
What you’re after sounds a bit like a “mask”. Not sure how we would implement that though, but ideas are welcome.

-Marius

On May 1, 2015, at 21:29 PM, jellsworth <jerry.ellsworth@gmail.com> wrote: > *Is there a way to preserve critical "empty space" in an object created by a > module, even when embedded in another object?* > Interesting question. The typical way of solving this is to perform unions first, then differences. This would require you to split up your modular objects in two though. What you’re after sounds a bit like a “mask”. Not sure how we would implement that though, but ideas are welcome. -Marius
JD
Jerry Davis
Sat, May 2, 2015 3:27 AM

you know, I have wondered this too.
I come from a OO programming background.

I kinda consider a module as an object (sort of). And it would be nice if
whatever the module "produced" remained intact.
So, If I made a union() with that module, it would add whatever the module
produced to the final result.
Same with difference(), whatever the module "produced" would be
differenced() (if it was second ... n in line of course)
etc.

Is that what you are looking for?

Jerry

--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

I
*f you give someone a program, you will frustrate them for a day; if you
teach them how to program, you will frustrate them for a lifetime. *-
Anonymous

If writing good code requires very little comments, then writing really
excellent code requires no comments at all!
- Ken Thompson

On Fri, May 1, 2015 at 8:21 PM, Marius Kintel marius@kintel.net wrote:

On May 1, 2015, at 21:29 PM, jellsworth jerry.ellsworth@gmail.com wrote:

*Is there a way to preserve critical "empty space" in an object created

by a

module, even when embedded in another object?*

Interesting question.
The typical way of solving this is to perform unions first, then
differences. This would require you to split up your modular objects in two
though.
What you’re after sounds a bit like a “mask”. Not sure how we would
implement that though, but ideas are welcome.

-Marius


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

you know, I have wondered this too. I come from a OO programming background. I kinda consider a module as an object (sort of). And it would be nice if whatever the module "produced" remained intact. So, If I made a union() with that module, it would add whatever the module produced to the final result. Same with difference(), whatever the module "produced" would be differenced() (if it was second ... n in line of course) etc. Is that what you are looking for? Jerry -- Extra Ham Operator: K7AZJ Registered Linux User: 275424 Raspberry Pi and Arduino developer *The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny...".*- Isaac. Asimov *I* *f you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. *- Anonymous *If writing good code requires very little comments, then writing really excellent code requires no comments at all!*- Ken Thompson On Fri, May 1, 2015 at 8:21 PM, Marius Kintel <marius@kintel.net> wrote: > On May 1, 2015, at 21:29 PM, jellsworth <jerry.ellsworth@gmail.com> wrote: > > > *Is there a way to preserve critical "empty space" in an object created > by a > > module, even when embedded in another object?* > > > Interesting question. > The typical way of solving this is to perform unions first, then > differences. This would require you to split up your modular objects in two > though. > What you’re after sounds a bit like a “mask”. Not sure how we would > implement that though, but ideas are welcome. > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
H
hagen
Sat, May 2, 2015 12:01 PM

in theory the following works:

union()
{
difference()
{
cube([300,300,300]);
position() hull () subpart();
}
position() subpart();
}

module position()
{
translate([100,100,220]) children(0);
}

module subpart()
{
difference()
{
cube([100,100,100]);
translate([50, 50, 10]) cylinder(r=10, h=100);
}
}

in practice it is probably a bit expensive and it could lead to non-manifold
models

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12545.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

in theory the following works: union() { difference() { cube([300,300,300]); position() hull () subpart(); } position() subpart(); } module position() { translate([100,100,220]) children(0); } module subpart() { difference() { cube([100,100,100]); translate([50, 50, 10]) cylinder(r=10, h=100); } } in practice it is probably a bit expensive and it could lead to non-manifold models -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12545.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jellsworth
Sat, May 2, 2015 4:22 PM

Yes, that is the thought. Would be nice!

Thanks,
Jerry E

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12547.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Yes, that is the thought. Would be nice! Thanks, Jerry E -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12547.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jellsworth
Sat, May 2, 2015 4:26 PM

Thanks.

I guess I have confirmed I am not missing something simple, and I found
Jeremie Francois' Part 4 tutorial on children which gives an example
addressing this issue:
http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html

To me that helps minimize the pain, but it is complicated and doesn't fix
the underlying issue. I guess I will get used to working around it.

Thanks,
Jerry E

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12548.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thanks. I guess I have confirmed I am not missing something simple, and I found Jeremie Francois' Part 4 tutorial on children which gives an example addressing this issue: http://www.tridimake.com/2014/11/how-to-use-openscad-4-children-and.html To me that helps minimize the pain, but it is complicated and doesn't fix the underlying issue. I guess I will get used to working around it. Thanks, Jerry E -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12548.html Sent from the OpenSCAD mailing list archive at Nabble.com.
S
stonysmith
Sat, May 2, 2015 4:28 PM

(humor)

We just need a way to specify the material for each part.

Then you can simply use:
cylinder(r=1,h=100,material=antimatter);

(/humor)

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12549.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

(humor) We just need a way to specify the material for each part. Then you can simply use: cylinder(r=1,h=100,material=antimatter); (/humor) -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12549.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jellsworth
Sat, May 2, 2015 4:32 PM

Now that's funny, but I think it might work! :-)

-Jerry E

--
View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12550.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Now that's funny, but I think it might work! :-) -Jerry E -- View this message in context: http://forum.openscad.org/Preserve-holes-in-module-objects-tp12539p12550.html Sent from the OpenSCAD mailing list archive at Nabble.com.
YS
Yvette S. Hirth, CCP, CDP
Sat, May 2, 2015 4:41 PM

hi,

i'm trying to 3d print a heart symbol.  i'm using write.scad.

i've tried unicode 2665 and cut-and-pasting a heart symbol.  neither
work; the space where the heart should go remains blank.

i'm sure the problem is that the heart symbol is not defined in
"letters.dxf".  i've found other .dxf files but none seem to have a
heart symbol defined.

i did find a bracelet with hearts on thingiverse, but sadly, only the
.stl files are downloadable.

anybody have any ideas?  i appreciate all comments!

thanks
-y-

hi, i'm trying to 3d print a heart symbol. i'm using write.scad. i've tried unicode 2665 and cut-and-pasting a heart symbol. neither work; the space where the heart should go remains blank. i'm sure the problem is that the heart symbol is not defined in "letters.dxf". i've found other .dxf files but none seem to have a heart symbol defined. i did find a bracelet with hearts on thingiverse, but sadly, only the .stl files are downloadable. anybody have any ideas? i appreciate all comments! thanks -y-