discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

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

H
honuvo
Thu, Jun 18, 2020 11:50 AM

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);
}

}

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); } }
RP
Ronaldo Persiano
Thu, Jun 18, 2020 2:30 PM

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.

> > 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.
RP
Ronaldo Persiano
Thu, Jun 18, 2020 2:54 PM

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 <
rcmpersiano@gmail.com> 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.

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 < rcmpersiano@gmail.com> 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. >
H
honuvo
Fri, Jun 19, 2020 11:57 AM

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 <
rcmpersiano@gmail.com>:

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 <
rcmpersiano@gmail.com> 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.

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 < rcmpersiano@gmail.com>: > 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 < > rcmpersiano@gmail.com> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
RP
Ronaldo Persiano
Fri, Jun 19, 2020 2:28 PM

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!

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!