Skip to content
4,132 changes: 1,190 additions & 2,942 deletions solidcore/crates/solidcore/src/error/blend.rs

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions solidcore/crates/solidcore/src/error/blend/band.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//! The inputs of the planar-band contact query a blend failure names missing.
//!
//! Upstream: none. One of the modules of the blend failure causes, re-exported from
//! [`super`].

#[cfg(doc)]
use super::BlendFailure;

/// Which input of the planar-band contact query is missing ([`BlendFailure::BandInputMissing`]).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum BandInput {
/// The blended edge.
BlendedEdge,
/// The blended edge's curve.
BlendedEdgeCurve,
/// An endpoint of the blended edge.
BlendedEdgeEndpoint,
/// The chamfer's setback.
ChamferSetback,
/// The closest feet of the two bands.
ClosestBandFeet,
/// A solver's edge use.
EdgeUse,
/// The extrusion's control point in its stored net.
ExtrusionControlPoint,
/// The exact product of the extrusion's translation.
ExtrusionTranslationProduct,
/// The first offset of the chamfer.
FirstOffset,
/// The foot of a drop on the other support.
FootOnOtherSupport,
/// An endpoint of the line.
LineEndpoint,
/// The other offset of the chamfer.
OtherOffset,
/// The support on the other side of the blended edge.
OtherSupport,
/// The planar support.
PlanarSupport,
/// The selected edge.
SelectedEdge,
/// The face the two bands share.
SharedFace,
}

impl BandInput {
/// What is missing, as a phrase ("the shared face").
#[must_use]
pub const fn what(self) -> &'static str {
match self {
Self::BlendedEdge => "the blended edge",
Self::BlendedEdgeCurve => "the blended edge's curve",
Self::BlendedEdgeEndpoint => "the blended edge's endpoint",
Self::ChamferSetback => "the chamfer setback",
Self::ClosestBandFeet => "the closest band feet",
Self::EdgeUse => "the edge use",
Self::ExtrusionControlPoint => "the extrusion control point",
Self::ExtrusionTranslationProduct => "the exact extrusion translation product",
Self::FirstOffset => "the first offset",
Self::FootOnOtherSupport => "the foot on the other support",
Self::LineEndpoint => "the line endpoint",
Self::OtherOffset => "the other offset",
Self::OtherSupport => "the other support",
Self::PlanarSupport => "the planar support",
Self::SelectedEdge => "the selected edge",
Self::SharedFace => "the shared face",
}
}
}
26 changes: 26 additions & 0 deletions solidcore/crates/solidcore/src/error/blend/cliff.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! The inputs of a blend's trim at a cliff a blend failure names missing.
//!
//! Upstream: none. One of the modules of the blend failure causes, re-exported from
//! [`super`].

/// A face input required to trim a blend at a cliff.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum CliffInput {
/// The face use facing out of the body.
OutwardFaceUse,
/// The planar support extending the wall.
Plane,
/// The face's surface.
Surface,
}

impl CliffInput {
pub(super) const fn what(self) -> &'static str {
match self {
Self::OutwardFaceUse => "outward face use",
Self::Plane => "plane",
Self::Surface => "surface",
}
}
}
409 changes: 409 additions & 0 deletions solidcore/crates/solidcore/src/error/blend/corner.rs

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions solidcore/crates/solidcore/src/error/blend/crease_trim.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//! Why a blend trimmed at its creases is not built.
//!
//! Upstream: none. One of the modules of the blend failure causes, re-exported from
//! [`super`].

#[cfg(doc)]
use super::BlendFailure;
use crate::error::ErrorKind;

