brep_app/workbench/welding.rs
1//! Welds belong to the current part or assembly history.
2//!
3//! Welding is a workbench AND a command set: every weld type is a feature
4//! whose schema puts its button on the one "Welding" ribbon tab ([`TAB`]), and
5//! the workbenches in [`HOSTS`] (Modeling, Sheet Metal, Assembly, Welding — and
6//! All, which sees everything) include every weld type ([`is_weld_type`]), so
7//! the tab, the add-feature palette and the context bar offer welds there.
8use super::{FeatureInfo, Workbench};
9
10/// The ribbon tab every weld type's button sits under.
11pub const TAB: &str = "Welding";
12
13/// The workbenches that offer weld features (and so show the Welding tab).
14pub const HOSTS: [&str; 4] = ["modeling", "sheetMetal", "assembly", "welding"];
15
16/// Whether `type_code` is a weld feature: the fillet weld `WELD`, or one of
17/// the other kinds `WELD.<kind>`.
18pub fn is_weld_type(type_code: &str) -> bool {
19 brep_render::brep_kernel::is_weld_type(type_code)
20}
21
22pub static WELDING: Workbench = Workbench {
23 id: "welding",
24 label: "Welding",
25 glyph: "\u{E0D6}",
26 includes: |feature: &FeatureInfo<'_>| {
27 is_weld_type(feature.type_code)
28 || matches!(feature.type_code, "S" | "D" | "P" | "ACOMP" | "APAT")
29 },
30 buttons: &[],
31 panels: &[
32 super::pmi::PANEL_ID,
33 super::assembly::CONSTRAINTS_PANEL_ID,
34 super::assembly::BOM_PANEL_ID,
35 ],
36};