discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

CGAL error subtracting STL from a cube

J
jon
Tue, Oct 27, 2020 1:04 AM

Code that used to "work" (using a simpler STL) is now failing with
this.  I am subtracting an STL from a cube.

Rendering Polygon Mesh using CGAL...

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

Geometries in cache: 18

Any hints?

Jon

Code that used to "work" (using a simpler STL) is now failing with this.  I am subtracting an STL from a cube. Rendering Polygon Mesh using CGAL... 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 Geometries in cache: 18 Any hints? Jon
J
jon
Tue, Oct 27, 2020 1:48 AM

I imagine that the STL was damaged.  After repairing it, the object is
now appearing way off in the distance, so far away that I cannot even
estimate how to bring it back to the origin.  Never had to deal with
this before.

Grump.

On 10/26/2020 9:04 PM, jon wrote:

Code that used to "work" (using a simpler STL) is now failing with
this.  I am subtracting an STL from a cube.

Rendering Polygon Mesh using CGAL...

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

Geometries in cache: 18

Any hints?

Jon


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I imagine that the STL was damaged.  After repairing it, the object is now appearing way off in the distance, so far away that I cannot even estimate how to bring it back to the origin.  Never had to deal with this before. Grump. On 10/26/2020 9:04 PM, jon wrote: > > Code that used to "work" (using a simpler STL) is now failing with > this.  I am subtracting an STL from a cube. > > > Rendering Polygon Mesh using CGAL... > > 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 > > Geometries in cache: 18 > > > > Any hints? > > > Jon > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
C
cbernhardt
Wed, Oct 28, 2020 6:30 PM

Can you post the code and the STL file?

--
Sent from: http://forum.openscad.org/

Can you post the code and the STL file? -- Sent from: http://forum.openscad.org/
C
cbernhardt
Thu, Oct 29, 2020 8:57 PM

I received the two files you sent to me.  Here are some statistics for the
two files.

Jon-mesh-export-3 - MM Repair.stl
input=MESHMIXER-STL-BINARY-FORMAT
299660 Triangles
xmin=0.000 xmax=10.398 xrange=10.398
ymin=0.000 ymax=25.400 yrange=25.400
zmin=-0.000 zmax=16.921 zrange=16.921

Hollow Face 2.stl
input=solid OpenSCAD_Model ASCII format
xmin=1.696 xmax=80.000 xrange=78.304
ymin=-66.332 ymax=68.700 yrange=135.032
zmin=-178.294 zmax=11.098 zrange=189.392

In the picture below the  Jon-mesh-export-3 - MM Repair.stl mode is shown in
red and the Hollow Face 2.stl
model is in yellow.  You did not send me the OpenSCAD code so I don't know
how you are subtracting them from a cube.
Hope this helps.
Charles
http://forum.openscad.org/file/t1309/jon_hollow.jpg

--
Sent from: http://forum.openscad.org/

I received the two files you sent to me. Here are some statistics for the two files. Jon-mesh-export-3 - MM Repair.stl input=MESHMIXER-STL-BINARY-FORMAT 299660 Triangles xmin=0.000 xmax=10.398 xrange=10.398 ymin=0.000 ymax=25.400 yrange=25.400 zmin=-0.000 zmax=16.921 zrange=16.921 Hollow Face 2.stl input=solid OpenSCAD_Model ASCII format xmin=1.696 xmax=80.000 xrange=78.304 ymin=-66.332 ymax=68.700 yrange=135.032 zmin=-178.294 zmax=11.098 zrange=189.392 In the picture below the Jon-mesh-export-3 - MM Repair.stl mode is shown in red and the Hollow Face 2.stl model is in yellow. You did not send me the OpenSCAD code so I don't know how you are subtracting them from a cube. Hope this helps. Charles <http://forum.openscad.org/file/t1309/jon_hollow.jpg> -- Sent from: http://forum.openscad.org/
J
jon
Fri, Oct 30, 2020 11:33 AM

Charlie:

I sent you 3 emails, which bounced.  This is what was in them. I have
also attached the OpenSCAD source code.

I have attached the test code and am sending two larger STLs using
WeTransfer.  You will have to mess with the import() statement to aim it
at the STL on your system.  The code is supposed to subtract two solid
heads from each other, with one offset by 10 mm.  The result is supposed
to be a thin facial surface, but what I see here is just the original
STL file, probably as a result of the error.  I am also sending what I
was expecting (but using a cartoon face).

