use cadmpeg_ir::report::{LossKind, LossNote, LossTaxonomy, Severity};
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum StepLossCode {
ParseNoncanonicalSyntax,
DecodeWarning,
ByteAccountingUnclassified,
OpaqueRecordPreserved,
MetadataStringInvalid,
AttributeStringInvalid,
PlacementReferenceInferred,
ConflictingRepresentationUnits,
UncertaintyLengthAmbiguous,
UncertaintyLengthUnresolved,
DocumentLengthUnitUnresolved,
DocumentAngleUnitUnresolved,
LineParameterScaleUnresolved,
TopologyRootRejected,
TopologyRootIncomplete,
OrientedShellOmitsCfsFaces,
SeamEdgePcurveUnresolved,
EdgeNoSurfaceOrCurveForPcurve,
PcurveEndpointsDiscontinuous,
PcurveAssociationAmbiguous,
PcurveCandidatesCarrierUnresolved,
FaceMultipleOuterBounds,
ShellDisconnectedFaces,
NauoPlacementUnresolved,
BodyConflictingMappedPlacements,
PresentationAnnotationTextUnordered,
DimensionalNominalAmbiguous,
DimensionalUnnamedMeasureAmbiguous,
PmiLengthUnitUnresolved,
PmiAngleUnitUnresolved,
ConflictingScalarColors,
DrawingRecordTooFewParameters,
DrawingRelationshipUntypedTarget,
DrawingSheetRevisionUnresolved,
DrawingRevisionSheetUnresolved,
DraughtingSemanticDefinitionUntyped,
DraughtingAssociatedItemUntyped,
TessellationItemBodyUnresolved,
TessellationItemUndeclared,
ValidationMeasureUnitUnresolved,
NoExportableSolids,
LayerItemWithoutCarrier,
AssemblyGraphInvalid,
RootOccurrencePlacementNotRepresentable,
OccurrenceUnresolvedParent,
OccurrenceNoLocalProduct,
OccurrencePlacementNotRigid,
BodyNonRigidTransform,
HiddenBodyVisibilityUnsupported,
WireShellFreeVertices,
TessellationRequiresAp242,
TessellationFeatureEdges,
TessellationCornerNormals,
TessellationTriangleGroups,
TessellationTextureAssignments,
TessellationInvalidCardinality,
TessellationBodyLinkUnwritable,
TessellationMetadataReduced,
TopologyUnreachableFromRegion,
AnalyticSurfaceNormalized,
EllipticalConeReduced,
CurvelessEdgeOmitted,
UnknownSurfaceFaceOmitted,
GeometryCarrierNotWritten,
PcurveCarrierUnwritable,
AssemblyOccurrenceOmittedNoParentProduct,
RegionNoShellList,
WireRegionNoConnectedEdgeSet,
WireRegionMissingShell,
HiddenBodyOmitted,
AppearanceBindingMissingAsset,
AppearanceBindingNoBaseColor,
CoedgePcurveNoGeometry,
CoedgePcurveNativeMetadata,
PcurveUseNativeMetadata,
CoedgeUseCurveNotRepresented,
TopologyMetadataNotRepresented,
SubdOmitted,
ParametricDesignRecordsOmitted,
DrawingPresentationRecordsOmitted,
SemanticAnnotationOmitted,
DocumentAssetOmitted,
AssemblyJointOmitted,
ProductNonPartKind,
ProductBomPropertyOmitted,
OccurrenceExternalProduct,
OccurrenceNoWritableProduct,
OccurrenceMetadataOmitted,
PmiAnnotationNotWritten,
SourceAssociationOmitted,
PassthroughRecordOmitted,
DisplayColorUnstyled,
AppearanceReducedToBaseColor,
AppearanceBindingMetadataReduced,
SourceAttributeNotWritten,
ProceduralReducedToCarrier,
SourceNativeRecordOmitted,
RegionNoWritableOuterShell,
RegionOmittedVoidShell,
ShellOmittedOuterFace,
ShellOmittedInnerFace,
FaceOmittedOuterLoop,
FaceOmittedInnerLoop,
FaceNoWritableBounds,
LoopRecordMissing,
LoopVertexMissing,
LoopCoedgeRecordMissing,
LoopEdgeNotWritable,
LoopNoWritableEdges,
LoopDuplicateCoedge,
LoopCoedgeMissingForOrder,
LoopEdgeMissingForOrder,
EdgeNo3dCurve,
EdgeCurveNotWritable,
EdgeCurveUnsupported,
LoopNoContinuousOrdering,
EdgeRecordMissing,
EdgeStartVertexMissing,
EdgeEndVertexMissing,
}
impl StepLossCode {
#[cfg(test)]
pub const ALL: &'static [StepLossCode] = &[
Self::ParseNoncanonicalSyntax,
Self::DecodeWarning,
Self::ByteAccountingUnclassified,
Self::OpaqueRecordPreserved,
Self::MetadataStringInvalid,
Self::AttributeStringInvalid,
Self::PlacementReferenceInferred,
Self::ConflictingRepresentationUnits,
Self::UncertaintyLengthAmbiguous,
Self::UncertaintyLengthUnresolved,
Self::DocumentLengthUnitUnresolved,
Self::DocumentAngleUnitUnresolved,
Self::LineParameterScaleUnresolved,
Self::TopologyRootRejected,
Self::TopologyRootIncomplete,
Self::OrientedShellOmitsCfsFaces,
Self::SeamEdgePcurveUnresolved,
Self::EdgeNoSurfaceOrCurveForPcurve,
Self::PcurveEndpointsDiscontinuous,
Self::PcurveAssociationAmbiguous,
Self::PcurveCandidatesCarrierUnresolved,
Self::FaceMultipleOuterBounds,
Self::ShellDisconnectedFaces,
Self::NauoPlacementUnresolved,
Self::BodyConflictingMappedPlacements,
Self::PresentationAnnotationTextUnordered,
Self::DimensionalNominalAmbiguous,
Self::DimensionalUnnamedMeasureAmbiguous,
Self::PmiLengthUnitUnresolved,
Self::PmiAngleUnitUnresolved,
Self::ConflictingScalarColors,
Self::DrawingRecordTooFewParameters,
Self::DrawingRelationshipUntypedTarget,
Self::DrawingSheetRevisionUnresolved,
Self::DrawingRevisionSheetUnresolved,
Self::DraughtingSemanticDefinitionUntyped,
Self::DraughtingAssociatedItemUntyped,
Self::TessellationItemBodyUnresolved,
Self::TessellationItemUndeclared,
Self::ValidationMeasureUnitUnresolved,
Self::NoExportableSolids,
Self::LayerItemWithoutCarrier,
Self::AssemblyGraphInvalid,
Self::RootOccurrencePlacementNotRepresentable,
Self::OccurrenceUnresolvedParent,
Self::OccurrenceNoLocalProduct,
Self::OccurrencePlacementNotRigid,
Self::BodyNonRigidTransform,
Self::HiddenBodyVisibilityUnsupported,
Self::WireShellFreeVertices,
Self::TessellationRequiresAp242,
Self::TessellationFeatureEdges,
Self::TessellationCornerNormals,
Self::TessellationTriangleGroups,
Self::TessellationTextureAssignments,
Self::TessellationInvalidCardinality,
Self::TessellationBodyLinkUnwritable,
Self::TessellationMetadataReduced,
Self::TopologyUnreachableFromRegion,
Self::AnalyticSurfaceNormalized,
Self::EllipticalConeReduced,
Self::CurvelessEdgeOmitted,
Self::UnknownSurfaceFaceOmitted,
Self::GeometryCarrierNotWritten,
Self::PcurveCarrierUnwritable,
Self::AssemblyOccurrenceOmittedNoParentProduct,
Self::RegionNoShellList,
Self::WireRegionNoConnectedEdgeSet,
Self::WireRegionMissingShell,
Self::HiddenBodyOmitted,
Self::AppearanceBindingMissingAsset,
Self::AppearanceBindingNoBaseColor,
Self::CoedgePcurveNoGeometry,
Self::CoedgePcurveNativeMetadata,
Self::PcurveUseNativeMetadata,
Self::CoedgeUseCurveNotRepresented,
Self::TopologyMetadataNotRepresented,
Self::SubdOmitted,
Self::ParametricDesignRecordsOmitted,
Self::DrawingPresentationRecordsOmitted,
Self::SemanticAnnotationOmitted,
Self::DocumentAssetOmitted,
Self::AssemblyJointOmitted,
Self::ProductNonPartKind,
Self::ProductBomPropertyOmitted,
Self::OccurrenceExternalProduct,
Self::OccurrenceNoWritableProduct,
Self::OccurrenceMetadataOmitted,
Self::PmiAnnotationNotWritten,
Self::SourceAssociationOmitted,
Self::PassthroughRecordOmitted,
Self::DisplayColorUnstyled,
Self::AppearanceReducedToBaseColor,
Self::AppearanceBindingMetadataReduced,
Self::SourceAttributeNotWritten,
Self::ProceduralReducedToCarrier,
Self::SourceNativeRecordOmitted,
Self::RegionNoWritableOuterShell,
Self::RegionOmittedVoidShell,
Self::ShellOmittedOuterFace,
Self::ShellOmittedInnerFace,
Self::FaceOmittedOuterLoop,
Self::FaceOmittedInnerLoop,
Self::FaceNoWritableBounds,
Self::LoopRecordMissing,
Self::LoopVertexMissing,
Self::LoopCoedgeRecordMissing,
Self::LoopEdgeNotWritable,
Self::LoopNoWritableEdges,
Self::LoopDuplicateCoedge,
Self::LoopCoedgeMissingForOrder,
Self::LoopEdgeMissingForOrder,
Self::EdgeNo3dCurve,
Self::EdgeCurveNotWritable,
Self::EdgeCurveUnsupported,
Self::LoopNoContinuousOrdering,
Self::EdgeRecordMissing,
Self::EdgeStartVertexMissing,
Self::EdgeEndVertexMissing,
];
#[must_use]
pub const fn code(self) -> &'static str {
match self {
Self::ParseNoncanonicalSyntax => "parse.noncanonical-syntax",
Self::DecodeWarning => "decode.warning",
Self::ByteAccountingUnclassified => "decode.byte-accounting-unclassified",
Self::OpaqueRecordPreserved => "decode.opaque-record-preserved",
Self::MetadataStringInvalid => "metadata.string-invalid",
Self::AttributeStringInvalid => "attribute.string-invalid",
Self::PlacementReferenceInferred => "geometry.placement-reference-inferred",
Self::ConflictingRepresentationUnits => "geometry.conflicting-representation-units",
Self::UncertaintyLengthAmbiguous => "geometry.uncertainty-length-ambiguous",
Self::UncertaintyLengthUnresolved => "geometry.uncertainty-length-unresolved",
Self::DocumentLengthUnitUnresolved => "geometry.document-length-unit-unresolved",
Self::DocumentAngleUnitUnresolved => "geometry.document-angle-unit-unresolved",
Self::LineParameterScaleUnresolved => "geometry.line-parameter-scale-unresolved",
Self::TopologyRootRejected => "topology.root-rejected",
Self::TopologyRootIncomplete => "topology.root-incomplete",
Self::OrientedShellOmitsCfsFaces => "topology.oriented-shell-omits-cfs-faces",
Self::SeamEdgePcurveUnresolved => "topology.seam-edge-pcurve-unresolved",
Self::EdgeNoSurfaceOrCurveForPcurve => "topology.edge-no-surface-or-curve-for-pcurve",
Self::PcurveEndpointsDiscontinuous => "topology.pcurve-endpoints-discontinuous",
Self::PcurveAssociationAmbiguous => "topology.pcurve-association-ambiguous",
Self::PcurveCandidatesCarrierUnresolved => {
"topology.pcurve-candidates-carrier-unresolved"
}
Self::FaceMultipleOuterBounds => "topology.face-multiple-outer-bounds",
Self::ShellDisconnectedFaces => "topology.shell-disconnected-faces",
Self::NauoPlacementUnresolved => "product.nauo-placement-unresolved",
Self::BodyConflictingMappedPlacements => "product.body-conflicting-mapped-placements",
Self::PresentationAnnotationTextUnordered => {
"pmi.presentation-annotation-text-unordered"
}
Self::DimensionalNominalAmbiguous => "pmi.dimensional-nominal-ambiguous",
Self::DimensionalUnnamedMeasureAmbiguous => "pmi.dimensional-unnamed-measure-ambiguous",
Self::PmiLengthUnitUnresolved => "pmi.length-unit-unresolved",
Self::PmiAngleUnitUnresolved => "pmi.angle-unit-unresolved",
Self::ConflictingScalarColors => "presentation.conflicting-scalar-colors",
Self::DrawingRecordTooFewParameters => "drawing.record-too-few-parameters",
Self::DrawingRelationshipUntypedTarget => "drawing.relationship-untyped-target",
Self::DrawingSheetRevisionUnresolved => "drawing.sheet-revision-unresolved",
Self::DrawingRevisionSheetUnresolved => "drawing.revision-sheet-unresolved",
Self::DraughtingSemanticDefinitionUntyped => {
"drawing.draughting-semantic-definition-untyped"
}
Self::DraughtingAssociatedItemUntyped => "drawing.draughting-associated-item-untyped",
Self::TessellationItemBodyUnresolved => "tessellation.item-body-unresolved",
Self::TessellationItemUndeclared => "tessellation.item-undeclared",
Self::ValidationMeasureUnitUnresolved => "validation.measure-unit-unresolved",
Self::NoExportableSolids => "export.no-exportable-solids",
Self::LayerItemWithoutCarrier => "layer.item-without-carrier",
Self::AssemblyGraphInvalid => "assembly.graph-invalid",
Self::RootOccurrencePlacementNotRepresentable => {
"occurrence.root-placement-not-representable"
}
Self::OccurrenceUnresolvedParent => "occurrence.unresolved-parent",
Self::OccurrenceNoLocalProduct => "occurrence.no-local-product",
Self::OccurrencePlacementNotRigid => "occurrence.placement-not-rigid",
Self::BodyNonRigidTransform => "body.non-rigid-transform",
Self::HiddenBodyVisibilityUnsupported => "body.hidden-visibility-unsupported",
Self::WireShellFreeVertices => "topology.wire-shell-free-vertices",
Self::TessellationRequiresAp242 => "tessellation.requires-ap242",
Self::TessellationFeatureEdges => "tessellation.feature-edges",
Self::TessellationCornerNormals => "tessellation.corner-normals",
Self::TessellationTriangleGroups => "tessellation.triangle-groups",
Self::TessellationTextureAssignments => "tessellation.texture-assignments",
Self::TessellationInvalidCardinality => "tessellation.invalid-cardinality",
Self::TessellationBodyLinkUnwritable => "tessellation.body-link-unwritable",
Self::TessellationMetadataReduced => "tessellation.metadata-reduced",
Self::TopologyUnreachableFromRegion => "topology.unreachable-from-region",
Self::AnalyticSurfaceNormalized => "geometry.analytic-surface-normalized",
Self::EllipticalConeReduced => "geometry.elliptical-cone-reduced",
Self::CurvelessEdgeOmitted => "geometry.curveless-edge-omitted",
Self::UnknownSurfaceFaceOmitted => "geometry.unknown-surface-face-omitted",
Self::GeometryCarrierNotWritten => "geometry.carrier-not-written",
Self::PcurveCarrierUnwritable => "pcurve.carrier-unwritable",
Self::AssemblyOccurrenceOmittedNoParentProduct => {
"assembly.occurrence-omitted-no-parent-product"
}
Self::RegionNoShellList => "topology.region-no-shell-list",
Self::WireRegionNoConnectedEdgeSet => "topology.wire-region-no-connected-edge-set",
Self::WireRegionMissingShell => "topology.wire-region-missing-shell",
Self::HiddenBodyOmitted => "body.hidden-omitted",
Self::AppearanceBindingMissingAsset => "appearance.binding-missing-asset",
Self::AppearanceBindingNoBaseColor => "appearance.binding-no-base-color",
Self::CoedgePcurveNoGeometry => "pcurve.coedge-no-geometry",
Self::CoedgePcurveNativeMetadata => "pcurve.coedge-native-metadata",
Self::PcurveUseNativeMetadata => "pcurve.use-native-metadata",
Self::CoedgeUseCurveNotRepresented => "topology.coedge-use-curve-not-represented",
Self::TopologyMetadataNotRepresented => "topology.metadata-not-represented",
Self::SubdOmitted => "geometry.subd-omitted",
Self::ParametricDesignRecordsOmitted => "design.parametric-records-omitted",
Self::DrawingPresentationRecordsOmitted => "presentation.drawing-records-omitted",
Self::SemanticAnnotationOmitted => "pmi.semantic-annotation-omitted",
Self::DocumentAssetOmitted => "asset.document-omitted",
Self::AssemblyJointOmitted => "assembly.joint-omitted",
Self::ProductNonPartKind => "product.non-part-kind",
Self::ProductBomPropertyOmitted => "product.bom-property-omitted",
Self::OccurrenceExternalProduct => "occurrence.external-product",
Self::OccurrenceNoWritableProduct => "occurrence.no-writable-product",
Self::OccurrenceMetadataOmitted => "occurrence.metadata-omitted",
Self::PmiAnnotationNotWritten => "pmi.annotation-not-written",
Self::SourceAssociationOmitted => "source.association-omitted",
Self::PassthroughRecordOmitted => "native.passthrough-record-omitted",
Self::DisplayColorUnstyled => "appearance.display-color-unstyled",
Self::AppearanceReducedToBaseColor => "appearance.reduced-to-base-color",
Self::AppearanceBindingMetadataReduced => "appearance.binding-metadata-reduced",
Self::SourceAttributeNotWritten => "attribute.source-record-not-written",
Self::ProceduralReducedToCarrier => "geometry.procedural-reduced-to-carrier",
Self::SourceNativeRecordOmitted => "native.source-record-omitted",
Self::RegionNoWritableOuterShell => "topology.region-no-writable-outer-shell",
Self::RegionOmittedVoidShell => "topology.region-omitted-void-shell",
Self::ShellOmittedOuterFace => "topology.shell-omitted-outer-face",
Self::ShellOmittedInnerFace => "topology.shell-omitted-inner-face",
Self::FaceOmittedOuterLoop => "topology.face-omitted-outer-loop",
Self::FaceOmittedInnerLoop => "topology.face-omitted-inner-loop",
Self::FaceNoWritableBounds => "topology.face-no-writable-bounds",
Self::LoopRecordMissing => "topology.loop-record-missing",
Self::LoopVertexMissing => "topology.loop-vertex-missing",
Self::LoopCoedgeRecordMissing => "topology.loop-coedge-record-missing",
Self::LoopEdgeNotWritable => "topology.loop-edge-not-writable",
Self::LoopNoWritableEdges => "topology.loop-no-writable-edges",
Self::LoopDuplicateCoedge => "topology.loop-duplicate-coedge",
Self::LoopCoedgeMissingForOrder => "topology.loop-coedge-missing-for-order",
Self::LoopEdgeMissingForOrder => "topology.loop-edge-missing-for-order",
Self::EdgeNo3dCurve => "topology.edge-no-3d-curve",
Self::EdgeCurveNotWritable => "topology.edge-curve-not-writable",
Self::EdgeCurveUnsupported => "topology.edge-curve-unsupported",
Self::LoopNoContinuousOrdering => "topology.loop-no-continuous-ordering",
Self::EdgeRecordMissing => "topology.edge-record-missing",
Self::EdgeStartVertexMissing => "topology.edge-start-vertex-missing",
Self::EdgeEndVertexMissing => "topology.edge-end-vertex-missing",
}
}
#[must_use]
pub const fn severity(self) -> Severity {
match self {
Self::ByteAccountingUnclassified
| Self::DocumentLengthUnitUnresolved
| Self::DocumentAngleUnitUnresolved
| Self::LineParameterScaleUnresolved
| Self::TopologyRootRejected
| Self::TopologyRootIncomplete
| Self::PcurveEndpointsDiscontinuous
| Self::NauoPlacementUnresolved
| Self::BodyConflictingMappedPlacements
| Self::PmiLengthUnitUnresolved
| Self::PmiAngleUnitUnresolved
| Self::ValidationMeasureUnitUnresolved
| Self::RegionNoShellList
| Self::RegionNoWritableOuterShell
| Self::RegionOmittedVoidShell
| Self::ShellOmittedOuterFace
| Self::FaceOmittedOuterLoop
| Self::FaceNoWritableBounds
| Self::LoopCoedgeRecordMissing
| Self::LoopEdgeNotWritable
| Self::LoopDuplicateCoedge
| Self::LoopCoedgeMissingForOrder
| Self::LoopEdgeMissingForOrder
| Self::LoopNoContinuousOrdering => Severity::Error,
Self::TessellationMetadataReduced
| Self::CoedgePcurveNativeMetadata
| Self::PcurveUseNativeMetadata
| Self::CoedgeUseCurveNotRepresented
| Self::TopologyMetadataNotRepresented
| Self::ParametricDesignRecordsOmitted
| Self::DrawingPresentationRecordsOmitted
| Self::DocumentAssetOmitted
| Self::AssemblyJointOmitted
| Self::ProductNonPartKind
| Self::ProductBomPropertyOmitted
| Self::OccurrenceMetadataOmitted
| Self::SourceAssociationOmitted
| Self::PassthroughRecordOmitted
| Self::DisplayColorUnstyled
| Self::AppearanceReducedToBaseColor
| Self::AppearanceBindingMetadataReduced
| Self::SourceAttributeNotWritten
| Self::ProceduralReducedToCarrier
| Self::SourceNativeRecordOmitted => Severity::Info,
_ => Severity::Warning,
}
}
const fn shared_taxonomy(self) -> LossTaxonomy {
match self {
Self::ParseNoncanonicalSyntax | Self::OrientedShellOmitsCfsFaces => {
LossTaxonomy::NoncanonicalSourceSyntax
}
Self::DecodeWarning | Self::ByteAccountingUnclassified => {
LossTaxonomy::DecodeDiagnostic
}
Self::OpaqueRecordPreserved | Self::DrawingRecordTooFewParameters => {
LossTaxonomy::RecordNotTyped
}
Self::MetadataStringInvalid
| Self::PresentationAnnotationTextUnordered
| Self::DimensionalNominalAmbiguous
| Self::DimensionalUnnamedMeasureAmbiguous
| Self::ConflictingScalarColors
| Self::DrawingRelationshipUntypedTarget
| Self::DraughtingSemanticDefinitionUntyped
| Self::DraughtingAssociatedItemUntyped
| Self::ProductNonPartKind
| Self::ProductBomPropertyOmitted
| Self::OccurrenceNoWritableProduct
| Self::OccurrenceMetadataOmitted => LossTaxonomy::MetadataNotTransferred,
Self::AttributeStringInvalid
| Self::LayerItemWithoutCarrier
| Self::HiddenBodyVisibilityUnsupported
| Self::TessellationFeatureEdges
| Self::TessellationCornerNormals
| Self::TessellationTriangleGroups
| Self::TessellationTextureAssignments
| Self::TessellationMetadataReduced
| Self::CoedgeUseCurveNotRepresented
| Self::TopologyMetadataNotRepresented
| Self::DrawingPresentationRecordsOmitted
| Self::DisplayColorUnstyled
| Self::SourceAttributeNotWritten => LossTaxonomy::AttributesNotTransferred,
Self::PlacementReferenceInferred => LossTaxonomy::CarrierAxisInferred,
Self::ConflictingRepresentationUnits
| Self::UncertaintyLengthAmbiguous
| Self::UncertaintyLengthUnresolved
| Self::DocumentLengthUnitUnresolved
| Self::DocumentAngleUnitUnresolved
| Self::LineParameterScaleUnresolved
| Self::PmiLengthUnitUnresolved
| Self::PmiAngleUnitUnresolved
| Self::ValidationMeasureUnitUnresolved
| Self::GeometryCarrierNotWritten => LossTaxonomy::GeometryNotTransferred,
Self::TopologyRootRejected
| Self::TopologyRootIncomplete
| Self::AssemblyGraphInvalid
| Self::OccurrenceUnresolvedParent
| Self::OccurrenceNoLocalProduct
| Self::WireShellFreeVertices
| Self::TessellationBodyLinkUnwritable
| Self::TopologyUnreachableFromRegion
| Self::RegionNoShellList
| Self::WireRegionNoConnectedEdgeSet
| Self::WireRegionMissingShell
| Self::RegionNoWritableOuterShell
| Self::RegionOmittedVoidShell
| Self::ShellOmittedOuterFace
| Self::ShellOmittedInnerFace
| Self::FaceOmittedOuterLoop
| Self::FaceOmittedInnerLoop
| Self::FaceNoWritableBounds
| Self::LoopRecordMissing
| Self::LoopVertexMissing
| Self::LoopCoedgeRecordMissing
| Self::LoopEdgeNotWritable
| Self::LoopNoWritableEdges
| Self::LoopDuplicateCoedge
| Self::LoopCoedgeMissingForOrder
| Self::LoopEdgeMissingForOrder
| Self::EdgeNo3dCurve
| Self::EdgeCurveNotWritable
| Self::EdgeCurveUnsupported
| Self::LoopNoContinuousOrdering
| Self::EdgeRecordMissing
| Self::EdgeStartVertexMissing
| Self::EdgeEndVertexMissing => LossTaxonomy::TopologyNotTransferred,
Self::SeamEdgePcurveUnresolved
| Self::EdgeNoSurfaceOrCurveForPcurve
| Self::PcurveAssociationAmbiguous
| Self::PcurveCandidatesCarrierUnresolved
| Self::DrawingSheetRevisionUnresolved
| Self::DrawingRevisionSheetUnresolved
| Self::TessellationItemBodyUnresolved
| Self::TessellationItemUndeclared => LossTaxonomy::ReferenceGraphNotClosed,
Self::PcurveEndpointsDiscontinuous
| Self::PcurveCarrierUnwritable
| Self::CoedgePcurveNoGeometry
| Self::CoedgePcurveNativeMetadata
| Self::PcurveUseNativeMetadata => LossTaxonomy::PcurveOmitted,
Self::FaceMultipleOuterBounds | Self::ShellDisconnectedFaces => {
LossTaxonomy::SourceTopologyInvalid
}
Self::NauoPlacementUnresolved
| Self::BodyConflictingMappedPlacements
| Self::AssemblyOccurrenceOmittedNoParentProduct
| Self::AssemblyJointOmitted => LossTaxonomy::AssemblyPlacementsNotTransferred,
Self::NoExportableSolids => LossTaxonomy::NoExportableSolids,
Self::RootOccurrencePlacementNotRepresentable
| Self::OccurrencePlacementNotRigid
| Self::BodyNonRigidTransform => LossTaxonomy::BodyTransformNotApplied,
Self::TessellationRequiresAp242 | Self::TessellationInvalidCardinality => {
LossTaxonomy::TessellationOmitted
}
Self::AnalyticSurfaceNormalized => LossTaxonomy::AnalyticSurfaceNormalized,
Self::EllipticalConeReduced => LossTaxonomy::EllipticalConeReduced,
Self::CurvelessEdgeOmitted => LossTaxonomy::CurvelessEdgeOmitted,
Self::UnknownSurfaceFaceOmitted => LossTaxonomy::UnknownSurfaceFaceOmitted,
Self::HiddenBodyOmitted => LossTaxonomy::HiddenBodyOmitted,
Self::AppearanceBindingMissingAsset | Self::AppearanceBindingNoBaseColor => {
LossTaxonomy::MaterialNotTransferred
}
Self::SubdOmitted => LossTaxonomy::SubdOmitted,
Self::ParametricDesignRecordsOmitted | Self::SourceNativeRecordOmitted => {
LossTaxonomy::ParametricRecordOmitted
}
Self::SemanticAnnotationOmitted | Self::PmiAnnotationNotWritten => {
LossTaxonomy::PmiOmitted
}
Self::DocumentAssetOmitted => LossTaxonomy::AssetNotTransferred,
Self::OccurrenceExternalProduct => LossTaxonomy::AssemblyComponentsExternal,
Self::SourceAssociationOmitted => LossTaxonomy::SourceAssociationOmitted,
Self::PassthroughRecordOmitted => LossTaxonomy::PassthroughRecordOmitted,
Self::AppearanceReducedToBaseColor | Self::AppearanceBindingMetadataReduced => {
LossTaxonomy::AppearanceReduced
}
Self::ProceduralReducedToCarrier => LossTaxonomy::ProceduralReduced,
}
}
const fn strict_floor(self) -> Option<Severity> {
self.shared_taxonomy().strict_floor()
}
#[must_use]
pub fn kind(self) -> LossKind {
LossKind::namespaced("step", self.code(), self.shared_taxonomy())
.with_strict_floor(self.strict_floor())
}
#[must_use]
pub fn note(self, message: impl Into<String>) -> LossNote {
LossNote::new(self.kind(), message).with_severity(self.severity())
}
}
#[cfg(test)]
mod tests {
use super::StepLossCode;
use std::collections::BTreeSet;
#[test]
fn code_strings_are_pinned() {
let codes: Vec<&str> = StepLossCode::ALL.iter().map(|c| c.code()).collect();
assert_eq!(
codes,
[
"parse.noncanonical-syntax",
"decode.warning",
"decode.byte-accounting-unclassified",
"decode.opaque-record-preserved",
"metadata.string-invalid",
"attribute.string-invalid",
"geometry.placement-reference-inferred",
"geometry.conflicting-representation-units",
"geometry.uncertainty-length-ambiguous",
"geometry.uncertainty-length-unresolved",
"geometry.document-length-unit-unresolved",
"geometry.document-angle-unit-unresolved",
"geometry.line-parameter-scale-unresolved",
"topology.root-rejected",
"topology.root-incomplete",
"topology.oriented-shell-omits-cfs-faces",
"topology.seam-edge-pcurve-unresolved",
"topology.edge-no-surface-or-curve-for-pcurve",
"topology.pcurve-endpoints-discontinuous",
"topology.pcurve-association-ambiguous",
"topology.pcurve-candidates-carrier-unresolved",
"topology.face-multiple-outer-bounds",
"topology.shell-disconnected-faces",
"product.nauo-placement-unresolved",
"product.body-conflicting-mapped-placements",
"pmi.presentation-annotation-text-unordered",
"pmi.dimensional-nominal-ambiguous",
"pmi.dimensional-unnamed-measure-ambiguous",
"pmi.length-unit-unresolved",
"pmi.angle-unit-unresolved",
"presentation.conflicting-scalar-colors",
"drawing.record-too-few-parameters",
"drawing.relationship-untyped-target",
"drawing.sheet-revision-unresolved",
"drawing.revision-sheet-unresolved",
"drawing.draughting-semantic-definition-untyped",
"drawing.draughting-associated-item-untyped",
"tessellation.item-body-unresolved",
"tessellation.item-undeclared",
"validation.measure-unit-unresolved",
"export.no-exportable-solids",
"layer.item-without-carrier",
"assembly.graph-invalid",
"occurrence.root-placement-not-representable",
"occurrence.unresolved-parent",
"occurrence.no-local-product",
"occurrence.placement-not-rigid",
"body.non-rigid-transform",
"body.hidden-visibility-unsupported",
"topology.wire-shell-free-vertices",
"tessellation.requires-ap242",
"tessellation.feature-edges",
"tessellation.corner-normals",
"tessellation.triangle-groups",
"tessellation.texture-assignments",
"tessellation.invalid-cardinality",
"tessellation.body-link-unwritable",
"tessellation.metadata-reduced",
"topology.unreachable-from-region",
"geometry.analytic-surface-normalized",
"geometry.elliptical-cone-reduced",
"geometry.curveless-edge-omitted",
"geometry.unknown-surface-face-omitted",
"geometry.carrier-not-written",
"pcurve.carrier-unwritable",
"assembly.occurrence-omitted-no-parent-product",
"topology.region-no-shell-list",
"topology.wire-region-no-connected-edge-set",
"topology.wire-region-missing-shell",
"body.hidden-omitted",
"appearance.binding-missing-asset",
"appearance.binding-no-base-color",
"pcurve.coedge-no-geometry",
"pcurve.coedge-native-metadata",
"pcurve.use-native-metadata",
"topology.coedge-use-curve-not-represented",
"topology.metadata-not-represented",
"geometry.subd-omitted",
"design.parametric-records-omitted",
"presentation.drawing-records-omitted",
"pmi.semantic-annotation-omitted",
"asset.document-omitted",
"assembly.joint-omitted",
"product.non-part-kind",
"product.bom-property-omitted",
"occurrence.external-product",
"occurrence.no-writable-product",
"occurrence.metadata-omitted",
"pmi.annotation-not-written",
"source.association-omitted",
"native.passthrough-record-omitted",
"appearance.display-color-unstyled",
"appearance.reduced-to-base-color",
"appearance.binding-metadata-reduced",
"attribute.source-record-not-written",
"geometry.procedural-reduced-to-carrier",
"native.source-record-omitted",
"topology.region-no-writable-outer-shell",
"topology.region-omitted-void-shell",
"topology.shell-omitted-outer-face",
"topology.shell-omitted-inner-face",
"topology.face-omitted-outer-loop",
"topology.face-omitted-inner-loop",
"topology.face-no-writable-bounds",
"topology.loop-record-missing",
"topology.loop-vertex-missing",
"topology.loop-coedge-record-missing",
"topology.loop-edge-not-writable",
"topology.loop-no-writable-edges",
"topology.loop-duplicate-coedge",
"topology.loop-coedge-missing-for-order",
"topology.loop-edge-missing-for-order",
"topology.edge-no-3d-curve",
"topology.edge-curve-not-writable",
"topology.edge-curve-unsupported",
"topology.loop-no-continuous-ordering",
"topology.edge-record-missing",
"topology.edge-start-vertex-missing",
"topology.edge-end-vertex-missing",
]
);
}
#[test]
fn codes_are_unique_and_well_formed() {
let mut seen = BTreeSet::new();
for code in StepLossCode::ALL {
let text = code.code();
assert!(seen.insert(text), "duplicate code {text}");
let (family, detail) = text.split_once('.').expect("family.detail shape");
assert!(!family.is_empty() && !detail.is_empty());
assert!(
text.bytes().all(|b| b.is_ascii_lowercase()
|| b.is_ascii_digit()
|| b == b'.'
|| b == b'-'),
"code {text} is not lowercase kebab"
);
}
}
#[test]
fn note_takes_severity_from_the_code() {
for code in StepLossCode::ALL {
let note = code.note("x");
assert_eq!(note.severity, code.severity());
assert_eq!(note.message, "x");
assert!(note.provenance.is_none());
}
}
}