ERROR: CGAL error in CGALUtils::applyBinaryOperator

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

ERROR: CGAL error in CGALUtils::applyBinaryOperator

Alexander Pruss
This post has NOT been accepted by the mailing list yet.
I'm getting this CGAL error when rendering one particular file on Windows 10 (64 bit):
 
ERROR: CGAL error in CGALUtils::applyBinaryOperator union: CGAL ERROR: assertion violation! File: /opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_3/SNC_point_locator.h Line: 933 Explanation: wrong handle type

The file I'm rendering has two parts, selectable via the includeTop and includeBottom variables. If I include just one of the two parts, everything renders fine. If I include both, I get the error. The error message happens only the first time I render. If I re-render, then nothing happens, and nothing shows up on screen, and STL generation says "Current top level object is empty."

(In case anybody is interested, this is a finger extension exerciser.)

thumbAngularWidth = 90;
otherFingerAngularWidth = 40;
thumbDistanceRatio = 0.6;
outerRadius = 50;

spacing=3;
thickness=2;
centralPostHoleDepth=1.5;
innerPostHoleDepth=2.1;
outerPostHoleDepth=2.1;
tolerance=0.5;
postDiameter=5;

inset1 = 1.5;
inset2 = inset1 + 1.5;

includeTop = true;
includeBottom = true;

nudge = 0.001;

angularWidths = [thumbAngularWidth, otherFingerAngularWidth, otherFingerAngularWidth, otherFingerAngularWidth, otherFingerAngularWidth];
holeAngles = [0, 180-1.5*otherFingerAngularWidth, 180-.5*otherFingerAngularWidth, 180+.5*otherFingerAngularWidth, 180+1.5*otherFingerAngularWidth];
radii = outerRadius*[thumbDistanceRatio, 1, 1, 1, 1];

poly = [for (ii = [0:9]) let(i=floor(ii/2),sign=ii%2*2-1) radii[i] * [cos(holeAngles[i]+sign*angularWidths[i]/2), sin(holeAngles[i]+sign*angularWidths[i]/2)]];
    
function norm2D(v) = sqrt(pow(v[0],2)+pow(v[1],2));

function distance2D(a,b) = norm2D(a-b);
    
module base() {
    render(convexity=6)
    difference() {
        polygon(points=poly);
        for (i = [0:4]) {
            a=poly[i*2];
            b=poly[i*2+1];
            translate(.5*(a+b))
                rotate(holeAngles[i])
                scale([1.4,1.]) circle(d=0.6*distance2D(a,b));
        }
    }
}

module posts(inset,tolerance=0,thumbTweak=0) {
    for(i=[0:9]) {
        r = norm2D(poly[i]);
        r1 = r - inset;
        rotate = i==0 ? -thumbTweak : (i==1 ? thumbTweak : 0);
        rotate(rotate) translate(poly[i]/r*r1) circle(d=postDiameter+tolerance*2,$fn=16);
    }
}

module bottom() {
    linear_extrude(height=thickness) base();
    linear_extrude(height=thickness+spacing+outerPostHoleDepth) posts(postDiameter*inset1,thumbTweak=8);
    linear_extrude(height=thickness+spacing+innerPostHoleDepth) posts(postDiameter*inset2,thumbTweak=28);
    linear_extrude(height=thickness+spacing+centralPostHoleDepth) translate([-outerRadius*.35/2,0,0]) circle(d=outerRadius*0.35);
}

module top() {
    translate([0,0,thickness])
    scale([-1,-1,-1]) {
        difference() {
            linear_extrude(height=thickness) base();
            translate([0,0,-nudge]) {
                linear_extrude(height=outerPostHoleDepth+nudge) posts(postDiameter*inset1,thumbTweak=8,tolerance=tolerance);
                linear_extrude(height=innerPostHoleDepth+nudge) posts(postDiameter*inset2,thumbTweak=28,tolerance=tolerance);
                linear_extrude(height=centralPostHoleDepth+nudge) translate([-outerRadius*.35/2,0,0]) circle(d=outerRadius*0.35+tolerance*2);
            }
        }
    }
}

if (includeTop) {
    render(convexity=5)
    top();
}

if (includeBottom) {
    render(convexity=5)
    translate([includeTop ? -outerRadius : 0,0,0])
    bottom();
}
Reply | Threaded
Open this post in threaded view
|

Re: ERROR: CGAL error in CGALUtils::applyBinaryOperator

Alexander Pruss
This post has NOT been accepted by the mailing list yet.
Replacing the negative scaling with mirror() fixed the problem.
Reply | Threaded
Open this post in threaded view
|

Re: ERROR: CGAL error in CGALUtils::applyBinaryOperator

MichaelAtOz
Administrator
In reply to this post by Alexander Pruss
Hi Alexander,

Good to see you worked it out.

> The error message happens only the first time I render. If I re-render, then nothing happens, and nothing shows up on screen, and STL generation says "Current top level object is empty."

That's because F6 CGAL caches, and with an error the results are empty, but it still has been evaluated so doesn't try again.

Either change something or do Design/Flush_caches then re-render.

BTW, your post is still flagged as "This post has NOT been accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list, and respond to the registration email.
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!