ParseColumn.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:ParseColumn
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/24 9:49:28
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using Autodesk.Revit.DB;
  8. using JBIM;
  9. using RevitExport.Export;
  10. using RevitToJBim.Common;
  11. using System;
  12. using System.Collections.Generic;
  13. using JFamilyType = RevitToJBim.Common.FamilyType;
  14. using JColumn =JBIM.Component.Column;
  15. using SAGA.RevitUtils.Extends;
  16. using SAGA.RevitUtils.Extends.Graphic;
  17. using System.Linq;
  18. using JBIM.Definition;
  19. namespace RevitToJBim.ComponentParse
  20. {
  21. [UsableParse]
  22. public class ParseColumn : ParseBase
  23. {
  24. public override List<string> FastIndex()
  25. {
  26. return new List<string>() { CategoryGenerator.BuildingCategory(JFamilyType.Other) };
  27. }
  28. public override bool Match(ElementWrapper wrapper)
  29. {
  30. return wrapper.Category == CategoryGenerator.BuildingCategory(JFamilyType.Other);
  31. }
  32. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  33. {
  34. if (!(wrapper.RefElement is FamilyInstance familyInstance))
  35. {
  36. return null;
  37. }
  38. JColumn jObject = new JColumn();
  39. ParseCore.AttachObject(jObject, wrapper);
  40. jObject.Location = ParseCore.GetLocation(familyInstance.Location);
  41. var polygonPath = RevitUtil.GetTopPolygon(familyInstance);
  42. if (polygonPath != null && polygonPath.Any())
  43. {
  44. Polygon outLine = new Polygon(BimConvert.ConvertToXYZs(polygonPath));
  45. jObject.OutLine.Add(outLine);
  46. }
  47. context.AddBimObject(jObject);
  48. return new List<BimId>() { jObject.Id };
  49. }
  50. }
  51. }