I have a little niggle regarding technically closed / watertight meshes that OpenSCAD refuses to process. It would be great if FreeCAD could identify and repair such meshes so that I don't have to do a manual hunt with Blender to patch up the mesh.
The issue is that some vertices can intersect (or be very close to) line boundaries, and CGAL doesn't like this, even if the vertex points and all edges lie precisely on other lines. I have included an example cube which has this issue (as well as the generating OpenSCAD code), where one face is composed of three triangles that join at a point half-way down an edge on another face. All points on the cube are integer values, and all edges are aligned to other edges.
[FWIW, I did try a tetrahedron version of this, but FreeCAD complained about surface folds]
The way I fix this in Blender is to tediously inspect the mesh for these situations (Blender's sharpness mesh analysis helps), delete the offending intersecting vertex, then re-triangulate the space to make sure that no triangle points lie in the middle of an edge. This makes sure that all triangles have positive areas.
An alternative fix would be to insert a very thin triangle that connects the offending vertex to the extents of the edge it is near. Such a fix would preserve the mesh shape, but could lead to thin triangles with zero area.
... but the fix is less important than the search. Just finding where these situations happen would save me a lot of time in fixing them.
I'm using the most recent Debian version of FreeCAD, v0.19.1+dfsg1-2.
Mesh Design: identify vertices intersecting (or near) lines [feature request]
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Mesh Design: identify vertices intersecting (or near) lines [feature request]
- Attachments
-
- break_openscad.stl
- Broken STL file (as ASCII STL)
- (1.59 KiB) Downloaded 34 times
-
- break_openscad.scad
- OpenSCAD source to create the broken STL file
- (484 Bytes) Downloaded 28 times
-
- OpenSCAD screenshot demonstrating that CGAL reports a non-closed mesh
- break_openSCAD.png (149.43 KiB) Viewed 1297 times
-
- OpenSCAD screenshot demonstrating that the polyhedron alone renders fine
- openscad_noBreak.png (143.26 KiB) Viewed 1297 times
-
- FreeCAD v0.19 screenshot demonstrating that "Evaluate & Repair Mesh" reports no errors
- freecad_mesh_fine.png (213.37 KiB) Viewed 1297 times
Re: Mesh Design: identify vertices intersecting (or near) lines [feature request]
Debian is behind. Do you mind trying the development AppImage instead?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Mesh Design: identify vertices intersecting (or near) lines [feature request]
I've confirmed that this feature is not yet implemented in AppImage 25352 [FreeCAD 0.20, Libs: 0.20R25352], and still reports no errors in the STL file.
Re: Mesh Design: identify vertices intersecting (or near) lines [feature request]
There is one way to find such triangles visually. With the mesh structure in FreeCAD this kind of triangles won't have an adjacent triangle on this edge and we call it an "open" edge.
In the View property tab you will find the option "Open Edges" that is set to false. When changing it to true FreeCAD will render open edges. To see them more easily you should set the Display Mode to Shaded and if needed you can even hide the mesh -- the open edges are still displayed.
Re: Mesh Design: identify vertices intersecting (or near) lines [feature request]
There is now a function in Python to remove triangles where one of its corners lie on an edge.
In your case it will find this one point that lies on the middle of the triangle and by removing this point three triangles will be removed, too.
To fill the hole (of four boundary edges) you can call:
git commit 0a9d08218aa
Code: Select all
mesh = App.ActiveDocument.ActiveObject.Mesh.copy()
mesh.removePointsOnEdge()
To fill the hole (of four boundary edges) you can call:
Code: Select all
mesh.fillupHoles(4)
Re: Mesh Design: identify vertices intersecting (or near) lines [feature request]
With git commit e1c5bfab1f there is now in improvement which allows you to fill the hole in one go.
The algorithm only considers boundaries where a point is lying on an edge. Other boundaries are not supposed to be filled.
With your simple example STL file it works very well. Please try it also with some more complex meshes.
Code: Select all
mesh = App.ActiveDocument.ActiveObject.Mesh.copy()
mesh.removePointsOnEdge(FillBoundary = True)
With your simple example STL file it works very well. Please try it also with some more complex meshes.