RW
Raymond West
Mon, Sep 14, 2026 3:46 PM
Hi Jon,
If you want a stand-alone version, then I think all the steps are in
MeshLab. Here's the method for the final re-meshing. I've not checked or
tested it. If you are dealing with other unknown folks stl files, then
MeshLab is incredibly useful, but pretty complicated. However you can
use one of the free AI's for specific guidance.
'The STL contains degenerate triangles, duplicate faces and open
boundaries, so ordinary repair does not make it manifold. A practical
solution is MeshLab’s Alpha Wrap filter, which uses CGAL’s 3D Alpha
Wrapping algorithm to construct a new watertight surface around the
faulty mesh.
Using MeshLab 2023.12 or newer:
- Open the STL.
- Select Filters → Remeshing, Simplification and Reconstruction →
Alpha Wrap.
- Set Alpha to |0.01|.
- Set Offset to approximately |0.00033|.
- Apply the filter.
- Export the newly created mesh as STL.
This produces a watertight, intersection-free, manifold mesh. It is an
approximate reconstruction rather than a dimension-perfect repair, so
very small details may change slightly. A smaller Alpha retains more
detail but takes longer and creates more triangles.'
Best wishes,
Ray
On 13/09/2026 20:25, Jon Bondy wrote:
Ray
I'm not sure I'm following all of the details, but if you have created
a better repair utility, is there any way you can create a stand-alone
version?
Thanks.
Jon
On 9/13/2026 12:56 PM, Raymond West via Discuss wrote:
Hi Terry,
I've been developing my own cad dsl, with the cpp code being written
by various AI's, for about a year, now. Most of the stl's I've found
on the web, are none manifold. This one was particularly interesting.
It would have been simpler to redraw the bracket. Anyway, here is my
cad code, to get a manifold result
//terrytest
a=load_stl("C:\Users\ray\Downloads\Micro Servo SG90 Mount -
4248363\files\SG90mount.stl")
verbose_set_global(true)
show_viewer(a)
b=repair(a)
show_viewer(b)
I now use Codex to generates cpp functions for me, it updated the
existing repair code, and I asked it to summarise the process, the
steps within 'repair', to get a manifold bracket. I do not think you
could find an obvious solution on-line, and for a one-off, a Dremel
fix is good.
Anyway, this is the problem as Codex described:-
'The original |SG90mount.stl| was not manifold. It contained 12
zero-area/degenerate triangles. Removing those exposed 17 open
boundary edges arranged into four irregular loops, including loops
spanning substantial portions of the model rather than simple missing
triangular faces.
Ordinary repair made matters worse because it interpreted these loops
as holes and capped them. MeshLab’s topology repair also closed the
boundaries but still produced a non-manifold result. CGAL
polygon-soup repair, face orientation and coincident-border stitching
were then attempted, but 17 open edges remained.
As a last resort, I used CGAL Alpha Wrapping to reconstruct a
watertight surface around the original geometry. The resulting mesh
passed validation with:
- Zero boundary edges
- Zero non-manifold edges
- Zero degenerate faces
- Approximately 49,000 triangles
- An outward dimensional change of approximately 0.015 mm at the
bounding surfaces
Thus, the problem was more complicated than a couple of missing
triangles: the STL contained malformed seam/T-junction-like topology
that could not be corrected reliably by simple hole filling.
The wrapped result is now manifold, so mesh simplification should be
possible. However, it should be done conservatively and followed by
another manifold check, because aggressive simplification could
remove small mounting details or reintroduce invalid geometry.'
the original was
[show_viewer] Shape: mesh: vertices=0 tris=0 | raw_mesh: vertices=730
potential_tris=1502 invalid_tris=12 duplicate_tris=0
boundary_edges=20 nonmanifold_edges=0
the result was
[show_viewer] Shape: mesh: vertices=24627 tris=49294 | raw_mesh:
vertices=24627 potential_tris=49294 invalid_tris=0 duplicate_tris=0
boundary_edges=0 nonmanifold_edges=0
Best wishes,
Ray
On 13/09/2026 13:44, Terry (Gmail) via Discuss wrote:
I may have copied my last post (my latest reply to Jordan Brown) to a
wrong list, so copying it here.
On Sat, 12 Sep 2026 19:33:04 -0700, you wrote:
On 9/12/2026 3:22 PM, Terry Pinnell wrote:
Have you tried it yet on your presumably modern version of OpenSCAD?
Same problem. I'm not an expert at analyzing bad STLs. I didn't see
any problems, but I handed it to a couple of online STL checkers and
they said that it has several holes, several backwards faces, and
several degenerate faces.
Ask Mr. Google for "STL checker".
I'm not sure I understand what you mean. Various 'issues' have arisen as I've worked on it throughout today. But the core task is clear enough: getting the STL into shape so that my code will work.
What I meant was that you were encountering two distinct problems.
The convexity problem manifests as parts - in this case large parts - of
the model being transparent. That is, as the AI said, a preview
problem, but it can be quite disconcerting. It's also pretty easy to
diagnose and address.
The topology problem - that the faces don't fit together right - is
harder to diagnose and fix. Easiest is probably to find a
check-and-repair tool and let it do the repair, then inspect to make
sure it didn't do anything bad. In theory you could find the bad faces
manually and repair them manually, but it wouldn't be fun.
You should probably upgrade to a recent build, but as I said it won't
solve this problem. My recommendations at this point would be to either
track down a check/repair tool, or ask on the mailing list (making it
clear that you've addressed the convexity problem and that you're
encountering CGAL and Manifold problems), or just reverse engineer the
part and recreate it using OpenSCAD.
Thanks, understood.
I did investigate several repair tools. Including several AI agents'
apparent favourite, 3D Builder, which was withdrawn over two years ago!
And Prura's 'Netfabb'. And Autodesk, etc. Still looking but all those
returned a result from my code that showed an empty screen. Typical
message in OpenSCAD: "The given mesh is not closed! Unable to convert to
Despite what I said about hating unsolved puzzles, there are limits!
I'll use my Dremel.
But if this is down to OpenSCAD being extraordinarily intolerant that's
worrying, as I expect to be downloading more small functional parts for
minor edits.
"ask on the mailing list.."
Sorry, my mistake, I carelessly assumed my subsequent posts after the
original were going to the list. I'll cc this one.
Terry
====================
Sun 13 Sep 2026
Also just found a very relevant thread dated 29/5/26 titled 'beginners
question'. This extract is from a post in it by Rogier Wolff:
"OpenScad has, for ages, used the CGAL library for rendering the
geometry that you've defined.
About two years ago someone started a project to replace CGAL. It is
called "manifold". The openscad programmers, have for a while kept the
feature "included, but disabled by default" to allow for more
testing. I'm not sure if it would be "enabled by default" on the most
recent version or not. That said, if you have the latest stable release
it certainly has it available!"
But the latest stable release is five years old, 2021.2.1, which is what
I have.
And it does not seem to 'have it available'. There is no reference
to a Manifold version instead of CGAL.
https://www.dropbox.com/scl/fi/z4gn74nwvtsy1e2gk2shf/Preferences-Advanced.jpg?rlkey=u5mvb4rhhrjsyrdgy741kkd4o&raw=1
If I then look at Development Snapshots
https://openscad.org/downloads.html?utm_source=chatgpt.com#snapshots
I'm dismayed to read
"Windows
System requirements: Windows 11 (64-bit), or newer, Intel/AMD system
(ARM based systems are not supported)."
Can anyone using Win 10 please confirm that this disappointing
limitation is true. IOW, using Manifold instead of CGAL is impossible.
Terry
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
Hi Jon,
If you want a stand-alone version, then I think all the steps are in
MeshLab. Here's the method for the final re-meshing. I've not checked or
tested it. If you are dealing with other unknown folks stl files, then
MeshLab is incredibly useful, but pretty complicated. However you can
use one of the free AI's for specific guidance.
'The STL contains degenerate triangles, duplicate faces and open
boundaries, so ordinary repair does not make it manifold. A practical
solution is MeshLab’s *Alpha Wrap* filter, which uses CGAL’s 3D Alpha
Wrapping algorithm to construct a new watertight surface around the
faulty mesh.
Using MeshLab 2023.12 or newer:
1. Open the STL.
2. Select *Filters → Remeshing, Simplification and Reconstruction →
Alpha Wrap*.
3. Set *Alpha* to |0.01|.
4. Set *Offset* to approximately |0.00033|.
5. Apply the filter.
6. Export the newly created mesh as STL.
This produces a watertight, intersection-free, manifold mesh. It is an
approximate reconstruction rather than a dimension-perfect repair, so
very small details may change slightly. A smaller Alpha retains more
detail but takes longer and creates more triangles.'
Best wishes,
Ray
On 13/09/2026 20:25, Jon Bondy wrote:
>
> Ray
>
> I'm not sure I'm following all of the details, but if you have created
> a better repair utility, is there any way you can create a stand-alone
> version?
>
> Thanks.
>
> Jon
>
>
> On 9/13/2026 12:56 PM, Raymond West via Discuss wrote:
>>
>> Hi Terry,
>>
>> I've been developing my own cad dsl, with the cpp code being written
>> by various AI's, for about a year, now. Most of the stl's I've found
>> on the web, are none manifold. This one was particularly interesting.
>> It would have been simpler to redraw the bracket. Anyway, here is my
>> cad code, to get a manifold result
>>
>> //terrytest
>> a=load_stl("C:\Users\ray\Downloads\Micro Servo SG90 Mount -
>> 4248363\files\SG90mount.stl")
>> verbose_set_global(true)
>> show_viewer(a)
>> b=repair(a)
>> show_viewer(b)
>>
>> I now use Codex to generates cpp functions for me, it updated the
>> existing repair code, and I asked it to summarise the process, the
>> steps within 'repair', to get a manifold bracket. I do not think you
>> could find an obvious solution on-line, and for a one-off, a Dremel
>> fix is good.
>>
>> Anyway, this is the problem as Codex described:-
>>
>> 'The original |SG90mount.stl| was not manifold. It contained 12
>> zero-area/degenerate triangles. Removing those exposed 17 open
>> boundary edges arranged into four irregular loops, including loops
>> spanning substantial portions of the model rather than simple missing
>> triangular faces.
>>
>> Ordinary repair made matters worse because it interpreted these loops
>> as holes and capped them. MeshLab’s topology repair also closed the
>> boundaries but still produced a non-manifold result. CGAL
>> polygon-soup repair, face orientation and coincident-border stitching
>> were then attempted, but 17 open edges remained.
>>
>> As a last resort, I used CGAL Alpha Wrapping to reconstruct a
>> watertight surface around the original geometry. The resulting mesh
>> passed validation with:
>>
>> * Zero boundary edges
>> * Zero non-manifold edges
>> * Zero degenerate faces
>> * Approximately 49,000 triangles
>> * An outward dimensional change of approximately 0.015 mm at the
>> bounding surfaces
>>
>> Thus, the problem was more complicated than a couple of missing
>> triangles: the STL contained malformed seam/T-junction-like topology
>> that could not be corrected reliably by simple hole filling.
>>
>> The wrapped result is now manifold, so mesh simplification should be
>> possible. However, it should be done conservatively and followed by
>> another manifold check, because aggressive simplification could
>> remove small mounting details or reintroduce invalid geometry.'
>>
>> the original was
>> [show_viewer] Shape: mesh: vertices=0 tris=0 | raw_mesh: vertices=730
>> potential_tris=1502 invalid_tris=12 duplicate_tris=0
>> boundary_edges=20 nonmanifold_edges=0
>> the result was
>> [show_viewer] Shape: mesh: vertices=24627 tris=49294 | raw_mesh:
>> vertices=24627 potential_tris=49294 invalid_tris=0 duplicate_tris=0
>> boundary_edges=0 nonmanifold_edges=0
>>
>>
>> Best wishes,
>>
>> Ray
>>
>> On 13/09/2026 13:44, Terry (Gmail) via Discuss wrote:
>>> I may have copied my last post (my latest reply to Jordan Brown) to a
>>> wrong list, so copying it here.
>>>
>>> --------------------
>>> On Sat, 12 Sep 2026 19:33:04 -0700, you wrote:
>>>
>>>> On 9/12/2026 3:22 PM, Terry Pinnell wrote:
>>>>> Have you tried it yet on your presumably modern version of OpenSCAD?
>>>> Same problem. I'm not an expert at analyzing bad STLs. I didn't see
>>>> any problems, but I handed it to a couple of online STL checkers and
>>>> they said that it has several holes, several backwards faces, and
>>>> several degenerate faces.
>>>>
>>>> Ask Mr. Google for "STL checker".
>>>>
>>>>> I'm not sure I understand what you mean. Various 'issues' have arisen as I've worked on it throughout today. But the core task is clear enough: getting the STL into shape so that my code will work.
>>>> What I meant was that you were encountering two distinct problems.
>>>>
>>>> The convexity problem manifests as parts - in this case large parts - of
>>>> the model being transparent. That is, as the AI said, a preview
>>>> problem, but it can be quite disconcerting. It's also pretty easy to
>>>> diagnose and address.
>>>>
>>>> The topology problem - that the faces don't fit together right - is
>>>> harder to diagnose and fix. Easiest is probably to find a
>>>> check-and-repair tool and let it do the repair, then inspect to make
>>>> sure it didn't do anything bad. In theory you could find the bad faces
>>>> manually and repair them manually, but it wouldn't be fun.
>>>>
>>>>
>>>> You should probably upgrade to a recent build, but as I said it won't
>>>> solve this problem. My recommendations at this point would be to either
>>>> track down a check/repair tool, or ask on the mailing list (making it
>>>> clear that you've addressed the convexity problem and that you're
>>>> encountering CGAL and Manifold problems), or just reverse engineer the
>>>> part and recreate it using OpenSCAD.
>>> Thanks, understood.
>>>
>>> I did investigate several repair tools. Including several AI agents'
>>> apparent favourite, 3D Builder, which was withdrawn over two years ago!
>>> And Prura's 'Netfabb'. And Autodesk, etc. Still looking but all those
>>> returned a result from my code that showed an empty screen. Typical
>>> message in OpenSCAD: "The given mesh is not closed! Unable to convert to
>>>>> CGAL_Nef_Polyhedron."
>>> Despite what I said about hating unsolved puzzles, there are limits!
>>> I'll use my Dremel.
>>>
>>> But if this is down to OpenSCAD being extraordinarily intolerant that's
>>> worrying, as I expect to be downloading more small functional parts for
>>> minor edits.
>>>
>>> "ask on the mailing list.."
>>> Sorry, my mistake, I carelessly assumed my subsequent posts after the
>>> original *were* going to the list. I'll cc this one.
>>>
>>> Terry
>>>
>>>
>>> ====================
>>>
>>> Sun 13 Sep 2026
>>> Also just found a very relevant thread dated 29/5/26 titled 'beginners
>>> question'. This extract is from a post in it by Rogier Wolff:
>>>
>>> "OpenScad has, for ages, used the CGAL library for rendering the
>>> geometry that you've defined.
>>>
>>> About two years ago someone started a project to replace CGAL. It is
>>> called "manifold". The openscad programmers, have for a while kept the
>>> feature "included, but disabled by default" to allow for more
>>> testing. I'm not sure if it would be "enabled by default" on the most
>>> recent version or not. That said, if you have the latest stable release
>>> it certainly has it available!"
>>>
>>>
>>> But the latest stable release is five years old, 2021.2.1, which is what
>>> I have.
>>> And it does **not** seem to 'have it available'. There is no reference
>>> to a Manifold version instead of CGAL.
>>> https://www.dropbox.com/scl/fi/z4gn74nwvtsy1e2gk2shf/Preferences-Advanced.jpg?rlkey=u5mvb4rhhrjsyrdgy741kkd4o&raw=1
>>>
>>> If I then look at Development Snapshots
>>> https://openscad.org/downloads.html?utm_source=chatgpt.com#snapshots
>>> I'm dismayed to read
>>> "Windows
>>> System requirements: Windows 11 (64-bit), or newer, Intel/AMD system
>>> (ARM based systems are not supported)."
>>>
>>> Can anyone using Win 10 please confirm that this disappointing
>>> limitation is true. IOW, using Manifold instead of CGAL is impossible.
>>>
>>> Terry
>>>
>>> _______________________________________________
>>> OpenSCAD mailing list
>>> To unsubscribe send an email todiscuss-leave@lists.openscad.org
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email todiscuss-leave@lists.openscad.org
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> Virus-free.www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>