Dear group,
is there a way to mark solids for „absolute subtraction“, that is, for subtraction also from all parent nodes upwards in the hierarchy?
I'm relatively frequently faced with the challenge of creating submodules that use difference() for clearing a part of the submodule. Sometimes such cleared space is supposed to kept clear even if the submodule is unioned with other modules, that is, it should be subtracted there as well. If however the submodule is transformed in a complicated way before it is combined with the parent nodes, it is necessary but very difficult to repeat the transform for subtracting a remake of the cutting solid from the parent directly.
Best regards,
Carsten
No, but you never need to repeat anything in OpenSCAD. You can make the
complicated transformation into a module that has a child and use it
multiple times. For example I have modules to translate a child to the
screw positions of lots of my objects. That is used to make the screw hole
in the object, the matching clearance hole in the panel it gets screwed to
and also places the screws.
On Thu, 3 Feb 2022 at 08:38, Carsten Fuchs carsten.fuchs@cafu.de wrote:
Dear group,
is there a way to mark solids for „absolute subtraction“, that is, for
subtraction also from all parent nodes upwards in the hierarchy?
I'm relatively frequently faced with the challenge of creating submodules
that use difference() for clearing a part of the submodule. Sometimes such
cleared space is supposed to kept clear even if the submodule is unioned
with other modules, that is, it should be subtracted there as well. If
however the submodule is transformed in a complicated way before it is
combined with the parent nodes, it is necessary but very difficult to
repeat the transform for subtracting a remake of the cutting solid from the
parent directly.
Best regards,
Carsten
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Many thanks for your quick reply!
I did indeed not think of modules that can have children.
However, this only works if you are the maker of the submodule, does it?
If I used something complicated from someone else, where I have not easy access to the subtracted parts, it doesn't work?
An example would be an open, empty box, e.g. a housing for a circuit board, that is to be embedded into something else, e.g. a base plate that is not flush to the bottom of the box, but at the half height of it.
A normal union would make the base plate visible inside the box and so we have to figure out something to remove it from there, which can be a very difficult problem.
(With this thought, I'd modify my original question a bit: Is there a way to have a union() that unions its children but keeps (applies) all their nested subtractions?)
Best regards,
Carsten
Am 03.02.22 um 09:44 schrieb nop head:
No, but you never need to repeat anything in OpenSCAD. You can make the complicated transformation into a module that has a child and use it multiple times. For example I have modules to translate a child to the screw positions of lots of my objects. That is used to make the screw hole in the object, the matching clearance hole in the panel it gets screwed to and also places the screws.
On Thu, 3 Feb 2022 at 08:38, Carsten Fuchs <carsten.fuchs@cafu.de mailto:carsten.fuchs@cafu.de> wrote:
Dear group,
is there a way to mark solids for „absolute subtraction“, that is, for subtraction also from all parent nodes upwards in the hierarchy?
I'm relatively frequently faced with the challenge of creating submodules that use difference() for clearing a part of the submodule. Sometimes such cleared space is supposed to kept clear even if the submodule is unioned with other modules, that is, it should be subtracted there as well. If however the submodule is transformed in a complicated way before it is combined with the parent nodes, it is necessary but very difficult to repeat the transform for subtracting a remake of the cutting solid from the parent directly.
Best regards,
Carsten
It would work if the submodule was written in the same style but not in the
general case if it had holes in it that were not positioned with a module
or function that it exposed.
Perhaps you can use a projection() to get the shape of the bottom of the
box including its holes. Your baseplate could then have the hull of the
projection offset inwards slightly subtracted from it and a linear
extrusion of the projection added to it.
On Thu, 3 Feb 2022 at 09:09, Carsten Fuchs carsten.fuchs@cafu.de wrote:
Many thanks for your quick reply!
I did indeed not think of modules that can have children.
However, this only works if you are the maker of the submodule, does it?
If I used something complicated from someone else, where I have not easy
access to the subtracted parts, it doesn't work?
An example would be an open, empty box, e.g. a housing for a circuit
board, that is to be embedded into something else, e.g. a base plate that
is not flush to the bottom of the box, but at the half height of it.
A normal union would make the base plate visible inside the box and so we
have to figure out something to remove it from there, which can be a very
difficult problem.
(With this thought, I'd modify my original question a bit: Is there a way
to have a union() that unions its children but keeps (applies) all their
nested subtractions?)
Best regards,
Carsten
Am 03.02.22 um 09:44 schrieb nop head:
No, but you never need to repeat anything in OpenSCAD. You can make the
complicated transformation into a module that has a child and use it
multiple times. For example I have modules to translate a child to the
screw positions of lots of my objects. That is used to make the screw hole
in the object, the matching clearance hole in the panel it gets screwed to
and also places the screws.
On Thu, 3 Feb 2022 at 08:38, Carsten Fuchs <carsten.fuchs@cafu.de
mailto:carsten.fuchs@cafu.de> wrote:
Dear group,
is there a way to mark solids for „absolute subtraction“, that is,
for subtraction also from all parent nodes upwards in the hierarchy?
I'm relatively frequently faced with the challenge of creating
submodules that use difference() for clearing a part of the submodule.
Sometimes such cleared space is supposed to kept clear even if the
submodule is unioned with other modules, that is, it should be subtracted
there as well. If however the submodule is transformed in a complicated way
before it is combined with the parent nodes, it is necessary but very
difficult to repeat the transform for subtracting a remake of the cutting
solid from the parent directly.
Best regards,
Carsten
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
The example with the box was in fact only an example. I experience this problem frequently in more general and more complicated cases, both with self-made submodels or with the occassional library import.
After another iteration thinking about this, maybe it would be ideal if we had a union() variant that:
a) unioned all solids in all children,
b) unioned all subtracted objects in all children (and grandchildren)
c) computed a - b
Pre-cutting holes using a hull (with offsets as needed) and then inserting the actual submodule into the cleared space is (similar to) what I do now. It works, but if there was a boolean operator like the modified union() described above, things would be a lot simpler.
Thanks for your kind help!
Best regards,
Carsten
Am 03.02.22 um 10:18 schrieb nop head:
It would work if the submodule was written in the same style but not in the general case if it had holes in it that were not positioned with a module or function that it exposed.
Perhaps you can use a projection() to get the shape of the bottom of the box including its holes. Your baseplate could then have the hull of the projection offset inwards slightly subtracted from it and a linear extrusion of the projection added to it.
On Thu, 3 Feb 2022 at 09:09, Carsten Fuchs <carsten.fuchs@cafu.de mailto:carsten.fuchs@cafu.de> wrote:
Many thanks for your quick reply!
I did indeed not think of modules that can have children.
However, this only works if you are the maker of the submodule, does it?
If I used something complicated from someone else, where I have not easy access to the subtracted parts, it doesn't work?
An example would be an open, empty box, e.g. a housing for a circuit board, that is to be embedded into something else, e.g. a base plate that is not flush to the bottom of the box, but at the half height of it.
A normal union would make the base plate visible inside the box and so we have to figure out something to remove it from there, which can be a very difficult problem.
(With this thought, I'd modify my original question a bit: Is there a way to have a union() that unions its children but keeps (applies) all their nested subtractions?)
Best regards,
Carsten
Am 03.02.22 um 09:44 schrieb nop head:
No, but you never need to repeat anything in OpenSCAD. You can make the complicated transformation into a module that has a child and use it multiple times. For example I have modules to translate a child to the screw positions of lots of my objects. That is used to make the screw hole in the object, the matching clearance hole in the panel it gets screwed to and also places the screws.
On Thu, 3 Feb 2022 at 08:38, Carsten Fuchs <carsten.fuchs@cafu.de mailto:carsten.fuchs@cafu.de <mailto:carsten.fuchs@cafu.de mailto:carsten.fuchs@cafu.de>> wrote:
Dear group,
is there a way to mark solids for „absolute subtraction“, that is, for subtraction also from all parent nodes upwards in the hierarchy?
I'm relatively frequently faced with the challenge of creating submodules that use difference() for clearing a part of the submodule. Sometimes such cleared space is supposed to kept clear even if the submodule is unioned with other modules, that is, it should be subtracted there as well. If however the submodule is transformed in a complicated way before it is combined with the parent nodes, it is necessary but very difficult to repeat the transform for subtracting a remake of the cutting solid from the parent directly.
Best regards,
Carsten
My solution to this was to add flags to modules like this to control
whether positive objects, negative objects, or the difference should be
rendered...
On Thu, Feb 3, 2022 at 10:29 AM Carsten Fuchs carsten.fuchs@cafu.de wrote:
The example with the box was in fact only an example. I experience this
problem frequently in more general and more complicated cases, both with
self-made submodels or with the occassional library import.
After another iteration thinking about this, maybe it would be ideal if we
had a union() variant that:
a) unioned all solids in all children,
b) unioned all subtracted objects in all children (and grandchildren)
c) computed a - b
Pre-cutting holes using a hull (with offsets as needed) and then inserting
the actual submodule into the cleared space is (similar to) what I do now.
It works, but if there was a boolean operator like the modified union()
described above, things would be a lot simpler.
Thanks for your kind help!
Best regards,
Carsten
Am 03.02.22 um 10:18 schrieb nop head:
It would work if the submodule was written in the same style but not in
the general case if it had holes in it that were not positioned with a
module or function that it exposed.
Perhaps you can use a projection() to get the shape of the bottom of the
box including its holes. Your baseplate could then have the hull of the
projection offset inwards slightly subtracted from it and a linear
extrusion of the projection added to it.
On Thu, 3 Feb 2022 at 09:09, Carsten Fuchs <carsten.fuchs@cafu.de
mailto:carsten.fuchs@cafu.de> wrote:
Many thanks for your quick reply!
I did indeed not think of modules that can have children.
However, this only works if you are the maker of the submodule, does
it?
If I used something complicated from someone else, where I have not
easy access to the subtracted parts, it doesn't work?
An example would be an open, empty box, e.g. a housing for a circuit
board, that is to be embedded into something else, e.g. a base plate that
is not flush to the bottom of the box, but at the half height of it.
A normal union would make the base plate visible inside the box and
so we have to figure out something to remove it from there, which can be a
very difficult problem.
(With this thought, I'd modify my original question a bit: Is there
a way to have a union() that unions its children but keeps (applies) all
their nested subtractions?)
Best regards,
Carsten
Am 03.02.22 um 09:44 schrieb nop head:
No, but you never need to repeat anything in OpenSCAD. You can
make the complicated transformation into a module that has a child and use
it multiple times. For example I have modules to translate a child to the
screw positions of lots of my objects. That is used to make the screw hole
in the object, the matching clearance hole in the panel it gets screwed to
and also places the screws.
On Thu, 3 Feb 2022 at 08:38, Carsten Fuchs <carsten.fuchs@cafu.de
mailto:carsten.fuchs@cafu.de <mailto:carsten.fuchs@cafu.de <mailto:
carsten.fuchs@cafu.de>>> wrote:
Dear group,
is there a way to mark solids for „absolute subtraction“, that
is, for subtraction also from all parent nodes upwards in the hierarchy?
I'm relatively frequently faced with the challenge of creating
submodules that use difference() for clearing a part of the submodule.
Sometimes such cleared space is supposed to kept clear even if the
submodule is unioned with other modules, that is, it should be subtracted
there as well. If however the submodule is transformed in a complicated way
before it is combined with the parent nodes, it is necessary but very
difficult to repeat the transform for subtracting a remake of the cutting
solid from the parent directly.
Best regards,
Carsten
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 03.02.22 16:29, Carsten Fuchs wrote:
It works, but if there was a boolean operator like the
modified union() described above, things would be a lot
simpler.
That has been claimed often, but nobody really went ahead
and really showed this working for the general case.
I guess we have to wait for someone taking the time and
really show how to express that and make it work without
surprises all the time.
ciao,
Torsten.
Am 03.02.22 um 17:51 schrieb Torsten Paul:
On 03.02.22 16:29, Carsten Fuchs wrote:
It works, but if there was a boolean operator like the
modified union() described above, things would be a lot
simpler.
[...]
show how to express that and make it work without
surprises all the time.
You don't believe it's feasible?
Best regards,
Carsten
On 03.02.22 17:57, Carsten Fuchs wrote:
You don't believe it's feasible?
I'm not sure. It might be, maybe it needs some sort of
clear rules to work.
Example:
Have a 5mm LED clip thingy, e.g. a tube with outer
diameter of 10mm and inner diameter of about 5mm
and some clips to grip the LED.
Now I want to put that into the wall of a box.
$fa = 4; $fs = 0.4;
eps = 0.01;
module clip() {
rotate([0, -90, 0])
if ($positive) {
// some tube with outer dia of 10mm
linear_extrude(10, center = true)
difference() { circle(10); circle(5.2); }
} else {
// cut hole of slightly less than 10mm
// how to decide the value for h?
// if too small, it will not cut enough, if too
// big it might interfere with other geometry
// h = 12 -> too small
// h = 20 -> awesome!
// h = 200 -> oops
#cylinder(h = 200, r = 10 - eps, center = true);
}
}
module case() {
translate([-23, 0, 0])
linear_extrude(30, center = true, convexity = 3)
difference() { circle(30); circle(25); }
}
module design() {
difference() {
case();
clip($positive = false);
}
clip($positive = true);
}
design();
I'm not sure of what you are trying to explain. I see it as you have a
clip, which you want to place in a hole (which is a smaller diameter
than the OD of the clip by eps ). The hole is associated with the case,
and needs to be long enough to penetrate the case wall, but since you
have chosen a curved side for the hole, then it needs to be longer than
if it were a flat side. The hole is part of the case, not part of the
clip, at least that's how I see it. I use openscad to simulate what and
how I would build whatever in practice, so the case would have the hole.
There is no point in designing something that I can not build.
Best wishes,
Ray
On 03/02/2022 17:22, Torsten Paul wrote:
On 03.02.22 17:57, Carsten Fuchs wrote:
You don't believe it's feasible?
I'm not sure. It might be, maybe it needs some sort of
clear rules to work.
Example:
Have a 5mm LED clip thingy, e.g. a tube with outer
diameter of 10mm and inner diameter of about 5mm
and some clips to grip the LED.
Now I want to put that into the wall of a box.
$fa = 4; $fs = 0.4;
eps = 0.01;
module clip() {
rotate([0, -90, 0])
if ($positive) {
// some tube with outer dia of 10mm
linear_extrude(10, center = true)
difference() { circle(10); circle(5.2); }
} else {
// cut hole of slightly less than 10mm
// how to decide the value for h?
// if too small, it will not cut enough, if too
// big it might interfere with other geometry
// h = 12 -> too small
// h = 20 -> awesome!
// h = 200 -> oops
#cylinder(h = 200, r = 10 - eps, center = true);
}
}
module case() {
translate([-23, 0, 0])
linear_extrude(30, center = true, convexity = 3)
difference() { circle(30); circle(25); }
}
module design() {
difference() {
case();
clip($positive = false);
}
clip($positive = true);
}
design();
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org