[OpenSCAD] CGAL error depends on order of unioning

MichaelAtOz oz.at.michael at gmail.com
Wed Jul 24 00:43:23 EDT 2019


Shaporev, Timur wrote
> While working on https://www.thingiverse.com/thing:3762730 I faced strange
> effect: script produce
> 
> ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR:
> assertion violation! Expr: itl != it->second.end() File:
> /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_external_structure.h
> Line: 1152
> 
> on F6 but some change in order of unioning yields expected result.
> 
> I am attaching an archive with both faulty and good versions of scripts.
> 
> (The scripts render long enough: more than 20 minutes to preview the first
> script on my PC and 6 more minutes to render, yet more for the second
> script.)
> 
> 
> If this is new issue I'd appreciate advice on how to (get a ticket number)
> register it.
> 
> 
> Thank you,
> 
> Tim
> 
> 
> _______________________________________________
> OpenSCAD mailing list

> Discuss at .openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> 
> 
> 20190722.zip (8K)
> <http://forum.openscad.org/attachment/27016/0/20190722.zip>

I had a look at the code.
With the combination of operations, mostly lined-up at the same boundaries
you are prone to getting edges of two objects aligning, which creates
non-manifold geometry.
At such high resolution you increase the chances of such common edges
aligning.


Firstly, the preview artefacts you have can be fixed by using convexity=10
in linear_extrude (in two places), it makes looking at the detail easier.

At first I suspected the four quarters probably had the symmetry to cause
this.
But not this time.
It is an art you learn, but I look for points of convergence. 

Second try was here:
<http://forum.openscad.org/file/t359/Capture_ring_centre.jpg> 
The middle edge of the inside of the central ring hole, that aligns with the
surface of the back of the face.

Try this as an example

#cube([40,40,10]);
translate([5,20,20])
  rotate([0,90,0])
    cylinder(h=30,r=10,$fn=12);

F6 gets "UI-WARNING: Object may not be a valid 2-manifold and may need
repair!"

So in fail1.scad the easy way to fix it is to rotate that cylinder around
z-axis a small amount, so the line is not co-incident with that face.

difference() {
    union() {
        // assemble them back again
        quarter(); mirror([0,1,0]) quarter();
        mirror([0,0,1]) {
            quarter(); mirror([0,1,0]) quarter();
        }
        rotate([0,0,1])    //     
<--------------------------------------------
        rotate_extrude()
            hull() {
                translate([Rmid,ring_min_width/2-Rth]) circle(Rth);
                translate([Rmid,Rth-ring_min_width/2]) circle(Rth);
            }
        hull() {
            translate([Rmid, yl,zl-Rm]) sphere(Rth);

With that F6 completes without error.





-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list