The MM Repair STL is the one that is used by my code.  The Hollow Face 2
STL is just to show you what it is supposed to look like after the code
runs.

I imagine that there is something about the complexity of the STL that
is causing the problem.  Maybe you will see something that I have not. 
Note that I have cleaned up this STL quite a few times using a variety
of programs in order to remove pinholes and the like.

Thanks for your help!

This is the log from running that code:

Parsing design (AST generation)...
Compiling design (CSG Tree generation)...
Rendering Polygon Mesh using CGAL...

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

Geometries in cache: 7

Geometry cache size in bytes: 86304872

CGAL Polyhedrons in cache: 0

CGAL cache size in bytes: 0

Total rendering time: 0 hours, 23 minutes, 17 seconds

Top level object is a 3D object:

Simple: yes

Vertices: 149822

Halfedges: 898980

Edges: 449490

Halffacets: 599320

Facets: 299660

Volumes: 2

Rendering finished.

On 10/29/2020 4:57 PM, cbernhardt wrote:

I received the two files you sent to me.  Here are some statistics for the
two files.

Charlie: I sent you 3 emails, which bounced.  This is what was in them. I have also attached the OpenSCAD source code. I have attached the test code and am sending two larger STLs using WeTransfer.  You will have to mess with the import() statement to aim it at the STL on your system.  The code is supposed to subtract two solid heads from each other, with one offset by 10 mm.  The result is supposed to be a thin facial surface, but what I see here is just the original STL file, probably as a result of the error.  I am also sending what I was expecting (but using a cartoon face). The MM Repair STL is the one that is used by my code.  The Hollow Face 2 STL is just to show you what it is supposed to look like after the code runs. I imagine that there is something about the complexity of the STL that is causing the problem.  Maybe you will see something that I have not.  Note that I have cleaned up this STL quite a few times using a variety of programs in order to remove pinholes and the like. Thanks for your help! This is the log from running that code: Parsing design (AST generation)... Compiling design (CSG Tree generation)... Rendering Polygon Mesh using CGAL... ERROR: CGAL error in CGALUtils::applyBinaryOperator difference: 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 Geometries in cache: 7 Geometry cache size in bytes: 86304872 CGAL Polyhedrons in cache: 0 CGAL cache size in bytes: 0 Total rendering time: 0 hours, 23 minutes, 17 seconds Top level object is a 3D object: Simple: yes Vertices: 149822 Halfedges: 898980 Edges: 449490 Halffacets: 599320 Facets: 299660 Volumes: 2 Rendering finished. On 10/29/2020 4:57 PM, cbernhardt wrote: > I received the two files you sent to me. Here are some statistics for the > two files. >
C
cbernhardt
Fri, Oct 30, 2020 8:11 PM

I tried your code and OpenSCAD chocked.  The first thing I noticed is that (I
assume) you are trying to get a 10mm thick face shell, but your model is
only 10 x 25 x 17.  I think OpenSCAD is not the program with which to
accomplish this.  I scaled up your model by a factor of 10, brought it into
Meshmixer, sliced off the back face, brought it into Blender and solidified
it 2mm.  Below is the result.  Not the answer you were looking for, but it
works
http://forum.openscad.org/file/t1309/face.jpg

--
Sent from: http://forum.openscad.org/

I tried your code and OpenSCAD chocked. The first thing I noticed is that (I assume) you are trying to get a 10mm thick face shell, but your model is only 10 x 25 x 17. I think OpenSCAD is not the program with which to accomplish this. I scaled up your model by a factor of 10, brought it into Meshmixer, sliced off the back face, brought it into Blender and solidified it 2mm. Below is the result. Not the answer you were looking for, but it works <http://forum.openscad.org/file/t1309/face.jpg> -- Sent from: http://forum.openscad.org/
J
jon
Fri, Oct 30, 2020 9:07 PM

Thanks!

l understand that the STL is small, but I scale it up to the correct
side in the code.  I have about 20 different models that I derive from
that face STL in OpenSCAD, so getting it to work is important to me.  
That said, it may be impossible, for reasons I cannot understand.

Jon

On 10/30/2020 4:11 PM, cbernhardt wrote:

