Skip to main content

microcad_export/json/
mod.rs

1// Copyright © 2025-2026 The µcad authors <info@microcad.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};
11
12use microcad_lang_base::Id;
13
14/// STL Exporter.
15pub struct JsonExporter;
16
17impl Exporter for JsonExporter {
18    fn export(&self, model: &Model, filename: &std::path::Path) -> Result<Value, ExportError> {
19        log::debug!("Exporting model into {filename:?}");
20        let mut f = std::fs::File::create(filename)?;
21        log::trace!("Model to export:\n{model}");
22        let _writer = std::io::BufWriter::new(&mut f);
23        todo!("export json");
24    }
25
26    fn output_type(&self) -> OutputType {
27        OutputType::Geometry3D
28    }
29}
30
31impl FileIoInterface for JsonExporter {
32    fn id(&self) -> Id {
33        Id::new("json")
34    }
35}