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 [hidden email] 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:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Can you post the code and the STL file?
-- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.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/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
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:
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. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.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/ _______________________________________________ OpenSCAD mailing list [hidden email] 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 > [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 |
This post was updated on .
I have some ideas. If you send me the stl file I'll see if they are relevant, and
see what I can do. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.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/ _______________________________________________ OpenSCAD mailing list [hidden email] 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 <[hidden email]> wrote: None of my ideas were relevant. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
nophead: Thanks for the suggestion. A convexity of 1000 does not fix the
CGAL error. The STL in question is a 3D scan of my face, and I
have a large beard. Perhaps convexity needs to be 10,000. Who
knows. Jon On 10/31/2020 4:29 AM, nop head wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
The convexity argument is only used for displaying in preview. It has
NOTHING to do with CGAL errors which are from render. If you're getting CGAL errors it means CGAL thinks your geometry is not a manifold or is somehow malformed, so the only fix is going to be to change the geometry. jon_bondy wrote > nophead: > > Thanks for the suggestion. A convexity of 1000 does not fix the CGAL > error. The STL in question is a 3D scan of my face, and I have a large > beard. Perhaps convexity needs to be 10,000. Who knows. > > Jon > > On 10/31/2020 4:29 AM, nop head wrote: >> 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@ > > > <mailto: > richard@ > >> 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 > > <http://forum.openscad.org/file/t1112/HollowFaceRMK.scad>> >> >> HollowFaceRMK.png >> <http://forum.openscad.org/file/t1112/HollowFaceRMK.png > > <http://forum.openscad.org/file/t1112/HollowFaceRMK.png>> >> >> >> >> >> -- >> Sent from: http://forum.openscad.org/ >> <http://forum.openscad.org/> >> >> _______________________________________________ >> OpenSCAD mailing list >> > Discuss@.openscad > <mailto: > Discuss@.openscad > > >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> > Discuss@.openscad >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by nophead
Yes!
Setting convexity to 2 removes nearly all the fractures. Setting it higher seems to remove them all but makes preview extremely laggy on my computer. Without the distraction of the fractures the holes in the shell become obvious. In the attached image of the stl model subtracted from the cube with viewport settings $vpt = [-1.97, -9.31, 0.42]; $vpr = 90.00, 0.00, 90.00]; $vpd = 2.30; There is what looks like a separate blob. It is not separate, however, it is a hook in the stl which becomes an empty loop in the subtraction. Maybe that is part of the problem. HollowFaceIsland.png <http://forum.openscad.org/file/t1112/HollowFaceIsland.png> Maybe there are other nearly invisible features, e.g., long extremely thin spikes, which are causing problems also. -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by adrianv
On 2020-10-31 13:37, adrianv wrote:
> The convexity argument is only used for displaying in preview. It has > NOTHING to do with CGAL errors which are from render. If you're > getting > CGAL errors it means CGAL thinks your geometry is not a manifold or is > somehow malformed, so the only fix is going to be to change the > geometry. Indeed, the convexity parameter has nothing at all to do with geometric calculations. In my opinion that parameter should not even exist, but that's another story. Where is the STL that you are struggling with? Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Thanks, everyone, for helping out.
The STL is huge (>10MB) so I am sending it to individuals who volunteer. I will send a copy to Carsten; if anyone else is curious, please let me know Jon On 10/31/2020 8:52 AM, [hidden email] wrote: > On 2020-10-31 13:37, adrianv wrote: >> The convexity argument is only used for displaying in preview. It has >> NOTHING to do with CGAL errors which are from render. If you're getting >> CGAL errors it means CGAL thinks your geometry is not a manifold or is >> somehow malformed, so the only fix is going to be to change the >> geometry. > > Indeed, the convexity parameter has nothing at all to do with > geometric calculations. In my opinion that parameter should not even > exist, but that's another story. > > Where is the STL that you are struggling with? > > Carsten Arnholm > > _______________________________________________ > 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 |
On 31.10.2020 15:13, jon wrote:
> Thanks, everyone, for helping out. > > The STL is huge (>10MB) so I am sending it to individuals who > volunteer. I will send a copy to Carsten; if anyone else is curious, > please let me know I got your file, thanks. I ran it through polyfix which reported a number of issues (see below), and saved it in AMF format, as that is supported in OpenSCAD since 2019.05. I then ran it through your .scad code using OpenSCAD version 2020.10.11.nightly (git b416aa2) under Ubuntu. However, it failed: ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /usr/include/CGAL/Nef_S2/SM_const_decorator.h Line: 329, location unknown So instead I ran your STL through polyfix again and saved it as OBJ, as that is much more compact than AMF (but OBJ is not supported in OpenSCAD): $ polyfix "Jon-mesh-export-3 - MM Repair.stl" -out=Jon_Face_polyfix.obj Parameters: input_file = Jon-mesh-export-3 - MM Repair.stl out = Jon_Face_polyfix.obj polyhedron 0 ================= volume=1992, dtol=0.01, atol=1e-06, maxiter=10 iteration 0: vertices=898980 faces=299660 warning: nonmanifold edges: uc(1)=898980 merged 749167 vertices removed 12 collapsed or zero area faces removed 7 duplicate faces removed 2 nonmanifold faces total changes=749188 warning: nonmanifold edges: uc(1)=5 uc(3)=4 uc(4)=1 iteration 1: vertices=149813 faces=299639 warning: nonmanifold edges: uc(1)=5 uc(3)=4 uc(4)=1 split 3 faces removed 1 duplicate face removed 3 nonmanifold faces removed 6 zero area faces total changes=13 warning: nonmanifold edges: uc(4)=1 iteration 2: vertices=149813 faces=299634 warning: nonmanifold edges: uc(4)=1 removed 1 unused vertex total changes=1 warning: nonmanifold edges: uc(4)=1 iteration 3: vertices=149812 faces=299634 warning: nonmanifold edges: uc(4)=1 total changes=0 warning: nonmanifold edges: uc(4)=1 Summary: polyhedron 0: vertices=149812 faces=299634 : warning: nonmanifold edges: uc(4)=1 Writing: Jon_Face_polyfix_1.obj ... polyfix finished, time used: 0d 00h 02m 36s The summary says the result contains one edge with use-count=4, so it is not perfectly repaired, but it might still work in AngelCAD. I wrote a few lines of code to make the hollow face, but dropped the cube as it did not seem to intersect with the Face (?). See attached image of result. If you allow I will upload the AngelCAD code and the resulting STL (26.1 MB) to a github gist, so you can be viewed and you can download it. Is that ok? Regards Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
> On 31.10.2020 15:13, jon wrote:
>> Thanks, everyone, for helping out. The script and files are here: https://github.com/arnholm/hollow_face You can get the file in 2 ways Method 1: Go to the page above and find the green button that says "Code" and select the "Download Zip" to get all files, including the STL and OBJ files. Method 2: Clone the repository using git to get all files. $ git clone https://github.com/arnholm/hollow_face Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |