ParseColumn.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. using RevitToJBim.Extension;
  20. namespace RevitToJBim.ComponentParse
  21. {
  22. [UsableParse]
  23. public class ParseColumn : ParseBase
  24. {
  25. public override List<string> FastIndex()
  26. {
  27. return new List<string>() { CategoryGenerator.BuildingCategory(JFamilyType.Column) };
  28. }
  29. public override bool Match(ElementWrapper wrapper)
  30. {
  31. return wrapper.Category == CategoryGenerator.BuildingCategory(JFamilyType.Column);
  32. }
  33. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  34. {
  35. if (!(wrapper.RefElement is FamilyInstance familyInstance))
  36. {
  37. return null;
  38. }
  39. JColumn jObject = new JColumn();
  40. ParseCore.AttachObject(jObject, wrapper);
  41. jObject.Location = ParseCore.GetLocation(familyInstance.Location);
  42. //FamilyName
  43. jObject.FamilyName = familyInstance.GetFamilyName();
  44. jObject.FamilySymbol = familyInstance.GetFamilySymbolName();
  45. var polygonPath = RevitUtil.GetTopPolygon(familyInstance);
  46. if (polygonPath != null && polygonPath.Any())
  47. {
  48. Polygon outLine = new Polygon(BimConvert.ConvertToXYZs(polygonPath,true));
  49. StandardUtil.ArrangeLoop(outLine);
  50. jObject.OutLine.Add(outLine);
  51. }
  52. var parameter = familyInstance.GetParameter(BuiltInParameter.WALL_ATTR_ROOM_BOUNDING);
  53. if (parameter != null)
  54. {
  55. jObject.RoomBoundary=parameter.AsInteger() == 1;
  56. }
  57. context.AddBimObject(jObject);
  58. return new List<BimId>() { jObject.Id };
  59. }
  60. }
  61. }