discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.

JJ
Julien Jacquet
Mon, Jul 25, 2022 11:29 AM

Hi,

I made an STL file with another software than Openscad (in attachment).
I imported this file. Then F5 and F6, no problem.
But from two copies of this file, it does not work anymore.

For example, with

import("5octa.stl");
translate([50,0,0]) import("5octa.stl");

I get the error ERROR: The given mesh is not closed! Unable to convert to
CGAL_Nef_Polyhedron.

I need to import this file several times.
Do you have a lead?
Thank you!
Julien

Hi, I made an STL file with another software than Openscad (in attachment). I imported this file. Then F5 and F6, no problem. But from two copies of this file, it does not work anymore. For example, with > import("5octa.stl"); > translate([50,0,0]) import("5octa.stl"); > I get the error ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. I need to import this file several times. Do you have a lead? Thank you! Julien
MM
Michael Marx
Mon, Jul 25, 2022 12:40 PM

The STL has self-intersections.

The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case).

Once another object is involved there is a union() and CGAL is called to do it.

CGAL is really fussy about having non-broken geometry.


From: Julien Jacquet [mailto:jacquetjulien@gmail.com]
Sent: Mon, 25 Jul 2022 21:29
To: OpenSCAD general discussion
Subject: [OpenSCAD] ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.

Hi,

I made an STL file with another software than Openscad (in attachment).
I imported this file. Then F5 and F6, no problem.
But from two copies of this file, it does not work anymore.

For example, with

import("5octa.stl");
translate([50,0,0]) import("5octa.stl");

I get the error ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.

I need to import this file several times.
Do you have a lead?
Thank you!
Julien

--
This email has been checked for viruses by AVG.
https://www.avg.com

The STL has self-intersections. The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case). Once another object is involved there is a union() and CGAL is called to do it. CGAL is really fussy about having non-broken geometry. _____ From: Julien Jacquet [mailto:jacquetjulien@gmail.com] Sent: Mon, 25 Jul 2022 21:29 To: OpenSCAD general discussion Subject: [OpenSCAD] ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. Hi, I made an STL file with another software than Openscad (in attachment). I imported this file. Then F5 and F6, no problem. But from two copies of this file, it does not work anymore. For example, with import("5octa.stl"); translate([50,0,0]) import("5octa.stl"); I get the error ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. I need to import this file several times. Do you have a lead? Thank you! Julien -- This email has been checked for viruses by AVG. https://www.avg.com
CA
Carsten Arnholm
Mon, Jul 25, 2022 12:55 PM

On 25.07.2022 13:29, Julien Jacquet wrote:

Hi,

I made an STL file with another software than Openscad (in attachment).
I imported this file. Then F5 and F6, no problem.
But from two copies of this file, it does not work anymore.

For example, with

 import("5octa.stl");
 translate([50,0,0]) import("5octa.stl");

I get the error ERROR: The given mesh is not closed! Unable to convert
to CGAL_Nef_Polyhedron.

I need to import this file several times.
Do you have a lead?
Thank you!
Julien

The problem with STL is that it contains no explicit topology and relies
on coordinate matching. In this case the triangles are written with
inexact coordinates which means OpenSCAD is unable to properly
reassemble a closed mesh. The way to fix it is to either use a different
file format like .OBJ or .OFF or use a mesh repair tool to rewrite the
STL file with more accurate coordinates.
https://github.com/arnholm/angelcad contains a mesh repair tool called
'polyfix' that is able to rewrite your STL so your OpenSCAD file will
work. You will need to give it a distance tolerance = 3 (-dtol=3) for
this to work on this model, it is an indication that the original
coordinates are very poor. Either the original contains many collapsed
or zero area faces, or the vertex merging process creates them, and thus
they are iteratively removed. The final file has 196 faces and 100
vertices, you may want to check it that matches your expectation. Note
that the fixed file has a new name. OpenSCAD will work with the fixed file.

$polyfix 5octa.stl -dtol=3

Parameters:
       dtol = 3
 input_file = 5octa.stl

polyhedron 0 ================= volume=17041.6, dtol=3, atol=1e-06,
maxiter=10
iteration 0: vertices=1932 faces=644
            warning: nonmanifold edges: uc(1)=1932
            merged 1830 vertices
            removed 410 collapsed or zero area faces
            removed 18 duplicate faces
            removed 15 nonmanifold faces
            total changes=2273
            warning: nonmanifold edges: uc(1)=2 uc(3)=3

