discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Normalized tree is growing past / wireframe not shown

MP
Marcus Poller
Mon, Oct 14, 2024 8:35 AM

Dear OpenSCAD users,

I am trying to design a bottle lid with air channels from the center to the outer diameter. It is a piece for a musical instrument. The code is attached. The shape could be simplified as

rotate_extrude() polygon();
for( i=[0:30] ) {
  hull(){
    translate() sphere();
    translate() sphere();
  }
}

I suffer from a three issues:

(1) Warnings while compiling:
WARNING: Normalized tree is growing past 18000000 elements. Aborting normalization.
WARNING: CSG normalization resulted in an empty tree

I found

Edit -> Preferences -> Advanced -> 3D Preview (OpenCSG) -> Turn off rendering at $fixnum elements

but that did not reenable preview for me.

(2) an empty preview
(3) Wireframe not shown:

  • OpenSCAD-2021.01 cannot preview, but can render and can display a wireframe
  • OpenSCAD-2024.10.09.ai20850-x86_64.AppImag-manifold-backend can preview, can render, does not display a wireframe
  • OpenSCAD-2024.10.09.ai20850-x86_64.AppImag-cgal-backend cannot preview, can render, can display wireframe

What settings may I want to adjust?
May there be a regression in the manifold backend regarding the wireframe display?

Cheers,
Marcus

Dear OpenSCAD users, I am trying to design a bottle lid with air channels from the center to the outer diameter. It is a piece for a musical instrument. The code is attached. The shape could be simplified as rotate_extrude() polygon(); for( i=[0:30] ) { hull(){ translate() sphere(); translate() sphere(); } } I suffer from a three issues: (1) Warnings while compiling: WARNING: Normalized tree is growing past 18000000 elements. Aborting normalization. WARNING: CSG normalization resulted in an empty tree I found Edit -> Preferences -> Advanced -> 3D Preview (OpenCSG) -> Turn off rendering at $fixnum elements but that did not reenable preview for me. (2) an empty preview (3) Wireframe not shown: * OpenSCAD-2021.01 cannot preview, but can render and can display a wireframe * OpenSCAD-2024.10.09.ai20850-x86_64.AppImag-manifold-backend can preview, can render, does not display a wireframe * OpenSCAD-2024.10.09.ai20850-x86_64.AppImag-cgal-backend cannot preview, can render, can display wireframe What settings may I want to adjust? May there be a regression in the manifold backend regarding the wireframe display? Cheers, Marcus
JB
Jordan Brown
Mon, Oct 14, 2024 11:47 PM

I think the essence is that preview really hates intersection, and
you're doing a fair number of them.  I think the complexity of one of
the internal data structures is in some way an exponential function of
the number of intersections.

Here's a table of segmente_anzahl versus size of the normalized tree:
1
12
2
32
3
80
4
192
5
448
6
1024
10
24576

However... you're doing something like

for (...) {
intersection() {
rotate(...) luftrohr();
... a cylinder ...
}
}

which is equivalent to

intersection() {
... a cylinder ...
for (...) {
rotate(...) luftrohr();
}
}

only the first does about thirty intersections, while the second only
does one.

I think the essence is that preview really hates intersection, and you're doing a fair number of them.  I think the complexity of one of the internal data structures is in some way an *exponential* function of the number of intersections. Here's a table of segmente_anzahl versus size of the normalized tree: 1 12 2 32 3 80 4 192 5 448 6 1024 10 24576 However... you're doing something like for (...) { intersection() { rotate(...) luftrohr(); ... a cylinder ... } } which is equivalent to intersection() { ... a cylinder ... for (...) { rotate(...) luftrohr(); } } only the first does about thirty intersections, while the second only does one.
HL
Hans L
Tue, Oct 15, 2024 1:22 AM

There is a relevant FAQ entry which somewhat explains the situation:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_the_preview_so_slow
?

One quick fix is to wrap the intersection in your luftrohr module with a
render() instantiation:

