/*------------------------------------------------------------------------- * 功能描述:ParseColumn * 作者:xulisong * 创建时间: 2019/6/24 9:49:28 * 版本号:v1.0 * -------------------------------------------------------------------------*/ using Autodesk.Revit.DB; using JBIM; using RevitExport.Export; using RevitToJBim.Common; using System; using System.Collections.Generic; using JFamilyType = RevitToJBim.Common.FamilyType; using JColumn =JBIM.Component.Column; using SAGA.RevitUtils.Extends; using SAGA.RevitUtils.Extends.Graphic; using System.Linq; using JBIM.Definition; namespace RevitToJBim.ComponentParse { [UsableParse] public class ParseColumn : ParseBase { public override List FastIndex() { return new List() { CategoryGenerator.BuildingCategory(JFamilyType.Other) }; } public override bool Match(ElementWrapper wrapper) { return wrapper.Category == CategoryGenerator.BuildingCategory(JFamilyType.Other); } protected override List ParseInner(ElementWrapper wrapper, JBimParseContext context) { if (!(wrapper.RefElement is FamilyInstance familyInstance)) { return null; } JColumn jObject = new JColumn(); ParseCore.AttachObject(jObject, wrapper); jObject.Location = ParseCore.GetLocation(familyInstance.Location); var polygonPath = RevitUtil.GetTopPolygon(familyInstance); if (polygonPath != null && polygonPath.Any()) { Polygon outLine = new Polygon(BimConvert.ConvertToXYZs(polygonPath)); jObject.OutLine.Add(outLine); } context.AddBimObject(jObject); return new List() { jObject.Id }; } } }