ParseWall.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:ParseWall
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/25 17:53:27
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using Autodesk.Revit.DB;
  8. using JBIM;
  9. using RevitExport.Export;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using JBIM.Definition;
  16. using RevitToJBim.Common;
  17. using JWall = JBIM.Component.Wall;
  18. namespace RevitToJBim.ComponentParse
  19. {
  20. [UsableParse]
  21. public class ParseWall : ParseBase
  22. {
  23. public override List<string> FastIndex()
  24. {
  25. return new List<string>() { typeof(Wall).FullName };
  26. }
  27. public override bool Match(ElementWrapper wrapper)
  28. {
  29. return wrapper.RefElement is Wall;
  30. }
  31. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  32. {
  33. if (!(wrapper.RefElement is Wall wall))
  34. {
  35. return null;
  36. }
  37. JWall jObject = new JWall();
  38. ParseCore.AttachObject(jObject, wrapper);
  39. context.AddBimObject(jObject);
  40. jObject.Location = ParseCore.GetLocation(wall.Location);
  41. var polygons = RevitUtil.GetWallPolygon(wall);
  42. foreach (var polygon in polygons)
  43. {
  44. var outLine = new Polygon(BimConvert.ConvertToXYZs(polygon));
  45. jObject.OutLine.Add(outLine);
  46. }
  47. jObject.Width = wall.Width.FtToUse();
  48. return new List<BimId>() { jObject.Id };
  49. }
  50. }
  51. }