/// Why a blend trimmed at its creases is not built ([`BlendFailure::CreaseTrimNotBuilt`]),
/// each with its kind ([`CreaseTrimStop::class`]).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum CreaseTrimStop {
/// A corner's face between blends that add and blends that take off material, past their
/// faces or at an open setback ([`ErrorKind::Unsupported`]; noted `CornerUnsupported`).
CornerBetweenAddingAndTaking,
/// A body edge moved onto a crease leaves geometry the trim does not take off
/// ([`ErrorKind::Failed`]; noted `BadMerge`).
MovedEdgeLeavesGeometry,
/// The filleted edge has no tangent at an open end's vertex, so no section through the
/// vertex ends the round there ([`ErrorKind::Degenerate`]).
NoSectionThroughEndVertex,
/// The trimmed sheet does not sew into the body as a manifold solid
/// ([`ErrorKind::Failed`]; noted `BadMerge`).
NotSewn,
/// A piece of a blend past its faces lies on the body's boundary away from its creases
/// ([`ErrorKind::Unsupported`]; noted `BadMerge`).
PieceOnBoundaryAwayFromCreases,
/// The creases and rails enclose no part of the body: the trim reaches every face
/// ([`ErrorKind::NotFound`]; noted `BadMerge`).
ReachesEveryFace,
/// A round's section end lies along an edge of the body its rail does not cut
/// ([`ErrorKind::Unsupported`]; noted `BadMerge`).
SectionEndAlongUncutEdge,
/// The trim takes off nothing round the blended edges ([`ErrorKind::NotFound`]; noted
/// `BadMerge`).
TakesOffNothing,
}

impl CreaseTrimStop {
/// The kind of the failure.
#[must_use]
#[allow(
clippy::match_same_arms,
reason = "one arm per variant, sorted by name, so causes added in parallel touch disjoint lines"
)]
pub const fn class(self) -> ErrorKind {
match self {
Self::CornerBetweenAddingAndTaking => ErrorKind::Unsupported,
Self::MovedEdgeLeavesGeometry => ErrorKind::Failed,
Self::NoSectionThroughEndVertex => ErrorKind::Degenerate,
Self::NotSewn => ErrorKind::Failed,
Self::PieceOnBoundaryAwayFromCreases => ErrorKind::Unsupported,
Self::ReachesEveryFace => ErrorKind::NotFound,
Self::SectionEndAlongUncutEdge => ErrorKind::Unsupported,
Self::TakesOffNothing => ErrorKind::NotFound,
}
}

pub(super) const fn what(self) -> &'static str {
match self {
Self::CornerBetweenAddingAndTaking => {
"a corner's face between blends that add and blends that take off material is \
not built"
}
Self::MovedEdgeLeavesGeometry => {
"a body edge moved onto a blend's crease leaves geometry the trim does not take off"
}
Self::NoSectionThroughEndVertex => {
"the filleted edge has no tangent at an open end's vertex, so no section ends \
the round there"
}
Self::NotSewn => {
"a blend past its faces does not sew into the body along its creases and rails"
}
Self::PieceOnBoundaryAwayFromCreases => {
"a blend past its faces lies on the body's boundary away from its creases"
}
Self::ReachesEveryFace => {
"a blend past its faces reaches every face of the body (its creases and rails \
enclose no part of it)"
}
Self::SectionEndAlongUncutEdge => {
"a round's section end lies along an edge of the body that its rail does not cut"
}
Self::TakesOffNothing => "a blend past its faces takes off nothing round its edges",
}
}
}
34 changes: 34 additions & 0 deletions solidcore/crates/solidcore/src/error/blend/crossing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! The inputs of a rail crossing's judgement a blend failure names missing.
//!
//! Upstream: none. One of the modules of the blend failure causes, re-exported from
//! [`super`].

#[cfg(doc)]
use super::BlendFailure;

/// Which input of a rail crossing's judgement is missing ([`BlendFailure::CrossingInputMissing`]).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum CrossingInput {
/// The place on the side edge where the rail crosses it.
CrossingOnSideEdge,
/// The radial edge use of the edge use that bounds material.
MaterialEdgeUseRadial,
/// The tangency budget of the round a sheet face belongs to.
SheetFaceTangencyBudget,
/// The curve of the side edge a rail crosses.
SideEdgeCurve,
}

impl CrossingInput {
/// What is missing, as a phrase ("the side edge's curve").
#[must_use]
pub const fn what(self) -> &'static str {
match self {
Self::CrossingOnSideEdge => "the rollover event on the side edge",
Self::MaterialEdgeUseRadial => "the material edge use's radial",
Self::SheetFaceTangencyBudget => "the sheet face's tangency budget",
Self::SideEdgeCurve => "the side edge's curve",
}
}
}
Loading
Loading