Is there an easy way to optionally apply Modifier Characters (#%, etc) to a
subtree based upon the value of $preview?
I'd like to apply % to several objects in my model, but only when I am
rendering, not during preview.
Thanks!
Len
On 17.11.24 16:47, Leonard Martin Struttmann via Discuss wrote:
Is there an easy way to optionally apply Modifier Characters (#%, etc)
to a subtree based upon the value of $preview?
I'd like to apply % to several objects in my model, but only when I am
rendering, not during preview.
Both # and % are already sensitive to the preview/render mode.
Preview:
% show subtree as transparent separate objects
Render
% subtree is completely removed from render process
Using % only in render mode is useless as that has the same
effect as not writing that subtree at all.
This feels like the thing you want to achieve is a bit different
from the question you asked. Maybe just describe the effect you
want to see in both modes.
ciao,
Torsten.
Yeak, I really didn't think that through did I?
I'm building a box for an electronics project. I've got a bunch of PCBs
and other vitamins that get translated, rotated, etc. I want to see these
fully, colored, in preview. But I don't want them to be part of the
render.
Do I need to put each of these in an if block:
if ($preview)
{
translate(...)
rotate(...)
PCB();
}
,,,or is there some clever way to accomplish this?
Thanks!
Len
On Sun, Nov 17, 2024 at 9:57 AM Torsten Paul via Discuss <
discuss@lists.openscad.org> wrote:
On 17.11.24 16:47, Leonard Martin Struttmann via Discuss wrote:
Is there an easy way to optionally apply Modifier Characters (#%, etc)
to a subtree based upon the value of $preview?
I'd like to apply % to several objects in my model, but only when I am
rendering, not during preview.
Both # and % are already sensitive to the preview/render mode.
Preview:
% show subtree as transparent separate objects
Render
% subtree is completely removed from render process
Using % only in render mode is useless as that has the same
effect as not writing that subtree at all.
This feels like the thing you want to achieve is a bit different
from the question you asked. Maybe just describe the effect you
want to see in both modes.
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 17.11.24 17:15, Leonard Martin Struttmann wrote:
I'm building a box for an electronics project. I've got a bunch of PCBs
and other vitamins that get translated, rotated, etc. I want to see
these fully, colored, in preview. But I don't want them to be part of
the render.
Right, so pretty much like what I'm printing right now:
https://imgur.com/a/TMMDD0U
I'm not seeing anything wrong with just using $preview but I'm
doing that inside the module defining the preview display with
an optional alpha parameter in case I want it transparent. In
the main/assembly view I just use esp32s3_zero() without any
additional modifier needed to make it disappear in render.
module esp32s3_zero(alpha = 1) {
if ($preview) {
w2 = esp32s3_width / 2;
color("green", alpha = alpha)
translate([0, -w2, 0])
cube([esp32s3_length, esp32s3_width, esp32s3_thickness]);
...
}
}
ciao,
Torsten.
Is there an easy way to optionally apply Modifier Characters (#%, etc) to a subtree based upon the value of $preview?
Write a module that applies the modifier to its children, or doesn’t.
module percentIf(flag) {
If (flag) {
%children();
} else {
children();
}
}
percentIf($preview) cube();
If (flag) {
I’m typing this on my iPad and didn’t notice the automatically uppercased I. It should be lower case, of course.
Thanks everyone! Just the tips that I needed. Len
On Sun, Nov 17, 2024 at 10:39 AM Jordan Brown openscad@jordan.maileater.net
wrote:
If (flag) {
I’m typing this on my iPad and didn’t notice the automatically uppercased
I. It should be lower case, of course.