ParseWall.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. //是否保持z为0的转换;
  43. foreach (var polygon in polygons)
  44. {
  45. var outLine = new Polygon(BimConvert.ConvertToXYZs(polygon,true));
  46. StandardUtil.ArrangeLoop(outLine);
  47. jObject.OutLine.Add(outLine);
  48. }
  49. jObject.Width = wall.Width.FtToUse();
  50. return new List<BimId>() { jObject.Id };
  51. }
  52. }
  53. }