ElementWrapper.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using Autodesk.Revit.DB;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace FWindSoft.Revit
  8. {
  9. /// <summary>
  10. /// 元素包装器
  11. /// </summary>
  12. /// <typeparam name="T"></typeparam>
  13. public class ElementWrapper<T> where T:Element
  14. {
  15. public ElementWrapper(T element )
  16. {
  17. Instance = element;
  18. }
  19. public T Instance { get; private set; }
  20. }
  21. /// <summary>
  22. /// 定位点元素包装器
  23. /// </summary>
  24. /// <typeparam name="T"></typeparam>
  25. public class PointElementWrapper<T>: ElementWrapper<T> where T : Element
  26. {
  27. public PointElementWrapper(T element):base(element)
  28. {
  29. Point = element.GetLocationPoint();
  30. }
  31. /// <summary>
  32. /// 定位点
  33. /// </summary>
  34. public XYZ Point { get; private set; }
  35. }
  36. /// <summary>
  37. /// 定位线元素包装器
  38. /// </summary>
  39. /// <typeparam name="T"></typeparam>
  40. public class CurveElementWrapper<T> : ElementWrapper<T> where T : Element
  41. {
  42. public CurveElementWrapper(T element) : base(element)
  43. {
  44. Curve = element.GetLocationCurve();
  45. }
  46. /// <summary>
  47. /// 定位线
  48. /// </summary>
  49. public Curve Curve { get; private set; }
  50. }
  51. /// <summary>
  52. /// 直线元素包装器
  53. /// </summary>
  54. /// <typeparam name="T"></typeparam>
  55. public class LineElementWrapper<T> : ElementWrapper<T> where T : Element
  56. {
  57. public LineElementWrapper(T element) : base(element)
  58. {
  59. Line = element.GetLocationLine();
  60. }
  61. /// <summary>
  62. /// 定位线
  63. /// </summary>
  64. public Line Line { get;private set; }
  65. }
  66. }