1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- using JBIM;
- using Newtonsoft.Json.Linq;
- using SAGA.DotNetUtils.Extend;
- using SAGA.RevitUtils;
- namespace RevitToJBim.MBI
- {
-
-
-
- public class MBIDocument
- {
- public string MBIName { get; set; }
- public string ModelId { get; set; }
- public string PlanName { get; set; }
- public Dictionary<string, List<BimObject>> Elements { get; private set; }
-
-
-
-
- public void AttachElements(BimDocument document)
- {
- var bimObjects = document.BimObjects;
- var group = bimObjects.GroupBy(bim => bim.ElementType);
- Dictionary<string, List<BimObject>> dic = new Dictionary<string, List<BimObject>>();
- foreach (var collection in group)
- {
- dic[collection.Key + "s"] = collection.ToList();
- }
- Elements = dic;
- }
- public static MBIDocument CreateDocument(Document document, string param)
- {
- MBIDocument dto = new MBIDocument();
- JObject jObject = JObject.Parse(param);
- dto.MBIName = jObject.GetValueEx("MBIName");
- dto.ModelId = jObject.GetValueEx("ModelId");
-
-
- dto.PlanName = document.GetUseView()?.Name;
- return dto;
- }
- }
- }
|