module luftrohr(){
render() intersection(){...

This effectively collapses that CSG subtree and avoids the explosion in CSG
product terms.

On Mon, Oct 14, 2024 at 6:47 PM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

I think the essence is that preview really hates intersection, and you're
doing a fair number of them.  I think the complexity of one of the internal
data structures is in some way an exponential function of the number of
intersections.

Here's a table of segmente_anzahl versus size of the normalized tree:
1
12
2
32
3
80
4
192
5
448
6
1024
10
24576

However... you're doing something like

for (...) {
intersection() {
rotate(...) luftrohr();
... a cylinder ...
}
}

which is equivalent to

intersection() {
... a cylinder ...
for (...) {
rotate(...) luftrohr();
}
}

only the first does about thirty intersections, while the second only does
one.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

There is a relevant FAQ entry which somewhat explains the situation: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_the_preview_so_slow ? One quick fix is to wrap the intersection in your luftrohr module with a render() instantiation: module luftrohr(){ render() intersection(){... This effectively collapses that CSG subtree and avoids the explosion in CSG product terms. On Mon, Oct 14, 2024 at 6:47 PM Jordan Brown via Discuss < discuss@lists.openscad.org> wrote: > I think the essence is that preview really hates intersection, and you're > doing a fair number of them. I think the complexity of one of the internal > data structures is in some way an *exponential* function of the number of > intersections. > > Here's a table of segmente_anzahl versus size of the normalized tree: > 1 > 12 > 2 > 32 > 3 > 80 > 4 > 192 > 5 > 448 > 6 > 1024 > 10 > 24576 > > However... you're doing something like > > for (...) { > intersection() { > rotate(...) luftrohr(); > ... a cylinder ... > } > } > > which is equivalent to > > intersection() { > ... a cylinder ... > for (...) { > rotate(...) luftrohr(); > } > } > > only the first does about thirty intersections, while the second only does > one. > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
MP
Marcus Poller
Tue, Oct 15, 2024 8:32 AM

There is a relevant FAQ entry which somewhat explains the situation:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_the_preview_so_slow
?

That was an interesting read and boils it down to a well known workaround.

One quick fix is to wrap the intersection in your luftrohr module with a
render() instantiation:

module luftrohr(){
render() intersection(){...

This effectively collapses that CSG subtree and avoids the explosion in CSG
product terms.

Works great. :-)

Thank you,
Marcus

> There is a relevant FAQ entry which somewhat explains the situation: > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_the_preview_so_slow > ? That was an interesting read and boils it down to a well known workaround. > One quick fix is to wrap the intersection in your luftrohr module with a > render() instantiation: > > module luftrohr(){ > render() intersection(){... > > This effectively collapses that CSG subtree and avoids the explosion in CSG > product terms. Works great. :-) Thank you, Marcus
MP
Marcus Poller
Tue, Oct 15, 2024 8:36 AM

I think the essence is that preview really hates intersection, and
you're doing a fair number of them.  I think the complexity of one of
Here's a table of segmente_anzahl versus size of the normalized tree:
1
12
2
32
3
80
4
192
5
448
6
1024
10
24576

However... you're doing something like

for (...) {
intersection() {
rotate(...) luftrohr();
... a cylinder ...
}
}

which is equivalent to

intersection() {
... a cylinder ...
for (...) {
rotate(...) luftrohr();
}
}

That is a very educative way to highlight my problem.
It works equally nice as Hans solution, thank you!

Cheers,
Marcus

> I think the essence is that preview really hates intersection, and > you're doing a fair number of them.  I think the complexity of one of > Here's a table of segmente_anzahl versus size of the normalized tree: > 1 > 12 > 2 > 32 > 3 > 80 > 4 > 192 > 5 > 448 > 6 > 1024 > 10 > 24576 > > > However... you're doing something like > > for (...) { > intersection() { > rotate(...) luftrohr(); > ... a cylinder ... > } > } > > which is equivalent to > > intersection() { > ... a cylinder ... > for (...) { > rotate(...) luftrohr(); > } > } That is a very educative way to highlight my problem. It works equally nice as Hans solution, thank you! Cheers, Marcus
MP
Marcus Poller
Tue, Oct 15, 2024 8:41 AM

I applied Hans solution (making use of the cache by a render()-directive) und would like to highlight my second issue:

cgal-backend can display a wireframe.
manifold-backend cannot.

As manifold is officially stable, I would consider that a regression bug.

Code is attached. Test with:

./OpenSCAD-2024.10.09.ai20850-x86_64.AppImage --backend=manifold 0.23.2_360labium.scad
./OpenSCAD-2024.10.09.ai20850-x86_64.AppImage --backend=cgal 0.23.2_360labium.scad

Cheers,
Marcus

I applied Hans solution (making use of the cache by a render()-directive) und would like to highlight my second issue: cgal-backend can display a wireframe. manifold-backend cannot. As manifold is officially stable, I would consider that a regression bug. Code is attached. Test with: ./OpenSCAD-2024.10.09.ai20850-x86_64.AppImage --backend=manifold 0.23.2_360labium.scad ./OpenSCAD-2024.10.09.ai20850-x86_64.AppImage --backend=cgal 0.23.2_360labium.scad Cheers, Marcus
JB
Jordan Brown
Tue, Oct 15, 2024 10:12 PM

On 10/15/2024 1:41 AM, Marcus Poller via Discuss wrote:

cgal-backend can display a wireframe.
manifold-backend cannot.

Known issue.
https://github.com/openscad/openscad/issues/4825
The sixth (top-level) item:

Support wireframe rendering of Manifold geometries

On 10/15/2024 1:41 AM, Marcus Poller via Discuss wrote: > cgal-backend can display a wireframe. > manifold-backend cannot. Known issue. https://github.com/openscad/openscad/issues/4825 The sixth (top-level) item: > Support wireframe rendering of Manifold geometries