I tried your code and OpenSCAD chocked.  The first thing I noticed is that (I
assume) you are trying to get a 10mm thick face shell, but your model is
only 10 x 25 x 17.  I think OpenSCAD is not the program with which to
accomplish this.  I scaled up your model by a factor of 10, brought it into
Meshmixer, sliced off the back face, brought it into Blender and solidified
it 2mm.  Below is the result.  Not the answer you were looking for, but it
works
http://forum.openscad.org/file/t1309/face.jpg

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Thanks! l understand that the STL is small, but I scale it up to the correct side in the code.  I have about 20 different models that I derive from that face STL in OpenSCAD, so getting it to work is important to me.   That said, it may be impossible, for reasons I cannot understand. Jon On 10/30/2020 4:11 PM, cbernhardt wrote: > I tried your code and OpenSCAD chocked. The first thing I noticed is that (I > assume) you are trying to get a 10mm thick face shell, but your model is > only 10 x 25 x 17. I think OpenSCAD is not the program with which to > accomplish this. I scaled up your model by a factor of 10, brought it into > Meshmixer, sliced off the back face, brought it into Blender and solidified > it 2mm. Below is the result. Not the answer you were looking for, but it > works > <http://forum.openscad.org/file/t1309/face.jpg> > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
R
rickan
Fri, Oct 30, 2020 9:35 PM

I have some ideas. If you send me the stl file I'll if they are relevant, and
see what I can do.

--
Sent from: http://forum.openscad.org/

I have some ideas. If you send me the stl file I'll if they are relevant, and see what I can do. -- Sent from: http://forum.openscad.org/
R
rickan
Sat, Oct 31, 2020 3:19 AM

None of my ideas were relevant.

But I made two attempts to get what I think you want using different methods
and both look oddly fractured in preview and do not render with thin shells.
The surreal fractures in preview seem identical with both methods and
independent of thickness. I mean when I change the file the preview doesn't
change except for the thickness if I change that. The fractures do not
change. But they migrate and morph oddly as if not part of the model when
you alter the POV.

The errors from render are in the scad file.

I set it up to generate the shell using scale instead of translate and the
surreal fractures show up in preview even when the shell thickness is 50%.
However! It renders at that thickness! (It did not render at 25% and at
least one thinner value I tried, probably 5%.) I suppose you could do a
binary search for a thickness that is thinner than 50% which renders. This
has me thinking that the stl interferes with itself when the shell thickness
is too thin, i.e. one or more of the craggy features, e.g. in the beard
perforate the shell. That's just a hypothesis. Well, I'm pretty sure it
happens if the shell is thin enough, but I don't know why that would be a
problem.

I made a third attempt just to subtract the face from a cube and that
previews and renders fine. I would expect, from my limited experience, that
any difference or intersection with the stl would fail, not just a
difference or intersection of the stl with itself depending on the relative
scale.

I did do a 1% translation to avoid the pesky ~0 thickness membrane. Maybe
that's big enough to cause interference between the two surfaces. Maybe that
should be reduced to 0.1%. I kind of doubt that's the problem though.

HollowFaceRMK.scad http://forum.openscad.org/file/t1112/HollowFaceRMK.scad

HollowFaceRMK.png http://forum.openscad.org/file/t1112/HollowFaceRMK.png

--
Sent from: http://forum.openscad.org/

None of my ideas were relevant. But I made two attempts to get what I think you want using different methods and both look oddly fractured in preview and do not render with thin shells. The surreal fractures in preview seem identical with both methods and independent of thickness. I mean when I change the file the preview doesn't change except for the thickness if I change that. The fractures do not change. But they migrate and morph oddly as if not part of the model when you alter the POV. The errors from render are in the scad file. I set it up to generate the shell using scale instead of translate and the surreal fractures show up in preview even when the shell thickness is 50%. However! It renders at that thickness! (It did not render at 25% and at least one thinner value I tried, probably 5%.) I suppose you could do a binary search for a thickness that is thinner than 50% which renders. This has me thinking that the stl interferes with itself when the shell thickness is too thin, i.e. one or more of the craggy features, e.g. in the beard perforate the shell. That's just a hypothesis. Well, I'm pretty sure it happens if the shell is thin enough, but I don't know why that would be a problem. I made a third attempt just to subtract the face from a cube and that previews and renders fine. I would expect, from my limited experience, that any difference or intersection with the stl would fail, not just a difference or intersection of the stl with itself depending on the relative scale. I did do a 1% translation to avoid the pesky ~0 thickness membrane. Maybe that's big enough to cause interference between the two surfaces. Maybe that should be reduced to 0.1%. I kind of doubt that's the problem though. HollowFaceRMK.scad <http://forum.openscad.org/file/t1112/HollowFaceRMK.scad> HollowFaceRMK.png <http://forum.openscad.org/file/t1112/HollowFaceRMK.png> -- Sent from: http://forum.openscad.org/
NH
nop head
Sat, Oct 31, 2020 8:29 AM

