Export: ExportCommand/CLI --out/MCP export with .3mf write a 3MF Core package ([Content_Types].xml, _rels/.rels, 3D/3dmodel.model; millimetres), one mesh object and build item per body, named after it, vertices shared and welded watertight (T-junctions between faces split), base-material colours when bodies carry one (STEP colours now ride on bodies). Tessellation as for STL. File > Export 3MF. Import: doc.open/drag-drop/CLI/MCP open accept .3mf and .stl; Insert Mesh (ParaMeshInsertAlignCommand) adds them to a design as a MeshImport feature. Kernel mesh bodies render, measure exactly, move and export; solid features refuse them with a clear error. 3MF reading flattens components and build transforms, converts units, reads colours; sizes, entries, nesting and element counts are capped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
21 lines
750 B
Rust
21 lines
750 B
Rust
use truck_stepio::out;
|
|
|
|
use crate::body::Body;
|
|
use crate::{KernelError, Result, guard};
|
|
|
|
/// STEP (ISO 10303-21) text for the given bodies.
|
|
pub fn step_export(bodies: &[&Body], system: &str) -> Result<String> {
|
|
if bodies.is_empty() {
|
|
return Err(KernelError::Invalid("nothing to export".into()));
|
|
}
|
|
for b in bodies {
|
|
b.require_brep("STEP export")?;
|
|
}
|
|
guard("step export", || {
|
|
let cs: Vec<_> = bodies.iter().map(|b| b.solid.compress()).collect();
|
|
let models: out::StepModels<_, _, _> = cs.iter().collect();
|
|
let header = out::StepHeaderDescriptor { organization_system: system.to_owned(), ..Default::default() };
|
|
Ok(out::CompleteStepDisplay::new(models, header).to_string())
|
|
})
|
|
}
|