Quantcast

polyhedron to a 3D printing from

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

polyhedron to a 3D printing from

Cole
i have a polyhedron on openscad and i want to 3D print it but it is not coming up as a solid.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

jon_bondy
Where is it not "coming up as a solid"?  Do you have an STL which you
can share with us?  Do you have source code that you can share with us?

Jon

On 10/13/2016 1:11 PM, Cole wrote:
> i have a polyhedron on openscad and i want to 3D print it but it is not
> coming up as a solid.
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

Cole
polyhedron(
points=[
[0,0,0],  //0
[5,0,0],  //1
[5,100,0],  //2
[0,100,0],  //3
[0,0,10],  //4
[5,0,10],  //5
[5,100,10],  //6
[0,100,10],  //7
[2.5,100,20],//8
[2.5,0,20],//9
[2.5,120,0],//10
[0,0,0]],//11


faces = [
[0,1,2,3], //bottom
[0,3,7,4], //left
[1,2,6,5], //right
[1,0,4,5], //front
[3,2,6,7], //back
[4,7,8,9], //left blade
[5,9,8,6], //right blade
[4,9,5], // back 2
[7,8,6], //front 2
[3,10,7], //piont left
[7,8,10], //tip
[10,6,2],
[10,8,6]]

);
}

(it is only sowing up as a 2D sides instated of the 3D shape i wan to print out or diffreance out of somthing.

On 13 October 2016 at 13:15, jon <[hidden email]> wrote:
Where is it not "coming up as a solid"?  Do you have an STL which you can share with us?  Do you have source code that you can share with us?

Jon


On 10/13/2016 1:11 PM, Cole wrote:
i have a polyhedron on openscad and i want to 3D print it but it is not
coming up as a solid.



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

jon_bondy
It shows up as a 3D object in OpenSCAD after I remove the trailing "}"

Jon

On 10/13/2016 1:20 PM, Cole Herbert wrote:

> polyhedron(
> points=[
> [0,0,0],  //0
> [5,0,0],  //1
> [5,100,0],  //2
> [0,100,0],  //3
> [0,0,10],  //4
> [5,0,10],  //5
> [5,100,10],  //6
> [0,100,10],  //7
> [2.5,100,20],//8
> [2.5,0,20],//9
> [2.5,120,0],//10
> [0,0,0]],//11
>
>
> faces = [
> [0,1,2,3], //bottom
> [0,3,7,4], //left
> [1,2,6,5], //right
> [1,0,4,5], //front
> [3,2,6,7], //back
> [4,7,8,9], //left blade
> [5,9,8,6], //right blade
> [4,9,5], // back 2
> [7,8,6], //front 2
> [3,10,7], //piont left
> [7,8,10], //tip
> [10,6,2],
> [10,8,6]]
>
> );
> }
>
> (it is only sowing up as a 2D sides instated of the 3D shape i wan to
> print out or diffreance out of somthing.
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

Cole
i have it showing but when i go to export it is well not show up my cube well show up but the polyhedron well not show.


On 13 October 2016 at 13:25, jon <[hidden email]> wrote:
It shows up as a 3D object in OpenSCAD after I remove the trailing "}"

Jon


On 10/13/2016 1:20 PM, Cole Herbert wrote:
polyhedron(
points=[
[0,0,0],  //0
[5,0,0],  //1
[5,100,0],  //2
[0,100,0],  //3
[0,0,10],  //4
[5,0,10],  //5
[5,100,10],  //6
[0,100,10],  //7
[2.5,100,20],//8
[2.5,0,20],//9
[2.5,120,0],//10
[0,0,0]],//11


faces = [
[0,1,2,3], //bottom
[0,3,7,4], //left
[1,2,6,5], //right
[1,0,4,5], //front
[3,2,6,7], //back
[4,7,8,9], //left blade
[5,9,8,6], //right blade
[4,9,5], // back 2
[7,8,6], //front 2
[3,10,7], //piont left
[7,8,10], //tip
[10,6,2],
[10,8,6]]

);
}

