12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using Autodesk.Revit.DB;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SAGA.RevitUtils.Extends;
- using SAGA.MBI.Tools;
- using System.Text.RegularExpressions;
- using SAGA.MBI.RevitExport.Entity;
- using XYZ = Autodesk.Revit.DB.XYZ;
- namespace SAGA.MBI.RevitExport.ParseElement
- {
- [LoadParse]
- public class ParseEquipment : IParseRevitElement
- {
- public bool Match(RevitElementWrapper wrapper)
- {
- return wrapper.Category == MbiElementCategory.Equipment;
- }
- public void Parse(RevitElementWrapper wrapper, ExportDb db)
- {
- try
- {
- FamilyInstance equipment = wrapper.RefElement as FamilyInstance;
- if (equipment == null)
- return;
- var family = equipment.GetFamily();
- var name = family.Name;
- if (!equipment.IsMbiEquipment())
- {
- return;
- }
- MbiEquipment jObject = new MbiEquipment();
- ParseCore.AttachObject(jObject, equipment);
- do
- {
- //Location
- jObject.Location = GeometryLocation.CreatePointLocation(BimConvert.ConvertToXYZ(equipment.GetLocationPoint()));
- //OutLine
- var polygonPath = RevitUtil.GetBottomPolygon(equipment);
- if (polygonPath != null && polygonPath.Any())
- {
- Polygon outLine = new Polygon(BimConvert.ConvertToXYZs(polygonPath));
- jObject.OutLine.Add(outLine);
- }
- //FamilyName
- jObject.FamilyName = equipment.GetFamilyName();
- //Tag
- jObject.Tag = "";
- //Id
- } while (false);
-
- db.AddEquipment(jObject);
- }
- catch (Exception e)
- {
- }
-
-
- }
- }
- }
|