ParseColumn.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.Column) };
  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,true));
  45. StandardUtil.ArrangeLoop(outLine);
  46. jObject.OutLine.Add(outLine);
  47. }
  48. var parameter = familyInstance.GetParameter(BuiltInParameter.WALL_ATTR_ROOM_BOUNDING);
  49. if (parameter != null)
  50. {
  51. jObject.RoomBoundary=parameter.AsInteger() == 1;
  52. }
  53. context.AddBimObject(jObject);
  54. return new List<BimId>() { jObject.Id };
  55. }
  56. }
  57. }