microcad_export/json/
mod.rs

1// Copyright © 2025 The µcad authors <info@ucad.xyz>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4//! STL exporter.
5
6use microcad_lang::{
7    builtin::{ExportError, Exporter, FileIoInterface},
8    model::{Model, OutputType},
9    value::Value,
10    Id,
11};
12
13/// STL Exporter.
14pub struct JsonExporter;
15
16impl Exporter for JsonExporter {
17    fn export(&self, model: &Model, filename: &std::path::Path) -> Result<Value, ExportError> {
18        log::debug!("Exporting model into {filename:?}");
19        let mut f = std::fs::File::create(filename)?;
20        log::trace!("Model to export:\n{model}");
21        let _writer = std::io::BufWriter::new(&mut f);
22        todo!("export json");
23    }
24
25    fn output_type(&self) -> OutputType {
26        OutputType::Geometry3D
27    }
28}
29
30impl FileIoInterface for JsonExporter {
31    fn id(&self) -> Id {
32        Id::new("json")
33    }
34}