123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
-
- using Autodesk.Revit.DB;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FWindSoft.Revit.Mep
- {
- ///// <summary>
- ///// 连接生成器
- ///// </summary>
- //public class JoinCreator
- //{
-
- // public JoinCreator(IMepCurveJoin curveJoin, IMepEquipmentJoin equipmentJoin)
- // {
- // CurveJoin = curveJoin;
- // EequipmentJoin = equipmentJoin;
- // }
- // /// <summary>
- // /// 管线连接
- // /// </summary>
- // public IMepCurveJoin CurveJoin { get; private set; }
- // /// <summary>
- // /// 末端连接
- // /// </summary>
- // public IMepEquipmentJoin EequipmentJoin { get; private set; }
- // /// <summary>
- // /// 创建连接
- // /// </summary>
- // /// <param name="cre"></param>
- // /// <param name="idDict"></param>
- // /// <param name="doc"></param>
- // public virtual bool CreateConnectors(ConnectorRvtElement cre, Dictionary<string, string> idDict,Document doc)
- // {
- // /*
- // * 记录未成功连接的数据
- // */
- // bool? result = false;
- // var joinElements = cre.conduit_list;
- // var joinElementRevitIds = joinElements.Select(global =>
- // { idDict.TryGetValue(global, out string revitId);
- // return revitId;
- // }).OfType<string>();
- // var revitELements = joinElementRevitIds.Select(id => doc.GetElement(new ElementId(id.ToInt()))).ToList();
- // JoinContext context = new JoinContext();//预留,附加信息可能会在这个类中进行扩展
- // var elementWrappers = revitELements.Select(el => new JoinElementWraper(el)).ToList();//使用Wrapper代理,为了方便扩展一些自定义扩展数据
- // try
- // {
- // switch (elementWrappers.Count())
- // {
- // case 2:
- // {
- // if (elementWrappers.Any(ew => ew.IsFamilyInstance))
- // {
- // result = EequipmentJoin?.JoinEquipment(elementWrappers, context);
- // }
- // else
- // {
- // result = CurveJoin?.Join2Curve(elementWrappers, context);
- // }
- // break;
- // }
- // case 3:
- // {
- // result = CurveJoin?.Join3Curve(elementWrappers, context);
- // break;
- // }
- // case 4:
- // {
- // result = CurveJoin?.Join4Curve(elementWrappers, context);
- // break;
- // }
- // }
- // }
- // catch (Exception ex)
- // {
- // //自动执行,暂时不抛出异常,
- // result = false;
- // //throw;
- // }
- // if(result != true)
- // {
- // List<string> ids = elementWrappers.Select(ew => ew.AssociateElement?.Id.ToString()).ToList();
- // var filePath = Path.Combine(AppBaseInfo.LogPath, "测试.txt");
- // if(!Directory.GetParent(filePath).Exists)
- // {
- // Directory.GetParent(filePath).Create();
- // }
- // File.AppendAllLines(filePath, new List<string>() {DateTime.Now.ToString("yyyyMMddHHmmss :") + string.Join(",", ids) });
- // }
- // return result == true;
- // }
- // #region 单例连接生成器
- // private static JoinCreator m_ConduitJoinCreator;
- // /// <summary>
- // /// 线管连接器
- // /// </summary>
- // /// <returns></returns>
- // public static JoinCreator ConduitJoinCreator
- // {
- // get
- // {
- // if(m_ConduitJoinCreator == null)
- // {
- // m_ConduitJoinCreator= new JoinCreator(new ConduitJoin(), null);
- // }
- // return m_ConduitJoinCreator;
- // }
- // }
- // private static JoinCreator m_PipeJoinCreator;
- // /// <summary>
- // /// 水管连接器
- // /// </summary>
- // /// <returns></returns>
- // public static JoinCreator PipeJoinCreator
- // {
- // get
- // {
- // if (m_PipeJoinCreator == null)
- // {
- // m_PipeJoinCreator = new JoinCreator(null, null);
- // }
- // return m_PipeJoinCreator;
- // }
- // }
- // private static JoinCreator m_DuctJoinCreator;
- // /// <summary>
- // /// 风管连接器
- // /// </summary>
- // /// <returns></returns>
- // public static JoinCreator DuctJoinCreator
- // {
- // get
- // {
- // if (m_DuctJoinCreator == null)
- // {
- // m_DuctJoinCreator = new JoinCreator(null, null);
- // }
- // return m_DuctJoinCreator;
- // }
- // }
- // private static JoinCreator m_CableTrayJoinCreator;
- // /// <summary>
- // /// 桥架连接器
- // /// </summary>
- // /// <returns></returns>
- // public static JoinCreator CableTrayJoinCreator
- // {
- // get
- // {
- // if (m_CableTrayJoinCreator == null)
- // {
- // m_CableTrayJoinCreator = new JoinCreator(null, null);
- // }
- // return m_CableTrayJoinCreator;
- // }
- // }
- // #endregion
- //}
- }
|