iteration 1: vertices=102 faces=201
            warning: nonmanifold edges: uc(1)=2 uc(3)=3
            merged 1 vertex
            removed 2 collapsed or zero area faces
            split 2 faces
            removed 1 nonmanifold face
            removed 4 zero area faces
            total changes=10
            no warnings

iteration 2: vertices=101 faces=196
            removed 1 unused vertex
            total changes=1
            no warnings

iteration 3: vertices=100 faces=196
            total changes=0
            no warnings

Summary:
            polyhedron 0: vertices=100 faces=196 : no warnings

Writing: 5octa_1.stl

Carsten Arholm

On 25.07.2022 13:29, Julien Jacquet wrote: > Hi, > > I made an STL file with another software than Openscad (in attachment). > I imported this file. Then F5 and F6, no problem. > But from two copies of this file, it does not work anymore. > > For example, with > > import("5octa.stl"); > translate([50,0,0]) import("5octa.stl"); > > I get the error ERROR: The given mesh is not closed! Unable to convert > to CGAL_Nef_Polyhedron. > > I need to import this file several times. > Do you have a lead? > Thank you! > Julien > The problem with STL is that it contains no explicit topology and relies on coordinate matching. In this case the triangles are written with inexact coordinates which means OpenSCAD is unable to properly reassemble a closed mesh. The way to fix it is to either use a different file format like .OBJ or .OFF or use a mesh repair tool to rewrite the STL file with more accurate coordinates. https://github.com/arnholm/angelcad contains a mesh repair tool called 'polyfix' that is able to rewrite your STL so your OpenSCAD file will work. You will need to give it a distance tolerance = 3 (-dtol=3) for this to work on this model, it is an indication that the original coordinates are very poor. Either the original contains many collapsed or zero area faces, or the vertex merging process creates them, and thus they are iteratively removed. The final file has 196 faces and 100 vertices, you may want to check it that matches your expectation. Note that the fixed file has a new name. OpenSCAD will work with the fixed file. $polyfix 5octa.stl -dtol=3 Parameters:        dtol = 3  input_file = 5octa.stl polyhedron 0 ================= volume=17041.6, dtol=3, atol=1e-06, maxiter=10 iteration 0: vertices=1932 faces=644             warning: nonmanifold edges: uc(1)=1932             merged 1830 vertices             removed 410 collapsed or zero area faces             removed 18 duplicate faces             removed 15 nonmanifold faces             total changes=2273             warning: nonmanifold edges: uc(1)=2 uc(3)=3 iteration 1: vertices=102 faces=201             warning: nonmanifold edges: uc(1)=2 uc(3)=3             merged 1 vertex             removed 2 collapsed or zero area faces             split 2 faces             removed 1 nonmanifold face             removed 4 zero area faces             total changes=10             no warnings iteration 2: vertices=101 faces=196             removed 1 unused vertex             total changes=1             no warnings iteration 3: vertices=100 faces=196             total changes=0             no warnings Summary:             polyhedron 0: vertices=100 faces=196 : no warnings Writing: 5octa_1.stl Carsten Arholm
GH
gene heskett
Mon, Jul 25, 2022 1:45 PM

On 7/25/22 09:00, Michael Marx wrote:

The STL has self-intersections.

The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case).

Once another object is involved there is a union() and CGAL is called to do it.

CGAL is really fussy about having non-broken geometry.

Does this not point to a potential problem for STL, and nudge us off
into another more
informative file format such as 3mf or $3digitname for the default output?

Something whose error messages would at least point the noob to a solution?

_____

From: Julien Jacquet [mailto:jacquetjulien@gmail.com]
Sent: Mon, 25 Jul 2022 21:29
To: OpenSCAD general discussion
Subject: [OpenSCAD] ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.

Hi,

I made an STL file with another software than Openscad (in attachment).
I imported this file. Then F5 and F6, no problem.
But from two copies of this file, it does not work anymore.

For example, with

import("5octa.stl");
translate([50,0,0]) import("5octa.stl");

I get the error ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron.

