Error while designing a ring: CGAL error in CGAL_Nef_polyhedron3()

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Error while designing a ring: CGAL error in CGAL_Nef_polyhedron3()

honuvo
Hi!
I'm new to openscad and wanted to make a ring for my girlfriend to 3D-print, but I get the following error:

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_S2/SM_const_decorator.h Line: 329

Seems to be a problem with selfintersecting elements: https://github.com/openscad/openscad/issues/791

Now my question: How can I avoid that? I dont know whats self intersecting, maybe one of you has a solution.


Here my code:


reso=100; //500;
ring_aussen = 22;
ring_innen = 17.86;
ring_hoch = 6;
ring_rand = 2.5;//1.85;
dellenfaktor = 3.5;
ring_num_dellen = 360/dellenfaktor;

cubedim = ring_aussen+10;
diff = 0.4;
winkel = rands(-45,45,ring_num_dellen*dellenfaktor+1,123);

difference(){
    rotate_extrude(convexity = 2, $fn = reso)
        translate([ring_aussen/2-ring_hoch/2-ring_rand, 0, 0])
            circle(r=ring_hoch/2+ring_rand, $fn=reso);
    cylinder(r=ring_innen/2, h=ring_hoch*1.5, center=true, $fn=reso);
    translate([0, 0, cubedim/2+ring_hoch/2])
        cube(cubedim, center=true);
    translate([0, 0, -cubedim/2-ring_hoch/2])
        cube(cubedim, center=true);



    for ( i = [0 : ring_num_dellen] ){
        rotate([0,0,i*dellenfaktor])
            translate([ring_aussen/2-ring_hoch/2-ring_rand, 0, 0])
                rotate([0,winkel[i],0])
                    translate([(ring_hoch/2+ring_rand)*2-diff, 0, 0])
                        cube((ring_hoch/2+ring_rand)*2, center=true);
    }
}


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

Re: Error while designing a ring: CGAL error in CGAL_Nef_polyhedron3()

Ronaldo
I'm new to openscad and wanted to make a ring for my girlfriend to 3D-print, but I get the following error:
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_S2/SM_const_decorator.h Line: 329

The rotate_extrude is not a manifold because the circle is touching the Y axis. Just translate it a little bit to the right. Nice and simple design.

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

Re: Error while designing a ring: CGAL error in CGAL_Nef_polyhedron3()

Ronaldo
A simpler alternative would be to rotate_extrude the ring section. That would avoid a non-manifold with any reasonable change of parameter values.
Something like this:

module section() {
  difference() {
    translate([ring_aussen/2-ring_hoch/2-ring_rand+.1, 0, 0])
      circle(r=ring_hoch/2+ring_rand, $fn=reso);
    square([ring_innen, ring_hoch*1.5],center=true);
    translate([0, cubedim/2+ring_hoch/2])
      square(cubedim, center=true);
    translate([0, -(cubedim/2+ring_hoch/2)])
      square(cubedim, center=true);
  }
}

Em qui., 18 de jun. de 2020 às 15:30, Ronaldo Persiano <[hidden email]> escreveu:
I'm new to openscad and wanted to make a ring for my girlfriend to 3D-print, but I get the following error:
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_S2/SM_const_decorator.h Line: 329

The rotate_extrude is not a manifold because the circle is touching the Y axis. Just translate it a little bit to the right. Nice and simple design.

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

Re: Error while designing a ring: CGAL error in CGAL_Nef_polyhedron3()

honuvo
A, thanks for the code Ronaldo, I see what you mean. After googling a bit more I now know that its better to design in 2D and go 3D later in regards to computation time, so your code helps me with that! :)

Additionally I found another way to solve my problem. Sometimes its better to take a step back, look at what you've done and hit your head against a wall. I don't need a complicated tube in ring-shape to then cut away pieces. If I replace the following from my code:

rotate_extrude(convexity = 2, $fn = reso)
        translate([ring_aussen/2-ring_hoch/2-ring_rand, 0, 0])
            circle(r=ring_hoch/2+ring_rand, $fn=reso);
 
with a sphere like so:

sphere(r=ring_aussen/2, $fn=reso);

everything works exactly the same for what I want to do. But again, it's starting with 3D objects, so your way seems better to me. Hope your and my way help somebody else who stumble across our posts in his search for answers.

On a sidenote: I'm 33 now, I grew up as a nerd with the possibilities of the internet, yet it astounds me every time I see it in little details like auto-generated parts around mails that I'm communicating with somebody approximately 2300KM away. You're (I believe) portuguese, I'm german, yet we talk in english.  So thank you stranger and have a good day :)

Am Do., 18. Juni 2020 um 16:55 Uhr schrieb Ronaldo Persiano <[hidden email]>:
A simpler alternative would be to rotate_extrude the ring section. That would avoid a non-manifold with any reasonable change of parameter values.
Something like this:

module section() {
  difference() {
    translate([ring_aussen/2-ring_hoch/2-ring_rand+.1, 0, 0])
      circle(r=ring_hoch/2+ring_rand, $fn=reso);
    square([ring_innen, ring_hoch*1.5],center=true);
    translate([0, cubedim/2+ring_hoch/2])
      square(cubedim, center=true);
    translate([0, -(cubedim/2+ring_hoch/2)])
      square(cubedim, center=true);
  }
}

Em qui., 18 de jun. de 2020 às 15:30, Ronaldo Persiano <[hidden email]> escreveu:
I'm new to openscad and wanted to make a ring for my girlfriend to 3D-print, but I get the following error:
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_S2/SM_const_decorator.h Line: 329

The rotate_extrude is not a manifold because the circle is touching the Y axis. Just translate it a little bit to the right. Nice and simple design.
_______________________________________________
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
|

Re: Error while designing a ring: CGAL error in CGAL_Nef_polyhedron3()

Ronaldo


If I replace the following from my code:

rotate_extrude(convexity = 2, $fn = reso)
        translate([ring_aussen/2-ring_hoch/2-ring_rand, 0, 0])
            circle(r=ring_hoch/2+ring_rand, $fn=reso);
 
with a sphere like so:

sphere(r=ring_aussen/2, $fn=reso);

everything works exactly the same for what I want to do.

Not exactly the same. It will depend on the random numbers you generate because with rotate_extrude you are carving a torus surface and not a sphere. If the random carving cut out all the rounded surface, then they will be the same.

A side note on your side note: I live in Portugal now but I am from Brazil. Have a good day!

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