3 Commits

Author SHA1 Message Date
superGeometry 777720540b Flat faces with a great many holes are meshed by the engine itself
OpenCascade's mesher takes time and memory by the square of the holes in
one face: a plate with 400 holes took 5 s and 700 MB to show, and half a
minute and 2.9 GB to send out as STL. A flat face with 30 outlines or more
is now cut into triangles here (earcut), between the very points its
neighbours' meshes have along its edges, so the mesh stays closed. The
same plate: shown in half a second less of meshing with no memory to speak
of, an edit on it twice as fast, out as STL in 4 s and 163 MB. 900 holes:
1.4 s (13 s and 1.3 GB before).

Earcut leaves out points that lie in line with their neighbours (rows of
square holes lost corners): no three points are in line for it, and the
triangles without area that makes are taken out again. The body's edge
lines come from the same points. A point wanted on such a face (a push, a
shell's checks) is found the same way.

Tests: plates with 144 round, 144 square and 400 round holes - shown,
closed, of the part's volume, out as STL closed, a face pushed, a side pulled.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-13 14:10:58 +02:00
superGeometry 3e00e60b37 A shown body no longer keeps its mesh in the kernel
The view's triangles were left on a body once it was shown, and stayed for
as long as the kernel held the body - which, for a body one of its tools
made, is for good. They are taken off once the view has them: every edit
works on a copy of the body, which has none, so nothing read them again.
Dragging a fillet on a 44-face plate 400 times: 811 MB, now 496 MB; a shell
on it 100 times: 595 MB, now 496 MB. No slower.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-13 13:06:36 +02:00
superGeometry 337c802689 Engine review: memory given back, meshes come in as solids, sweeps that say why
Memory. The kernel build frees nothing when most of its things are deleted
(one do-nothing function stands in for their destructors): a deleted handle
still counted as a user of its shape, so no body the engine made was ever
freed, and each tool kept what it had worked out. Now each is told to let go
before it is deleted (release.ts): shape handles emptied, explorers pointed
at nothing, booleans cleared and given a last tiny job so they drop their
bodies. The validity check, which left over half a megabyte behind per check
of a 35-face part, is pointed at nothing before it goes. A body's copy is
written out and read back (the kernel's copier keeps both bodies for good).
Rebuilding a hole 1500 times took the engine from 100 MB to 595 MB, now to
199 MB; a face pushed on a 44-face plate 400 times, 1871 MB, now 811 MB; a
shell on it 200 times broke the engine, now it doesn't.

Meshing. A body is meshed a few hundred faces at a time (meshing.ts): the
kernel's mesher kept working notes on every face and edge at once - a body
of 4 500 faces took 1.3 GB, one of 40 000 the 4 GB a browser allows. Same
triangles, same order. STL is written from that mesh, of a copy of the body
(the print mesh no longer stays on the model). A face's own triangles are
made for that face alone, not by meshing its whole body.

STL and 3MF meshes in. A closed mesh comes in as one solid, its flat
triangles merged (the reader hands back loose triangles; every file came in
as loose faces until Repaired, a 12-triangle block too). A binary file is
told from a text one by its length (a blank heading and round sizes made the
reader take it for text: a 10 mm cube out of a 3MF couldn't be read). Up to
250 000 triangles; more is refused at once with the count (it used to run
the engine out of memory). A broken-down engine is no longer taken for an
unreadable file.

Sweep. Facing the same way along a path that runs in the profile's own
plane never returned; a profile that changes size or turns left a sweep in
pieces at a sharp corner: both refused in words. Joins and cuts made by a
step go through one checked boolean. An unknown mode is a damaged step, not
a step that does nothing.

Tests: gridloft (340), gridio (51: up to a face or plane, STEP and STL out
and back, meshes in, split by a body, copies, memory over 400 rebuilds).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-13 12:59:39 +02:00