I need to import this file several times.
Do you have a lead?
Thank you!
Julien


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

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 7/25/22 09:00, Michael Marx wrote: > The STL has self-intersections. > > The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case). > > Once another object is involved there is a union() and CGAL is called to do it. > > CGAL is really fussy about having non-broken geometry. > > Does this not point to a potential problem for STL, and nudge us off into another more informative file format such as 3mf or $3digitname for the default output? Something whose error messages would at least point the noob to a solution? > > _____ > > From: Julien Jacquet [mailto:jacquetjulien@gmail.com] > Sent: Mon, 25 Jul 2022 21:29 > To: OpenSCAD general discussion > Subject: [OpenSCAD] ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. > > > > Hi, > > I made an STL file with another software than Openscad (in attachment). > I imported this file. Then F5 and F6, no problem. > But from two copies of this file, it does not work anymore. > > For example, with > > import("5octa.stl"); > translate([50,0,0]) import("5octa.stl"); > > I get the error ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. > > I need to import this file several times. > Do you have a lead? > Thank you! > Julien > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
T
trygve@totallytrygve.com
Mon, Jul 25, 2022 3:37 PM

Den 25. juli 2022 kl. 15.45.26 +02.00 skrev gene heskett gheskett@shentel.net:

On 7/25/22 09:00, Michael Marx wrote:

The STL has self-intersections.

The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case).

Once another object is involved there is a union() and CGAL is called to do it.

CGAL is really fussy about having non-broken geometry.
Does this not point to a potential problem for STL, and nudge us off into another more

informative file format such as 3mf or $3digitname for the default output?

Something whose error messages would at least point the noob to a solution?

Nope. There's a special rule for .STL files

The vertex rule states that each triangle must share two vertices with its neighboring triangles.

In other words, they need to use the same coordinates.

There are other rules, too, about which order to list the triangles, even which sequence the vertices are listed, and a defined 'inside' and 'outside'. It's really a pretty robust file format.

https://all3dp.com/1/stl-file-format-3d-printing/

No, what we have here is an example of a program with a shitty export function.They get away with it most of the time because most slicers will quietly overlook crappy code and do a 'best guess'.

(I use FormWare for resin printing. It will happily tell you exactly how much crap is in a file and if it needs repair or the creator taken out back and beaten with a ClueBy4)

Trygve

Den 25. juli 2022 kl. 15.45.26 +02.00 skrev gene heskett <gheskett@shentel.net>: > On 7/25/22 09:00, Michael Marx wrote: > > > The STL has self-intersections. > > > > The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case). > > > > Once another object is involved there is a union() and CGAL is called to do it. > > > > CGAL is really fussy about having non-broken geometry. > > Does this not point to a potential problem for STL, and nudge us off into another more > informative file format such as 3mf or $3digitname for the default output? > > Something whose error messages would at least point the noob to a solution? > Nope. There's a special rule for .STL files The vertex rule states that each triangle must share two vertices with its neighboring triangles. In other words, they need to use the same coordinates. There are other rules, too, about which order to list the triangles, even which sequence the vertices are listed, and a defined 'inside' and 'outside'. It's really a pretty robust file format. <https://all3dp.com/1/stl-file-format-3d-printing/> No, what we have here is an example of a program with a shitty export function.They get away with it most of the time because most slicers will quietly overlook crappy code and do a 'best guess'. (I use FormWare for resin printing. It will happily tell you exactly how much crap is in a file and if it needs repair or the creator taken out back and beaten with a ClueBy4) Trygve
RW
Raymond West
Mon, Jul 25, 2022 5:55 PM

beaten with a ClueBy4)

should be metric .

> beaten with a ClueBy4) > should be metric .
GH
gene heskett
Mon, Jul 25, 2022 6:04 PM

On 7/25/22 11:41, trygve@totallytrygve.com wrote:

Den 25. juli 2022 kl. 15.45.26 +02.00 skrev gene heskett gheskett@shentel.net:

On 7/25/22 09:00, Michael Marx wrote:

The STL has self-intersections.

The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case).

Once another object is involved there is a union() and CGAL is called to do it.

CGAL is really fussy about having non-broken geometry.
Does this not point to a potential problem for STL, and nudge us off into another more

informative file format such as 3mf or $3digitname for the default output?

