1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /*-------------------------------------------------------------------------
- * 功能描述:ParseDoor
- * 作者:xulisong
- * 创建时间: 2019/6/25 17:53:11
- * 版本号:v1.0
- * -------------------------------------------------------------------------*/
- using RevitExport.Export;
- using RevitToJBim.Common;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using JFamilyType = RevitToJBim.Common.FamilyType;
- using JBIM;
- using Autodesk.Revit.DB;
- using JBIM.Component;
- using JBIM.Definition;
- namespace RevitToJBim.ComponentParse
- {
- [UsableParse]
- public class ParseDoor : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>() { CategoryGenerator.BuildingCategory(JFamilyType.Door) };
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.Category == CategoryGenerator.BuildingCategory(JFamilyType.Door);
- }
- protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
- {
- if (!(wrapper.RefElement is FamilyInstance fi))
- {
- return null;
- }
- Door jObject = new Door();
- ParseCore.AttachObject(jObject, wrapper);
- context.AddBimObject(jObject);
- jObject.Location = ParseCore.GetLocation(fi.Location);
- if (fi.Host != null)
- {
- jObject.Owner = context.Parser.ParseElement(ElementWrapperFactory.CreateWrapper(fi.Host))?.FirstOrDefault();
- jObject.Thick = (fi.Host as Autodesk.Revit.DB.Wall).Width.FtToUse();
- }
- var polygonPath = RevitUtil.GetWindowDoorLocation(fi);
- if (polygonPath != null && polygonPath.Any())
- {
- Polygon outLine = new Polygon(BimConvert.ConvertToXYZs(polygonPath,true));
- jObject.OutLine.Add(outLine);
- }
- jObject.HandDirection = BimConvert.ConvertToDirection(fi.HandOrientation);
- jObject.FaceDirection = BimConvert.ConvertToDirection(fi.FacingOrientation);
- return new List<BimId>() { jObject.Id };
- }
- }
- }
|