Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch default unit to millimetres for unitless formats #754

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions modeling-cmds/src/format/obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@
///
/// [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html
pub coords: coord::System,

/// The units of the input data.
///
/// This is very important for correct scaling and when calculating physics properties like
/// mass, etc.
///
/// Defaults to meters.
/// Defaults to millimeters.
pub units: UnitLength,
}

impl Default for Options {
fn default() -> Self {
Self {
coords: *coord::KITTYCAD,
units: UnitLength::Meters,
units: UnitLength::Millimeters,

Check warning on line 38 in modeling-cmds/src/format/obj.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/format/obj.rs#L38

Added line #L38 was not covered by tests
}
}
}
Expand All @@ -59,15 +61,15 @@

/// Export length unit.
///
/// Defaults to meters.
/// Defaults to millimeters.
pub units: UnitLength,
}

impl Default for Options {
fn default() -> Self {
Self {
coords: *coord::KITTYCAD,
units: UnitLength::Meters,
units: UnitLength::Millimeters,

Check warning on line 72 in modeling-cmds/src/format/obj.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/format/obj.rs#L72

Added line #L72 was not covered by tests
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions modeling-cmds/src/format/ply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@
///
/// [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html
pub coords: coord::System,

/// The units of the input data.
///
/// This is very important for correct scaling and when calculating physics properties like
/// mass, etc.
pub units: crate::units::UnitLength,
///
/// Defaults to millimeters.
pub units: UnitLength,
}

impl Default for Options {
fn default() -> Self {
Self {
coords: *coord::KITTYCAD,
// We can default to meters and fix it later if needed.
units: crate::units::UnitLength::Meters,
units: UnitLength::Millimeters,

Check warning on line 38 in modeling-cmds/src/format/ply.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/format/ply.rs#L38

Added line #L38 was not covered by tests
}
}
}
Expand Down Expand Up @@ -65,7 +68,7 @@

/// Export length unit.
///
/// Defaults to meters.
/// Defaults to millimeters.
pub units: UnitLength,
}

Expand All @@ -75,7 +78,7 @@
coords: *coord::KITTYCAD,
selection: Default::default(),
storage: Default::default(),
units: UnitLength::Meters,
units: UnitLength::Millimeters,

Check warning on line 81 in modeling-cmds/src/format/ply.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/format/ply.rs#L81

Added line #L81 was not covered by tests
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions modeling-cmds/src/format/stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
/// [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html
pub coords: coord::System,
/// The units of the input data.
///
/// This is very important for correct scaling and when calculating physics properties like
/// mass, etc.
pub units: crate::units::UnitLength,
///
/// Defaults to millimeters.
pub units: UnitLength,
}

impl Default for Options {
fn default() -> Self {
Self {
coords: *coord::KITTYCAD,
units: UnitLength::Meters,
units: UnitLength::Millimeters,

Check warning on line 37 in modeling-cmds/src/format/stl.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/format/stl.rs#L37

Added line #L37 was not covered by tests
}
}
}
Expand Down Expand Up @@ -64,7 +67,7 @@

/// Export length unit.
///
/// Defaults to meters.
/// Defaults to millimeters.
pub units: UnitLength,
}

Expand All @@ -74,7 +77,7 @@
coords: *coord::KITTYCAD,
selection: Default::default(),
storage: Default::default(),
units: UnitLength::Meters,
units: UnitLength::Millimeters,

Check warning on line 80 in modeling-cmds/src/format/stl.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/format/stl.rs#L80

Added line #L80 was not covered by tests
}
}
}
Expand Down