puzzler

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

puzzler

jon_bondy
When I use F5, I see what I expect: a grid.  When I use F6, I see a
totally filled in rectangle, with the interior spaces gone.  If I only
use F6 on the cube at the end, it is fine; if I only use F6 on the
linear_extrude of the Grid, it is fine.

What am I missing?


inches = 25.4;
vt = 1;                // vertical thickness
th = 0.5;            // grid thickness
ht = 1 * inches;    // 6
wd = 1 * inches;    // 9

module Grid() {
*    for (y = [0:3:ht])
         translate([0, y, 0])
             square([wd, th]);
     for (x = [-ht:4:2*ht])
         translate([x, 0, 0])
             rotate([0, 0, 45])
                 square([wd, th]);
     for (x = [-ht:4:3*ht])
         translate([x, 0, 0])
             rotate([0, 0, 135])
                 square([wd, th]);
     }


intersection() {
     cube([wd, ht, vt]);
     linear_extrude(vt)
         Grid();
     }


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

Re: puzzler

nophead

ERROR: CGAL error in CGALUtils::applyBinaryOperator intersection: 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 


This works though, and is much faster.


linear_extrude(vt)
    intersection() {
        square([wd, ht]);
       
        Grid();
     }



On Tue, 15 Sep 2020 at 15:28, jon <[hidden email]> wrote:
When I use F5, I see what I expect: a grid.  When I use F6, I see a
totally filled in rectangle, with the interior spaces gone.  If I only
use F6 on the cube at the end, it is fine; if I only use F6 on the
linear_extrude of the Grid, it is fine.

What am I missing?


inches = 25.4;
vt = 1;                // vertical thickness
th = 0.5;            // grid thickness
ht = 1 * inches;    // 6
wd = 1 * inches;    // 9

module Grid() {
*    for (y = [0:3:ht])
         translate([0, y, 0])
             square([wd, th]);
     for (x = [-ht:4:2*ht])
         translate([x, 0, 0])
             rotate([0, 0, 45])
                 square([wd, th]);
     for (x = [-ht:4:3*ht])
         translate([x, 0, 0])
             rotate([0, 0, 135])
                 square([wd, th]);
     }


intersection() {
     cube([wd, ht, vt]);
     linear_extrude(vt)
         Grid();
     }


_______________________________________________
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: puzzler

jon_bondy

Thanks!  in retrospect, your optimization seems obvious.

Is the CGAL error a bug?

:)

On 9/15/2020 1:42 PM, nop head wrote:

ERROR: CGAL error in CGALUtils::applyBinaryOperator intersection: 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 

This works though, and is much faster.

linear_extrude(vt)     intersection() {         square([wd, ht]);                 Grid();      }


On Tue, 15 Sep 2020 at 15:28, jon <[hidden email]> wrote:
When I use F5, I see what I expect: a grid.  When I use F6, I see a
totally filled in rectangle, with the interior spaces gone.  If I only
use F6 on the cube at the end, it is fine; if I only use F6 on the
linear_extrude of the Grid, it is fine.

What am I missing?


inches = 25.4;
vt = 1;                // vertical thickness
th = 0.5;            // grid thickness
ht = 1 * inches;    // 6
wd = 1 * inches;    // 9

module Grid() {
*    for (y = [0:3:ht])
         translate([0, y, 0])
             square([wd, th]);
     for (x = [-ht:4:2*ht])
         translate([x, 0, 0])
             rotate([0, 0, 45])
                 square([wd, th]);
     for (x = [-ht:4:3*ht])
         translate([x, 0, 0])
             rotate([0, 0, 135])
                 square([wd, th]);
     }


intersection() {
     cube([wd, ht, vt]);
     linear_extrude(vt)
         Grid();
     }


_______________________________________________
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

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

Re: puzzler

JordanBrown
In reply to this post by jon_bondy
On 9/15/2020 7:27 AM, jon wrote:
When I use F5, I see what I expect: a grid.  When I use F6, I see a totally filled in rectangle, with the interior spaces gone.  If I only use F6 on the cube at the end, it is fine; if I only use F6 on the linear_extrude of the Grid, it is fine.

What am I missing?

Not that it directly helps you, but it looks like you didn't notice this error in the console pane:
ERROR: CGAL error in CGALUtils::applyBinaryOperator intersection: 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

As I try to simplify it, I also get:
ERROR: CGAL error in CGALUtils::applyBinaryOperator intersection: CGAL ERROR: assertion violation! Expr: cet->get_index() == ce->twin()->get_index() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_external_structure.h Line: 1219

And:

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

I've also seen variations that just crash the program, and that yield

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

Here's the simplest example that I've been able to come up with:

union() {
    translate([-10,-10]) cube(1);
    linear_extrude(1) {
        translate([1.1, 0]) {
            rotate([0, 0, 45])
                square([25, 1.1]);
        }
        translate([1.1, 0]) {
            rotate([0, 0, 135])
                square([25.4, 1]);
        }
    }
}

Messing with the values - even the apparently irrelevant values like the X dimensions of the squares - changes the behavior.

I think CGAL is upset that the two squares just barely touch each other.  (Or, possibly, that after the various rounding and quantization effects they touch each other along only one edge.)

A workaround is to nudge one set of squares just a little so that they no longer perfectly align with the other, e.g.:

inches = 25.4;
vt = 1;                // vertical thickness
th = 0.5;            // grid thickness
ht = 1 * inches;    // 6
wd = 1 * inches;    // 9

module Grid() {
*    for (y = [0:3:ht])
        translate([0, y, 0])
            square([wd, th]);
    for (x = [-ht:4:2*ht])
        translate([x, 0.001, 0])       // <<<< nudge
            rotate([0, 0, 45])
                square([wd, th]);
    for (x = [-ht:4:3*ht])
        translate([x, 0, 0])
            rotate([0, 0, 135])
                square([wd, th]);
    }


intersection() {
    cube([wd, ht, vt]);
    linear_extrude(vt)
        Grid();
    } 

  


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