geometry: read tagged meshes through the VFS, refuse singular transforms, share the model's coordinate limit (#6)

read_3mf_file reads through solidcraft_io::vfs like open_design_file (regular files only,
browser files too), so the engine drops its own capped reader and EngineError::File.
A build item whose transform flattens its object is an error, and coordinates use
modelcraft_model::MAX_COORD (1e9) instead of a looser limit of their own.


Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

Co-authored-by: jyviko <2501648+jyviko@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-10-13 14:52:53 -04:00
1 parent f181c98b75
commit 2c1821d0ad
7 files changed
+44 -27

No files matched your search

-14
View File
@@ -38,17 +38,3 @@ pub(crate) fn xyz(p: &Value, key: &str) -> Result<[f64; 3]> {
}
Ok(out)
}
/// A file's bytes, refusing anything over `cap`.
pub(crate) fn read_capped(path: &str, cap: usize) -> Result<Vec<u8>> {
use std::io::Read;
let err = |e: std::io::Error| EngineError::File(format!("{path}: {e}"));
let f = std::fs::File::open(path).map_err(err)?;
let len = f.metadata().map(|m| m.len()).unwrap_or(0);
let mut bytes = Vec::with_capacity(usize::try_from(len).unwrap_or(0).min(cap));
f.take(cap as u64 + 1).read_to_end(&mut bytes).map_err(err)?;
if bytes.len() > cap {
return Err(EngineError::File(format!("{path}: larger than {} MB", cap >> 20)));
}
Ok(bytes)
}