ParameterUtil.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* ==============================================================================
  2. * 功能描述:ParameterUtil
  3. * 创 建 者:Garrett
  4. * 创建日期:2019/6/25 16:15:58
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using JBIM.Component;
  12. namespace RevitToJBim.Common
  13. {
  14. /// <summary>
  15. /// ParameterUtil
  16. /// </summary>
  17. public class ParameterUtil
  18. {
  19. private static Dictionary<string, ParameterDefinition> ParameterDefinitionDic { get; set; }
  20. /// <summary>
  21. /// 跟据参数名称查找参数定义
  22. /// </summary>
  23. /// <param name="name"></param>
  24. /// <returns></returns>
  25. public static ParameterDefinition FindParameterDefine(string name)
  26. {
  27. if(ParameterDefinitionDic == null)
  28. ParameterDefinitionDic = new Dictionary<string, ParameterDefinition>();
  29. ParameterDefinition definition = null;
  30. if (!ParameterDefinitionDic.TryGetValue(name, out definition))
  31. {
  32. definition=new ParameterDefinition();
  33. definition.Name = name;
  34. definition.ParameterType = ParameterType.Text;
  35. definition.Visible = true;
  36. }
  37. return definition;
  38. }
  39. }
  40. }