Something whose error messages would at least point the noob to a solution?

Nope. There's a special rule for .STL files

The vertex rule states that each triangle must share two vertices with its neighboring triangles.

In other words, they need to use the same coordinates.

There are other rules, too, about which order to list the triangles, even which sequence the vertices are listed, and a defined 'inside' and 'outside'. It's really a pretty robust file format.

https://all3dp.com/1/stl-file-format-3d-printing/

No, what we have here is an example of a program with a shitty export function.They get away with it most of the time because most slicers will quietly overlook crappy code and do a 'best guess'.

(I use FormWare for resin printing. It will happily tell you exactly how much crap is in a file and if it needs repair or the creator taken out back and beaten with a ClueBy4)

Trygve

I'm a little less forgiving, so I'd likely forgo the privacy of taking
the creator out back before I
applied the ClueBy4.

But that is just me being the crotchety old coot that I am at 87 (&
counting), the battery in my pacemaker
has about 5 years left.


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

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 7/25/22 11:41, trygve@totallytrygve.com wrote: > > Den 25. juli 2022 kl. 15.45.26 +02.00 skrev gene heskett <gheskett@shentel.net>: > >> On 7/25/22 09:00, Michael Marx wrote: >> >>> The STL has self-intersections. >>> >>> The reason why one works is there is no need for a union(), it's just a bunch of triangles (bad ones in this case). >>> >>> Once another object is involved there is a union() and CGAL is called to do it. >>> >>> CGAL is really fussy about having non-broken geometry. >>> Does this not point to a potential problem for STL, and nudge us off into another more >> informative file format such as 3mf or $3digitname for the default output? >> >> Something whose error messages would at least point the noob to a solution? >> > Nope. There's a special rule for .STL files > > The vertex rule states that each triangle must share two vertices with its neighboring triangles. > > In other words, they need to use the same coordinates. > > There are other rules, too, about which order to list the triangles, even which sequence the vertices are listed, and a defined 'inside' and 'outside'. It's really a pretty robust file format. > > <https://all3dp.com/1/stl-file-format-3d-printing/> > > > > No, what we have here is an example of a program with a shitty export function.They get away with it most of the time because most slicers will quietly overlook crappy code and do a 'best guess'. > > (I use FormWare for resin printing. It will happily tell you exactly how much crap is in a file and if it needs repair or the creator taken out back and beaten with a ClueBy4) > > Trygve > I'm a little less forgiving, so I'd likely forgo the privacy of taking the creator out back before I applied the ClueBy4. But that is just me being the crotchety old coot that I am at 87 (& counting), the battery in my pacemaker has about 5 years left. > > > > > > > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
GH
gene heskett
Mon, Jul 25, 2022 6:07 PM

On 7/25/22 13:58, Raymond West wrote:

beaten with a ClueBy4)

should be metric .

True Ray, but 101.6mm just doesn't roll of the tongue quite right, on
this side of the pond anyway. :)


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

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

On 7/25/22 13:58, Raymond West wrote: > >> beaten with a ClueBy4) >> > should be metric . > True Ray, but 101.6mm just doesn't roll of the tongue quite right, on this side of the pond anyway. :) > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > . Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/>
JJ
Julien Jacquet
Mon, Jul 25, 2022 6:37 PM

Thanks, it works:
[image: yes.png]

Le lun. 25 juil. 2022 à 20:08, gene heskett gheskett@shentel.net a écrit :

On 7/25/22 13:58, Raymond West wrote:

beaten with a ClueBy4)

should be metric .

True Ray, but 101.6mm just doesn't roll of the tongue quite right, on
this side of the pond anyway. :)


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

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.


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

Thanks, it works: [image: yes.png] Le lun. 25 juil. 2022 à 20:08, gene heskett <gheskett@shentel.net> a écrit : > On 7/25/22 13:58, Raymond West wrote: > > > >> beaten with a ClueBy4) > >> > > should be metric . > > > True Ray, but 101.6mm just doesn't roll of the tongue quite right, on > this side of the pond anyway. :) > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > . > > > Cheers, Gene Heskett. > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author, 1940) > If we desire respect for the law, we must first make the law respectable. > - Louis D. Brandeis > Genes Web page <http://geneslinuxbox.net:6309/> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >