-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1846 from hannobraun/export-validator
Re-enable `export-validator`
- Loading branch information
Showing
6 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
use std::ops::Deref; | ||
use std::{ops::Deref, path::PathBuf}; | ||
|
||
use fj_kernel::algorithms::{approx::Tolerance, triangulate::Triangulate}; | ||
|
||
fn main() -> anyhow::Result<()> { | ||
let args = Args::parse(); | ||
|
||
let cuboid = cuboid::cuboid(3., 2., 1.); | ||
|
||
// The tolerance makes no difference for this model, as there aren't any | ||
// curves. | ||
let tolerance = Tolerance::from_scalar(1.)?; | ||
|
||
let mesh = (cuboid.deref(), tolerance).triangulate(); | ||
fj_window::run(mesh, false)?; | ||
|
||
if let Some(path) = args.export { | ||
fj_export::export(&mesh, &path)?; | ||
} else { | ||
fj_window::run(mesh, false)?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
/// Standardized CLI for Fornjot models | ||
#[derive(clap::Parser)] | ||
pub struct Args { | ||
/// Export model to this path | ||
#[arg(short, long, value_name = "PATH")] | ||
pub export: Option<PathBuf>, | ||
} | ||
|
||
impl Args { | ||
/// Parse the command-line arguments | ||
/// | ||
/// Convenience method that saves the caller from having to import the | ||
/// `clap::Parser` trait. | ||
pub fn parse() -> Self { | ||
<Self as clap::Parser>::parse() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters