Cleanup slicer CLI
This commit is contained in:
@@ -9,10 +9,9 @@ It also exposes a CLI for slicing models, open the dropdown below to see it's he
|
|||||||
```plain
|
```plain
|
||||||
mslicer command line interface
|
mslicer command line interface
|
||||||
|
|
||||||
Usage: slicer [OPTIONS] <MESH|--position <POSITION>|--rotation <ROTATION>|--scale <SCALE>> <OUTPUT>
|
Usage: slicer [OPTIONS] <--mesh <MESH>|--position <POSITION>|--rotation <ROTATION>|--scale <SCALE>> <OUTPUT>
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
<MESH> Path to a .stl or .obj file
|
|
||||||
<OUTPUT> File to save sliced result to. Currently only .goo files can be generated
|
<OUTPUT> File to save sliced result to. Currently only .goo files can be generated
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@@ -42,12 +41,14 @@ Options:
|
|||||||
The speed to lift the platform after exposing each first layer, in mm/min [default: 65]
|
The speed to lift the platform after exposing each first layer, in mm/min [default: 65]
|
||||||
--first-retract-speed <FIRST_RETRACT_SPEED>
|
--first-retract-speed <FIRST_RETRACT_SPEED>
|
||||||
The speed to retract (move down) the platform after exposing each first layer, in mm/min [default: 150]
|
The speed to retract (move down) the platform after exposing each first layer, in mm/min [default: 150]
|
||||||
|
--mesh <MESH>
|
||||||
|
Path to a .stl or .obj file
|
||||||
--position <POSITION>
|
--position <POSITION>
|
||||||
Location of the bottom center of model bounding box. The origin is the center of the build plate [default: "0, 0, 0"]
|
Location of the bottom center of model bounding box. The origin is the center of the build plate
|
||||||
--rotation <ROTATION>
|
--rotation <ROTATION>
|
||||||
Rotation of the model in degrees, pitch, roll, yaw [default: "0, 0, 0"]
|
Rotation of the model in degrees, pitch, roll, yaw
|
||||||
--scale <SCALE>
|
--scale <SCALE>
|
||||||
Scale of the model along the X, Y, and Z axes [default: "1, 1, 1"]
|
Scale of the model along the X, Y, and Z axes
|
||||||
-h, --help
|
-h, --help
|
||||||
Print help
|
Print help
|
||||||
```
|
```
|
||||||
|
@@ -89,7 +89,7 @@ pub struct ModelArgs {
|
|||||||
pub scale: Vec<Vector3<f32>>,
|
pub scale: Vec<Vector3<f32>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CliMesh {
|
pub struct CliMesh {
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
pub position: Vector3<f32>,
|
pub position: Vector3<f32>,
|
||||||
@@ -128,7 +128,7 @@ impl CliMesh {
|
|||||||
pub fn from_matches(matches: &ArgMatches) -> Vec<Self> {
|
pub fn from_matches(matches: &ArgMatches) -> Vec<Self> {
|
||||||
let mut meshes = matches
|
let mut meshes = matches
|
||||||
.get_many::<PathBuf>("mesh")
|
.get_many::<PathBuf>("mesh")
|
||||||
.unwrap()
|
.expect("No meshes defined")
|
||||||
.zip(matches.indices_of("mesh").unwrap())
|
.zip(matches.indices_of("mesh").unwrap())
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
(
|
(
|
||||||
@@ -152,7 +152,10 @@ impl CliMesh {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (instance, idx) in instances.zip(matches.indices_of(key).unwrap()) {
|
for (instance, idx) in instances.zip(matches.indices_of(key).unwrap()) {
|
||||||
let mesh = meshes.iter_mut().rfind(|x| idx > x.0).unwrap();
|
let mesh = meshes
|
||||||
|
.iter_mut()
|
||||||
|
.rfind(|x| idx > x.0)
|
||||||
|
.expect("Mesh parameter before mesh");
|
||||||
*value(&mut mesh.1) = instance.to_owned();
|
*value(&mut mesh.1) = instance.to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,6 +168,17 @@ impl CliMesh {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for CliMesh {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
path: PathBuf::default(),
|
||||||
|
position: Vector3::zeros(),
|
||||||
|
rotation: Vector3::zeros(),
|
||||||
|
scale: Vector3::repeat(1.0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn vector_value_parser<T, const N: usize>(
|
pub fn vector_value_parser<T, const N: usize>(
|
||||||
raw: &str,
|
raw: &str,
|
||||||
) -> Result<Matrix<T, Const<N>, U1, ArrayStorage<T, N, 1>>>
|
) -> Result<Matrix<T, Const<N>, U1, ArrayStorage<T, N, 1>>>
|
||||||
|
Reference in New Issue
Block a user