I think you need to set convexity in the import statement to get it to
preview correctly.

On Sat, 31 Oct 2020 at 03:20, rickan richard@kandarian.com wrote:

None of my ideas were relevant.

But I made two attempts to get what I think you want using different
methods
and both look oddly fractured in preview and do not render with thin
shells.
The surreal fractures in preview seem identical with both methods and
independent of thickness. I mean when I change the file the preview doesn't
change except for the thickness if I change that. The fractures do not
change. But they migrate and morph oddly as if not part of the model when
you alter the POV.

The errors from render are in the scad file.

I set it up to generate the shell using scale instead of translate and the
surreal fractures show up in preview even when the shell thickness is 50%.
However! It renders at that thickness! (It did not render at 25% and at
least one thinner value I tried, probably 5%.) I suppose you could do a
binary search for a thickness that is thinner than 50% which renders. This
has me thinking that the stl interferes with itself when the shell
thickness
is too thin, i.e. one or more of the craggy features, e.g. in the beard
perforate the shell. That's just a hypothesis. Well, I'm pretty sure it
happens if the shell is thin enough, but I don't know why that would be a
problem.

I made a third attempt just to subtract the face from a cube and that
previews and renders fine. I would expect, from my limited experience, that
any difference or intersection with the stl would fail, not just a
difference or intersection of the stl with itself depending on the relative
scale.

I did do a 1% translation to avoid the pesky ~0 thickness membrane. Maybe
that's big enough to cause interference between the two surfaces. Maybe
that
should be reduced to 0.1%. I kind of doubt that's the problem though.

HollowFaceRMK.scad <
http://forum.openscad.org/file/t1112/HollowFaceRMK.scad>

HollowFaceRMK.png http://forum.openscad.org/file/t1112/HollowFaceRMK.png

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I think you need to set convexity in the import statement to get it to preview correctly. On Sat, 31 Oct 2020 at 03:20, rickan <richard@kandarian.com> wrote: > None of my ideas were relevant. > > But I made two attempts to get what I think you want using different > methods > and both look oddly fractured in preview and do not render with thin > shells. > The surreal fractures in preview seem identical with both methods and > independent of thickness. I mean when I change the file the preview doesn't > change except for the thickness if I change that. The fractures do not > change. But they migrate and morph oddly as if not part of the model when > you alter the POV. > > The errors from render are in the scad file. > > I set it up to generate the shell using scale instead of translate and the > surreal fractures show up in preview even when the shell thickness is 50%. > However! It renders at that thickness! (It did not render at 25% and at > least one thinner value I tried, probably 5%.) I suppose you could do a > binary search for a thickness that is thinner than 50% which renders. This > has me thinking that the stl interferes with itself when the shell > thickness > is too thin, i.e. one or more of the craggy features, e.g. in the beard > perforate the shell. That's just a hypothesis. Well, I'm pretty sure it > happens if the shell is thin enough, but I don't know why that would be a > problem. > > I made a third attempt just to subtract the face from a cube and that > previews and renders fine. I would expect, from my limited experience, that > any difference or intersection with the stl would fail, not just a > difference or intersection of the stl with itself depending on the relative > scale. > > I did do a 1% translation to avoid the pesky ~0 thickness membrane. Maybe > that's big enough to cause interference between the two surfaces. Maybe > that > should be reduced to 0.1%. I kind of doubt that's the problem though. > > HollowFaceRMK.scad < > http://forum.openscad.org/file/t1112/HollowFaceRMK.scad> > > HollowFaceRMK.png <http://forum.openscad.org/file/t1112/HollowFaceRMK.png> > > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >