use
--render
instead of
--preview
if you are "in" the box that gets cut away preview can lead to weird output
greetings
Philipp
On Fri, Nov 4, 2022 at 3:03 PM neri-engineering via Discuss
discuss@lists.openscad.org wrote:
---------- Forwarded message ----------
From: neri-engineering neri-engineering@protonmail.com
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc:
Bcc:
Date: Fri, 04 Nov 2022 14:01:45 +0000
Subject: [OpenSCAD] Strange bug, cmd-line, projection, camera, unorthodox
I stumbled upon a strange bug which will probably seldom surface. First I'll describe the bug, then I'll explain little changes that make the bug go away, then I'll allude to a related bug which I don't have code for.
I'm using OpenSCAD 2021.01, the one bundled with Ubuntu 22.10.
To demonstrate the bug I have a ".scad" file and I have a UNIX shell script. The SCAD file, called "cutaway-bug.scad":
difference() {
cylinder(h=9, r=20, center=true, $fn=32);
translate([64, 64, 0]) {
cube(size=[128, 128, 128], center=true); }
}
And the shell script:
#!/bin/sh
openscad --imgsize=640,480
--preview
--projection="perspective"
--camera=127,46.3,-45,0,0,0
--colorscheme="DeepOcean"
-o "persp.png"
"cutaway-bug.scad"
I'm attaching two images; the first image, "persp.png", shows the bug - the cylinder does not have a cutout.
If we take the shell script above and change projection to "ortho", we get the second image attached, "ortho.png", which looks correct.
Please note, above I'm using the six-argument "--camera" option, which is likely seldom used, as opposed to the seven-argument "--camera" option. Both are documented on the UNIX man page for openscad. If I recall correctly simply switching to the seven-argument "--camera" fixes the problem also. Furthermore, changing the position of camera slightly in the six-arg camera above also fixes the problem.
One more thing, for which I don't have code that's simplified - If the object being rendered is changed from being a simple cylinder, to being something complex like a spur gear which uses linear_extrude(), then the object being rendered after the difference() seems to be an intersection() instead. Meaning, the gear that's rendered erroneously would be just the front quadrant and not the three-quarters of the gear that would remain after a difference(). I don't have code for this because it's more code to list here, and I am guessing that the two bugs are very related.
Once again, this bug happens only when the perspective projection is used with conjunction of the six-arg camera, when the camera is at certain locations, and probably only when OpenSCAD is used from command-line (which is a very useful feature in my opinion).
Sent with Proton Mail secure email.
---------- Forwarded message ----------
From: neri-engineering via Discuss discuss@lists.openscad.org
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc: neri-engineering neri-engineering@protonmail.com
Bcc:
Date: Fri, 04 Nov 2022 14:01:45 +0000
Subject: [OpenSCAD] Strange bug, cmd-line, projection, camera, unorthodox
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org