优化更新代码,添加界面功能并整合

This commit is contained in:
GG Z
2025-02-10 20:53:40 +08:00
parent 83b846f15f
commit 978e03a67f
1389 changed files with 95739 additions and 22200 deletions

View File

@@ -0,0 +1,71 @@
using Autodesk.Revit.DB;
namespace ShrlAlgo.Toolkit.Revit.Helpers
{
public static class BuiltEnumDictionary
{
#if REVIT2025
public static string ToLabel(this ForgeTypeId source)
{
if (ParameterUtils.IsBuiltInParameter(source)) return LabelUtils.GetLabelForBuiltInParameter(source);
if (ParameterUtils.IsBuiltInGroup(source)) return LabelUtils.GetLabelForGroup(source);
if (UnitUtils.IsUnit(source)) return LabelUtils.GetLabelForUnit(source);
if (UnitUtils.IsSymbol(source)) return LabelUtils.GetLabelForSymbol(source);
if (SpecUtils.IsSpec(source)) return LabelUtils.GetLabelForSpec(source);
return LabelUtils.GetLabelForDiscipline(source);
}
#endif
public static Dictionary<T, string> GetBuiltInDictionary<T>()
where T : Enum
{
var dict = new Dictionary<T, string>();
foreach (object enumItem in Enum.GetValues(typeof(T)))
{
string name = string.Empty;
switch (enumItem)
{
#if REVIT2020
case BuiltInCategory category:
name = LabelUtils.GetLabelFor(category);
break;
#endif
case BuiltInParameter param:
name = LabelUtils.GetLabelFor(param);
break;
#if REVIT2018 || REVIT2020
case ParameterType type:
name = LabelUtils.GetLabelFor(type);
break;
case BuiltInParameterGroup group:
name = LabelUtils.GetLabelFor(group);
break;
case UnitType unitType:
name = LabelUtils.GetLabelFor(unitType);
break;
case DisplayUnitType displayUnitType:
name = LabelUtils.GetLabelFor(displayUnitType);
break;
case UnitSymbolType symbolType:
name = LabelUtils.GetLabelFor(symbolType);
break;
#endif
case ElementType elementType:
name = elementType.Name;
break;
case Element element:
name = element.Name;
break;
}
#if REVIT2025
if (enumItem is ForgeTypeId forgeTypeId)
{
var label = LabelUtils.GetLabelForBuiltInParameter(forgeTypeId);
}
#endif
dict.Add((T)enumItem, name);
}
return dict;
}
}
}