Hello,
I have a simple polyhedron and I'm trying to attach a cube to it. My code is
below.
The preview looks like this:
http://forum.openscad.org/file/n16132/img1.png
The render looks like this:
http://forum.openscad.org/file/n16132/img2.png
If I remove the cube, it renders fine:
http://forum.openscad.org/file/n16132/img3.png
I've read a bunch of posts regarding this subject on the OpenSCAD forums and
a few other places and I can't seem to figure out why my object is not
rendering correctly.
If anyone can shed some light, I'd really appreciate it.
Here is my code:
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Most likely there are wrongly orientated triangles:
Have a look here:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids
Let's now see how to fix polyhedrons with badly oriented polygons. When you
select 'Thrown together' from the view menu and compile the design (not
compile and render!) you will see a preview with the mis-oriented polygons
highlighted. Unfortunately this highlighting is not possible in the OpenCSG
preview mode because it would interfere with the way the OpenCSG preview
mode is implemented.)
Below you can see such a problematic polyhedron, bad triangles are in pink.
2016-02-15 0:17 GMT+01:00 dknell d4v1dd@gmail.com:
Hello,
I have a simple polyhedron and I'm trying to attach a cube to it. My code
is
below.
The preview looks like this:
http://forum.openscad.org/file/n16132/img1.png
The render looks like this:
http://forum.openscad.org/file/n16132/img2.png
If I remove the cube, it renders fine:
http://forum.openscad.org/file/n16132/img3.png
I've read a bunch of posts regarding this subject on the OpenSCAD forums
and
a few other places and I can't seem to figure out why my object is not
rendering correctly.
If anyone can shed some light, I'd really appreciate it.
Here is my code:
--
View this message in context:
http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132.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
Hello
You must connect the top vertices of the top triangles. If you check the
part in wireframe mode "F11" you will see what I mean.
jpmendes
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16135.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hey
Check this.
Code:
$fn = 180;
size = 34;
side_a = size * sin(45);
side_b = size * cos(45);
side_c = size * tan(45);
tri_top_0 = [0,0,0];
tri_top_1 = [side_b,0,0];
tri_top_2 = [0,-side_a,0];
tri_bot_3 = [0,0,size];
tri_bot_4 = [side_b,0,size];
tri_bot_5 = [0,-side_a,size];
show_mount_plate = true;
mount_plate_thickness = 5;
union() {
polyhedron(
points=[
tri_top_0, tri_top_1, tri_top_2,
tri_bot_3, tri_bot_4, tri_bot_5,
],
// faces=[ [0,1,2], [3,4,5], [0,1,4,3], [1,2,5,4], [2,0,3,5] ]
faces=[ [1,0,2], [3,4,5], [1,2,5,4], [0,3,5,2] , [0,1,4,3 ] ]
);
if (show_mount_plate == true) {
translate([0,-side_b,0])
rotate([0,0,-45])
cube([mount_plate_thickness, size, size]);
}
}
jpmendes
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16137.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thanks for the help jpmendes and peter!
I was just reading about the "Point ordering for faces" in the manual
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#polyhedron
and it looks like my problem was with the order of points in the bottom
triangle going counter-clockwise instead of clockwise.
Thanks so much for the tips!
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16138.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hey
In fact it is sufficient to change the order of the points of the bottom
triangle only:
faces=[ [1,0,2], [4,3,5], [0,1,4,3], [1,2,5,4], [2,0,3,5] ] );
Can anybody explain why?
Thanks
jpmendes
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16139.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
According to the documentation, “ When looking at the face from the outside inwards, the points must be clockwise”. I incorrectly oriented the bottom triangle by looking from the inside outward.
On Feb 14, 2016, at 8:34 PM, jpmendes [via OpenSCAD] ml-node+s1091067n16139h13@n5.nabble.com wrote:
Hey
In fact it is sufficient to change the order of the points of the bottom triangle only:
faces=[ [1,0,2], [4,3,5], [0,1,4,3], [1,2,5,4], [2,0,3,5] ] );
Can anybody explain why?
Thanks
jpmendes
If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16139.html http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16139.html
To unsubscribe from polyhedron with cube not valid 2-manifold, click here http://forum.openscad.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=16132&code=ZDR2MWRkQGdtYWlsLmNvbXwxNjEzMnwxOTcwMjIwODAw.
NAML http://forum.openscad.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16140.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ok, I read the manual.
However I can't understand why this have to be this way. I do not imagine me
spending a lot of time making a complex polyhedron from points and having to
care about the order of points for each face.
I think that the language should infer the correct order and rearrange the
points order internally if necessary to avoid crashing or the type of issues
above.
As a minimum, an error message should be echoed reporting the faces with
problems.
jpmendes
--
View this message in context: http://forum.openscad.org/polyhedron-with-cube-not-valid-2-manifold-tp16132p16141.html
Sent from the OpenSCAD mailing list archive at Nabble.com.