Open large designs faster: meshes, face names and Measure on all cores (#916)

Display meshes after opening, the face names read when a feature finds a face by name, and inspect.measure over all bodies are now worked out per body on plain scoped threads (solidcraft_kernel::for_each_on_threads / map_on_threads), in body order and with the same results; the browser build stays serial.
This commit is contained in:
bherbruck authored and GitHub committed 2026-10-13 19:49:04 -04:00
1 parent c333889fc0
commit 6c61442bb2
7 files changed
+110 -6

No files matched your search

+11
View File
@@ -619,6 +619,17 @@ impl ModelState {
pub fn body(&self, name: &str) -> Option<&ModelBody> {
self.bodies.iter().find(|b| b.name == name)
}
/// Make every body's display mesh now, on all cores (bodies are meshed independently and
/// each keeps its own mesh, so the meshes are those `ModelBody::mesh` makes one by one).
/// Stops starting bodies once `go_on` says no.
pub fn warm_meshes(&self, go_on: impl Fn() -> bool + Sync) {
kernel::for_each_on_threads(&self.bodies, 16, |b| {
if go_on() {
let _ = b.mesh();
}
});
}
pub fn sketch(&self, feature: u64) -> Option<&SolvedSketch> {
self.sketches.iter().find(|s| s.feature == feature).map(|s| &**s)
}