* fix(engine): report design variant in timeline.inspect and accept in timeline.add (#10748) * ci: refresh checks to clear cancelled workflow run
This commit is contained in:
@@ -2433,6 +2433,167 @@ impl FeatureKind {
|
||||
FeatureKind::MeshConvert { .. } => "MeshConvertFeature",
|
||||
}
|
||||
}
|
||||
|
||||
/// Design-file variant key (e.g. `"extrude"`, `"box"`, `"sheet_flange"`).
|
||||
pub fn kind_key(&self) -> &'static str {
|
||||
match self {
|
||||
FeatureKind::BodyTransfer { .. } => "body_transfer",
|
||||
FeatureKind::Sketch { .. } => "sketch",
|
||||
FeatureKind::Extrude { .. } => "extrude",
|
||||
FeatureKind::Revolve { .. } => "revolve",
|
||||
FeatureKind::Fillet { .. } => "fillet",
|
||||
FeatureKind::Chamfer { .. } => "chamfer",
|
||||
FeatureKind::Box { .. } => "box",
|
||||
FeatureKind::Cylinder { .. } => "cylinder",
|
||||
FeatureKind::Sphere { .. } => "sphere",
|
||||
FeatureKind::Torus { .. } => "torus",
|
||||
FeatureKind::Cone { .. } => "cone",
|
||||
FeatureKind::Combine { .. } => "combine",
|
||||
FeatureKind::Pattern { .. } => "pattern",
|
||||
FeatureKind::Mirror { .. } => "mirror",
|
||||
FeatureKind::Hole { .. } => "hole",
|
||||
FeatureKind::Thread { .. } => "thread",
|
||||
FeatureKind::Loft { .. } => "loft",
|
||||
FeatureKind::Sweep { .. } => "sweep",
|
||||
FeatureKind::Shell { .. } => "shell",
|
||||
FeatureKind::Draft { .. } => "draft",
|
||||
FeatureKind::ConstructionPlane { .. } => "construction_plane",
|
||||
FeatureKind::Split { .. } => "split",
|
||||
FeatureKind::ConstructionAxis { .. } => "construction_axis",
|
||||
FeatureKind::ConstructionPoint { .. } => "construction_point",
|
||||
FeatureKind::SplitFace { .. } => "split_face",
|
||||
FeatureKind::Scale { .. } => "scale",
|
||||
FeatureKind::OffsetFace { .. } => "offset_face",
|
||||
FeatureKind::DeleteFace { .. } => "delete_face",
|
||||
FeatureKind::BoundingSolid { .. } => "bounding_solid",
|
||||
FeatureKind::Pipe { .. } => "pipe",
|
||||
FeatureKind::FrameMember { .. } => "frame_member",
|
||||
FeatureKind::Emboss { .. } => "emboss",
|
||||
FeatureKind::Rib { .. } => "rib",
|
||||
FeatureKind::ReplaceFace { .. } => "replace_face",
|
||||
FeatureKind::Align { .. } => "align",
|
||||
FeatureKind::Coil { .. } => "coil",
|
||||
FeatureKind::SheetBase { .. } => "sheet_base",
|
||||
FeatureKind::SheetContour { .. } => "sheet_contour",
|
||||
FeatureKind::SheetFlange { .. } => "sheet_flange",
|
||||
FeatureKind::SheetHem { .. } => "sheet_hem",
|
||||
FeatureKind::SheetPerforate { .. } => "sheet_perforate",
|
||||
FeatureKind::SheetFold { .. } => "sheet_fold",
|
||||
FeatureKind::SheetPath { .. } => "sheet_path",
|
||||
FeatureKind::SheetUnfold { .. } => "sheet_unfold",
|
||||
FeatureKind::SheetConvert { .. } => "sheet_convert",
|
||||
FeatureKind::Boss { .. } => "boss",
|
||||
FeatureKind::Lip { .. } => "lip",
|
||||
FeatureKind::SnapFit { .. } => "snap_fit",
|
||||
FeatureKind::Rest { .. } => "rest",
|
||||
FeatureKind::BoundaryFill { .. } => "boundary_fill",
|
||||
FeatureKind::Remove { .. } => "remove",
|
||||
FeatureKind::Patch { .. } => "patch",
|
||||
FeatureKind::Stitch { .. } => "stitch",
|
||||
FeatureKind::Thicken { .. } => "thicken",
|
||||
FeatureKind::SurfaceExtrude { .. } => "surface_extrude",
|
||||
FeatureKind::Unstitch { .. } => "unstitch",
|
||||
FeatureKind::ReverseNormal { .. } => "reverse_normal",
|
||||
FeatureKind::SurfaceUntrim { .. } => "surface_untrim",
|
||||
FeatureKind::SurfaceRevolve { .. } => "surface_revolve",
|
||||
FeatureKind::SurfaceSweep { .. } => "surface_sweep",
|
||||
FeatureKind::SurfaceLoft { .. } => "surface_loft",
|
||||
FeatureKind::SurfaceOffset { .. } => "surface_offset",
|
||||
FeatureKind::SurfaceRuled { .. } => "surface_ruled",
|
||||
FeatureKind::SurfaceExtend { .. } => "surface_extend",
|
||||
FeatureKind::SurfaceBlend { .. } => "surface_blend",
|
||||
FeatureKind::SurfaceBoundary { .. } => "surface_boundary",
|
||||
FeatureKind::SurfaceNetwork { .. } => "surface_network",
|
||||
FeatureKind::SurfaceMatch { .. } => "surface_match",
|
||||
FeatureKind::SurfaceFair { .. } => "surface_fair",
|
||||
FeatureKind::SurfaceTrim { .. } => "surface_trim",
|
||||
FeatureKind::Move { .. } => "move",
|
||||
FeatureKind::Import { .. } => "import",
|
||||
FeatureKind::MeshConvert { .. } => "mesh_convert",
|
||||
FeatureKind::MeshImport { .. } => "mesh_import",
|
||||
}
|
||||
}
|
||||
|
||||
/// Map a display or Rust type name (e.g. `"HoleFeature"`, `"EdgeFlangeFeature"`)
|
||||
/// to the canonical design-file variant key (`"hole"`, `"sheet_flange"`).
|
||||
pub fn type_name_to_kind_key(name: &str) -> Option<&'static str> {
|
||||
Some(match name {
|
||||
"BodyTransferFeature" => "body_transfer",
|
||||
"Sketch" => "sketch",
|
||||
"ExtrudeFeature" => "extrude",
|
||||
"RevolveFeature" => "revolve",
|
||||
"FilletFeature" => "fillet",
|
||||
"ChamferFeature" => "chamfer",
|
||||
"BoxFeature" => "box",
|
||||
"CylinderFeature" => "cylinder",
|
||||
"SphereFeature" => "sphere",
|
||||
"TorusFeature" => "torus",
|
||||
"ConeFeature" => "cone",
|
||||
"CombineFeature" => "combine",
|
||||
"RectangularPatternFeature" | "PathPatternFeature" | "CircularPatternFeature" => "pattern",
|
||||
"MirrorFeature" => "mirror",
|
||||
"ConstructionPlane" => "construction_plane",
|
||||
"HoleFeature" => "hole",
|
||||
"ThreadFeature" => "thread",
|
||||
"LoftFeature" => "loft",
|
||||
"SweepFeature" => "sweep",
|
||||
"ShellFeature" => "shell",
|
||||
"DraftFeature" => "draft",
|
||||
"SplitBodyFeature" => "split",
|
||||
"SplitFaceFeature" => "split_face",
|
||||
"ConstructionAxis" => "construction_axis",
|
||||
"ConstructionPoint" => "construction_point",
|
||||
"MoveFeature" => "move",
|
||||
"ScaleFeature" => "scale",
|
||||
"OffsetFacesFeature" => "offset_face",
|
||||
"DeleteFaceFeature" => "delete_face",
|
||||
"OffsetSurfaceFeature" => "surface_offset",
|
||||
"BoundingSolidFeature" => "bounding_solid",
|
||||
"PipeFeature" => "pipe",
|
||||
"FrameMemberFeature" => "frame_member",
|
||||
"EmbossFeature" => "emboss",
|
||||
"BossFeature" => "boss",
|
||||
"LipFeature" | "GrooveFeature" => "lip",
|
||||
"SnapFitFeature" => "snap_fit",
|
||||
"RestFeature" => "rest",
|
||||
"BoundaryFillFeature" => "boundary_fill",
|
||||
"BaseFlangeFeature" => "sheet_base",
|
||||
"ContourFlangeFeature" => "sheet_contour",
|
||||
"EdgeFlangeFeature" => "sheet_flange",
|
||||
"HemFeature" => "sheet_hem",
|
||||
"PerforateFeature" => "sheet_perforate",
|
||||
"FoldFeature" => "sheet_fold",
|
||||
"PathFlangeFeature" => "sheet_path",
|
||||
"UnfoldFeature" | "RefoldFeature" => "sheet_unfold",
|
||||
"ConvertToSheetMetalFeature" => "sheet_convert",
|
||||
"CoilFeature" => "coil",
|
||||
"RibFeature" | "WebFeature" => "rib",
|
||||
"ReplaceFaceFeature" => "replace_face",
|
||||
"AlignFeature" => "align",
|
||||
"RemoveFeature" => "remove",
|
||||
"PatchFeature" => "patch",
|
||||
"SurfaceExtrudeFeature" => "surface_extrude",
|
||||
"SurfaceRevolveFeature" => "surface_revolve",
|
||||
"SurfaceSweepFeature" => "surface_sweep",
|
||||
"SurfaceLoftFeature" => "surface_loft",
|
||||
"BlendFeature" => "surface_blend",
|
||||
"BoundaryFeature" => "surface_boundary",
|
||||
"MatchFeature" => "surface_match",
|
||||
"FairFeature" => "surface_fair",
|
||||
"StitchFeature" => "stitch",
|
||||
"ThickenFeature" => "thicken",
|
||||
"TrimFeature" => "surface_trim",
|
||||
"ExtendFeature" => "surface_extend",
|
||||
"RuledSurfaceFeature" => "surface_ruled",
|
||||
"UnstitchFeature" => "unstitch",
|
||||
"ReverseNormalFeature" => "reverse_normal",
|
||||
"UntrimFeature" => "surface_untrim",
|
||||
"BaseFeature" => "import",
|
||||
"MeshFeature" => "mesh_import",
|
||||
"MeshConvertFeature" => "mesh_convert",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
/// Default name prefix (`Extrude` → `Extrude1`).
|
||||
pub fn base_name(&self) -> &'static str {
|
||||
match self {
|
||||
|
||||
@@ -885,3 +885,19 @@ fn browser_data_survives_a_save_and_old_designs_read_unchanged() {
|
||||
assert_eq!(resaved["browser_groups"], groups, "{order}");
|
||||
}
|
||||
}
|
||||
|
||||
/// #10748: verify that type names map to their canonical design-file kind keys.
|
||||
#[test]
|
||||
fn feature_kind_key_and_type_name_mappings() {
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("HoleFeature"), Some("hole"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("BoxFeature"), Some("box"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("EdgeFlangeFeature"), Some("sheet_flange"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("RectangularPatternFeature"), Some("pattern"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("PathPatternFeature"), Some("pattern"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("CircularPatternFeature"), Some("pattern"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("ExtrudeFeature"), Some("extrude"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("SplitBodyFeature"), Some("split"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("BaseFeature"), Some("import"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("MeshFeature"), Some("mesh_import"));
|
||||
assert_eq!(FeatureKind::type_name_to_kind_key("NonExistent"), None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user