(it is only sowing up as a 2D sides instated of the 3D shape i wan to print out or diffreance out of somthing.



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

tp3
On 10/13/2016 07:35 PM, Cole Herbert wrote:
> i have it showing but when i go to export it is well not show
> up my cube well show up but the polyhedron well not show.
>
Some of the faces look into the wrong direction. Basically
reverse the point order of faces showing up in pink in
"Thrown Together" display mode.

See: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6.3F

ciao,
  Torsten.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

fred_dot_u
In reply to this post by Cole
I'm not sure if you want the answers beyond the explanation provided, but for my own exercise, I found them.

1, 2, 6, 5 > 1, 5, 6, 2
7, 8, 10 > 7, 10, 8
10, 6, 2 > 10, 2, 6
10, 8, 6 > 10, 6, 8

remove:
3, 2, 6, 7
7, 8, 6

add:
10, 3, 2

not being particularly proficient in OpenSCAD, I can't guess what the two faces would do to your model, as they become internal "bulkheads" once you close the non-manifold with 10, 3, 2, so it's probably a good idea to make that change.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

kitwallace
Bit late to the scene on this one but its useful to be able to orient faces when 'thrown-together' shows some faces are the wrong way round.  This is the code I use:


// ensure that all faces have a lhs orientation
function reverse(l) =
     [for (i=[1:len(l)]) l[len(l)-i]];
         
function orthogonal(v0,v1,v2) =  cross(v1-v0,v2-v1);

function normal(face) =
     let (n=orthogonal(face[0],face[1],face[2]))
     - n / norm(n);
function vsum(points,i=0) =  
      i < len(points)
        ?  (points[i] + vsum(points,i+1))
        :  [0,0,0];
function centroid(points) =
      vsum(points) / len(points);
     
function as_points(indexes,points) =
    [for (i=[0:len(indexes)-1])
          points[indexes[i]]
    ];
function cosine_between(u, v) =(u * v) / (norm(u) * norm(v));

function lhs_faces(faces,vertices) =
    [for (face = faces)
     let(points = as_points(face,vertices))
        cosine_between(normal(points), centroid(points)) < 0
        ?  reverse(face)  :  face
    ];
 
   
//original data
points=[
[0,0,0],  //0
[5,0,0],  //1
[5,100,0],  //2
[0,100,0],  //3
[0,0,10],  //4
[5,0,10],  //5
[5,100,10],  //6
[0,100,10],  //7
[2.5,100,20],//8
[2.5,0,20],//9
[2.5,120,0],//10
[0,0,0]];


faces = [
[0,1,2,3], //bottom
[0,3,7,4], //left
[1,2,6,5], //right
[1,0,4,5], //front
[3,2,6,7], //back
[4,7,8,9], //left blade
[5,9,8,6], //right blade
[4,9,5], // back 2
[7,8,6], //front 2
[3,10,7], //piont left
[7,8,10], //tip
[10,6,2],
[10,8,6]]
;


oriented_faces = lhs_faces(faces,points);
polyhedron(points=points,faces=oriented_faces);
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

Ronaldo
It doesn't work with:

//original data
p=[
[0,0,0],  //0
[5,0,0],  //1
[5,100,0],  //2
[0,100,0],  //3
[0,0,10],  //4
[5,0,10],  //5
[5,100,10],  //6
[0,100,10],  //7
[2.5,100,20],//8
[2.5,0,20],//9
[2.5,120,0],//10
[0,0,0]];

points = [for(pi=p) pi-[0,200,0]];




2017-04-10 16:10 GMT-03:00 kitwallace <[hidden email]>:
Bit late to the scene on this one but its useful to be able to orient faces
when 'thrown-together' shows some faces are the wrong way round.  This is
the code I use:


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

kitwallace
Odd - works for me.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

Ronaldo
If we change the test in lhs_faces() to:

cosine_between(normal(points), points[0]-centroid(vertices)) < 0

it works for both cases. Anyway, this strategy of using centroid will possibly work for all convex objects but it will not work, for instance, for a holed cube.

BTW, your example is not a manifold.


2017-04-10 16:44 GMT-03:00 kitwallace <[hidden email]>:
Odd - works for me.



--
View this message in context: http://forum.openscad.org/polyhedron-to-a-3D-printing-from-tp18692p21164.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

kitwallace
Still don't see why your second case doesn't work for you - maybe it's a version thing - I'm on 2017.01.20 but its hard to see why a simple translation would affect anything.

BTW It's not my example , its the OP's
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

Ronaldo
Sorry, but I got the same result with both 2017.01.20 and 2015.03-2 running under Windows 7 what is really odd.



And the reason of this failure is simple: in lhs_faces, your test uses the angle between a vector (the face normal) and a point (the centroid). This has no geometrical meaning.

Even correcting this, the strategy may fail for non convex objects, as I said before.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

kitwallace
Ronaldo - you are right of course -my apologies for wasting your time - I was over confident and must have slipped out of thrown together mode . There must have been a regression in the code because I use this to clean up Johnson solids which have occasional reversed faces

<red-face>

Chris
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

kitwallace
This post was updated on .
OK, I was looking in the wrong place - it isn't the code, it's the data.  I've tested the code and it is correct when the solid is convex (a known limitation).  The problem is that this example is not convex - I think the apex of the bottom facet is wrong , and hence its not manifold as you observed

Re cosine -  the centroid point defines a line from the origin to the centroid so the angle is well-defined

Chris
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

Ronaldo
2017-04-10 21:31 GMT-03:00 kitwallace <[hidden email]>:
Re cosine -  the centroid point defines a line from the origin to the centroid so the angle is well-defined

Sorry to disagree again. Translating the model I can put the centroid anywhere I like. So the angle between the normal of a face (invariant to translation) and the vector centroid-[0,0,0] may be any value I want. So the test is not invariant to translation. But the face winding is.

Besides, what happens when the centroid happens to be the origin? All faces, independent of its winding will pass the test.



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: polyhedron to a 3D printing from

kitwallace

Yes of course. I recall this was a quick solution which works for the polyhedra I was working on which are centred on the origin . i agree, it's not a general solution at all. 

On 11 Apr 2017 2:17 a.m., "Ronaldo [via OpenSCAD]" <[hidden email]> wrote:
2017-04-10 21:31 GMT-03:00 kitwallace <[hidden email]>:
Re cosine -  the centroid point defines a line from the origin to the centroid so the angle is well-defined

Sorry to disagree again. Translating the model I can put the centroid anywhere I like. So the angle between the normal of a face (invariant to translation) and the vector centroid-[0,0,0] may be any value I want. So the test is not invariant to translation. But the face winding is.

Besides, what happens when the centroid happens to be the origin? All faces, independent of its winding will pass the test.



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/polyhedron-to-a-3D-printing-from-tp18692p21181.html
To unsubscribe from polyhedron to a 3D printing from, click here.
NAML
Loading...