12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- using JBIM;
- using JBIM.Component;
- using JBIM.Definition;
- using RevitExport.Export;
- using RevitToJBim.Common;
- using JFamilyType = RevitToJBim.Common.FamilyType;
- namespace RevitToJBim.ComponentParse
- {
- [UsableParse]
- public class ParseWindow : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>() { CategoryGenerator.BuildingCategory(JFamilyType.Window) };
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.Category == CategoryGenerator.BuildingCategory(JFamilyType.Window);
- }
- protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
- {
- if (!(wrapper.RefElement is FamilyInstance fi))
- {
- return null;
- }
- Window jObject = new Window();
- 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);
- }
-
- return new List<BimId>() { jObject.Id };
- }
- }
- }
|