discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

CGAL error - the sequence matters

JJ
Johan Jonker
Sat, Jun 24, 2017 6:52 PM

Hello everyone,

As many of you I sometimes suffer from these difficult CGALL errors. I
managed to deal with them this time and maybe it can help others to fix
their problems.

It's a long time since I added something to this forum. So maybe this is old
news. Sorry for that.
http://forum.openscad.org/file/n21738/cgal_errors.jpg

I designed an object that is in fact some kind of soprano saxophone.

The object the combination of

  • a complex shaped body
  • a serie of toneholes consisting of
    -- a deepened circular plane a bit larger that the tonehole diameter
    -- a raised conical edge around each tonehole
    -- the tonehole that is a circular hole in the body
  • a serie of posts consisting of
    -- one ore two small pillars with one or two holes in the

The first sequence I tried was:

  1. make the body shape
  2. use difference to make the deepened planes
  3. add a raised plane
  4. use difference to take out the toneholes
  5. add solid posts
  6. use difference to take out the holes from the posts
  7. intersect with a cube of 20cm to divide it into 4 printable parts.

What I found out that the sequence

  • difference/union/difference/union/difference/intersection
    appears to be a very complex process and causes CGAL errors.

I changed the sequence

1a) make the body shape
1b) use difference to make the deepened planes
1c) use difference to take out the toneholes
1d) intersect with a cube of 20cm to divide it into 4 printable parts.

  1. add the raised edges by first
    2a) making the raised planes
    2b) use difference to take out the toneholes
    2c) intersect with a cube of 20cm to divide it into 4 printable parts.

  2. add solid posts by
    3a) create the posts
    3b) use difference to take out the holes from the posts
    3c) intersect with a cube of 20cm to divide it into 4 printable parts.

This appears to render without CGAL errors without any change in the shape.

Conclusion: It is better to use the multiple times the same
difference/intersection function on a lower level of the shape than once on
the end of a completed complex construction.

--
View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hello everyone, As many of you I sometimes suffer from these difficult CGALL errors. I managed to deal with them this time and maybe it can help others to fix their problems. It's a long time since I added something to this forum. So maybe this is old news. Sorry for that. <http://forum.openscad.org/file/n21738/cgal_errors.jpg> I designed an object that is in fact some kind of soprano saxophone. The object the combination of - a complex shaped body - a serie of toneholes consisting of -- a deepened circular plane a bit larger that the tonehole diameter -- a raised conical edge around each tonehole -- the tonehole that is a circular hole in the body - a serie of posts consisting of -- one ore two small pillars with one or two holes in the The first sequence I tried was: 1) make the body shape 2) use difference to make the deepened planes 3) add a raised plane 4) use difference to take out the toneholes 5) add solid posts 6) use difference to take out the holes from the posts 7) intersect with a cube of 20cm to divide it into 4 printable parts. What I found out that the sequence - difference/union/difference/union/difference/intersection appears to be a very complex process and causes CGAL errors. I changed the sequence 1a) make the body shape 1b) use difference to make the deepened planes 1c) use difference to take out the toneholes 1d) intersect with a cube of 20cm to divide it into 4 printable parts. 2) add the raised edges by first 2a) making the raised planes 2b) use difference to take out the toneholes 2c) intersect with a cube of 20cm to divide it into 4 printable parts. 3) add solid posts by 3a) create the posts 3b) use difference to take out the holes from the posts 3c) intersect with a cube of 20cm to divide it into 4 printable parts. This appears to render without CGAL errors without any change in the shape. *Conclusion: It is better to use the multiple times the same difference/intersection function on a lower level of the shape than once on the end of a completed complex construction.* -- View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Mon, Jun 26, 2017 5:02 PM

That is weird because I think all boolean expressions are factored in a
normalization form. And you would have the same normalized expression in
both cases.

That is weird because I think all boolean expressions are factored in a normalization form. And you would have the same normalized expression in both cases.
JJ
Johan Jonker
Mon, Jun 26, 2017 5:35 PM

Maybe. I will try to reproduce it with an example.

Op 26-6-2017 om 19:03 schreef Ronaldo [via OpenSCAD]:

--
View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21759.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Maybe. I will try to reproduce it with an example. Op 26-6-2017 om 19:03 schreef Ronaldo [via OpenSCAD]: > That is weird because I think all boolean expressions are factored in > a normalization form. And you would have the same normalized > expression in both cases. > > > > _______________________________________________ > OpenSCAD mailing list > [hidden email] </user/SendEmail.jtp?type=node&node=21758&i=0> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > ------------------------------------------------------------------------ > If you reply to this email, your message will be added to the > discussion below: > http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21758.html > > To unsubscribe from CGAL error - the sequence matters, click here > <http://forum.openscad.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=21738&code=am9oYW5nam9ua2VyQHpvbm5ldC5ubHwyMTczOHwtMTMyMDk2NjY0Mg==>. > NAML > <http://forum.openscad.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21759.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Mon, Jun 26, 2017 7:10 PM

I have built a simple code, based on your two strategies,  to test my
assumption.

module A() cube();
module B() cube();
module C() cube();
module D() cube();
module E() cube();
module F() cube();
module G() cube();

module initial()
intersection() {
union() {
difference() {
union() {
difference() { A(); B(); }
C();
}
D();
}
difference() { E(); F(); }
}
G();
}

module modified() {
intersection() {
difference() { A(); B(); D(); }
G();
}
intersection() {
difference(){ C(); D(); }
G();
}
intersection() {
difference() { E(); F(); }
G();
}
}

initial();
//modified();

The modules A() to G() represent parts of your design (simplifyed here to
be just a cube() ). The last two modules represent the two strategies for
building the whole thing. If we preview this code and see the expression by
Design/Display CSG Products.. we get:

previewing initial():

CSG before normalization:

(((((cube9 - cube11) + cube13) - cube15) + (cube18 - cube20)) * cube22)

CSG after normalization:

(((((cube9 * cube22) - cube11) - cube15) + ((cube13 * cube22) - cube15)) +
((cube18 * cube22) - cube20))

previewing modified() :

CSG before normalization:

(((((cube6 * cube12) - cube8) - cube10) + ((cube16 * cube20) - cube18)) +
((cube24 * cube28) - cube26))

CSG after normalization:

(((((cube6 * cube12) - cube8) - cube10) + ((cube16 * cube20) - cube18)) +
((cube24 * cube28) - cube26))

Note that in both cases the normalization leads to the same expression.
Remains to know if CGAL is called with the normalized expression.

I have built a simple code, based on your two strategies, to test my assumption. module A() cube(); module B() cube(); module C() cube(); module D() cube(); module E() cube(); module F() cube(); module G() cube(); module initial() intersection() { union() { difference() { union() { difference() { A(); B(); } C(); } D(); } difference() { E(); F(); } } G(); } module modified() { intersection() { difference() { A(); B(); D(); } G(); } intersection() { difference(){ C(); D(); } G(); } intersection() { difference() { E(); F(); } G(); } } initial(); //modified(); The modules A() to G() represent parts of your design (simplifyed here to be just a cube() ). The last two modules represent the two strategies for building the whole thing. If we preview this code and see the expression by Design/Display CSG Products.. we get: previewing initial(): CSG before normalization: (((((cube9 - cube11) + cube13) - cube15) + (cube18 - cube20)) * cube22) CSG after normalization: (((((cube9 * cube22) - cube11) - cube15) + ((cube13 * cube22) - cube15)) + ((cube18 * cube22) - cube20)) previewing modified() : CSG before normalization: (((((cube6 * cube12) - cube8) - cube10) + ((cube16 * cube20) - cube18)) + ((cube24 * cube28) - cube26)) CSG after normalization: (((((cube6 * cube12) - cube8) - cube10) + ((cube16 * cube20) - cube18)) + ((cube24 * cube28) - cube26)) Note that in both cases the normalization leads to the same expression. Remains to know if CGAL is called with the normalized expression.
M
MichaelAtOz
Mon, Jun 26, 2017 8:29 PM

Ronaldo wrote

Note that in both cases the normalization leads to the same expression.
Remains to know if CGAL is called with the normalized expression.

CGAL is not normalised.
OpenCSG preview is.
reference
https://github.com/openscad/openscad/pull/1980#issuecomment-296511710


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

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!

View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21761.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > Note that in both cases the normalization leads to the same expression. > Remains to know if CGAL is called with the normalized expression. CGAL is not normalised. OpenCSG preview is. reference <https://github.com/openscad/openscad/pull/1980#issuecomment-296511710> ----- Admin - PM me if you need anything, or if I've done something stupid... 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! -- View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21761.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Mon, Jun 26, 2017 8:56 PM

Well, that answers my question. Let us wait for the Johan's case study.

2017-06-26 17:29 GMT-03:00 MichaelAtOz oz.at.michael@gmail.com:

CGAL is not normalised.
OpenCSG preview is.
reference
https://github.com/openscad/openscad/pull/1980#issuecomment-296511710

Well, that answers my question. Let us wait for the Johan's case study. 2017-06-26 17:29 GMT-03:00 MichaelAtOz <oz.at.michael@gmail.com>: > CGAL is not normalised. > OpenCSG preview is. > reference > <https://github.com/openscad/openscad/pull/1980#issuecomment-296511710> >
JJ
Johan Jonker
Tue, Jun 27, 2017 9:03 PM

I am a bit confused now. I tried all my earlier versions of wich I thought
had the problem. They all render without problems. . So I cannot reproduce
the problem to show the difference.

So maybe this post must be seen as some kind of false alarm. Maybe better to
remove the whole topic to prevent more confusion?

--
View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21765.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I am a bit confused now. I tried all my earlier versions of wich I thought had the problem. They all render without problems. . So I cannot reproduce the problem to show the difference. So maybe this post must be seen as some kind of false alarm. Maybe better to remove the whole topic to prevent more confusion? -- View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21765.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Tue, Jun 27, 2017 10:51 PM

I think you can edit the post, 'More' drop down on the right.
So you can add an update there. Maybe good to have it for posterity.
If you really want the thread deleted let me know.


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

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!

View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21766.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I think you can edit the post, 'More' drop down on the right. So you can add an update there. Maybe good to have it for posterity. If you really want the thread deleted let me know. ----- Admin - PM me if you need anything, or if I've done something stupid... 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! -- View this message in context: http://forum.openscad.org/CGAL-error-the-sequence-matters-tp21738p21766.html Sent from the OpenSCAD mailing list archive at Nabble.com.