91 lines
2.3 KiB
C#
91 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Autodesk.Revit.DB;
|
|
using Autodesk.Revit.DB.Architecture;
|
|
|
|
namespace IFC_Revit_Interop
|
|
{
|
|
// Token: 0x0200001A RID: 26
|
|
internal class RailingParentFinder
|
|
{
|
|
// Token: 0x06000082 RID: 130 RVA: 0x00007270 File Offset: 0x00005470
|
|
public RailingParentFinder(ParentFinder host)
|
|
{
|
|
this.host = host;
|
|
}
|
|
|
|
// Token: 0x06000083 RID: 131 RVA: 0x00007280 File Offset: 0x00005480
|
|
public void Find()
|
|
{
|
|
foreach (Element element3 in this.host.coll.Where((Element element) => element is ContinuousRail))
|
|
{
|
|
try
|
|
{
|
|
ContinuousRail continuousRail = element3 as ContinuousRail;
|
|
if (continuousRail.HostRailingId != ElementId.InvalidElementId)
|
|
{
|
|
this.host.ChildToParent[continuousRail.Id.IntegerValue] = continuousRail.HostRailingId.IntegerValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.host.log.WriteException("ERR_RailingParentFinder", ex);
|
|
}
|
|
}
|
|
foreach (Element element2 in this.host.coll.Where((Element element) => element is Railing))
|
|
{
|
|
try
|
|
{
|
|
ICollection<ElementId> collection = RailingParentFinder.CollectSubElements(element2 as Railing);
|
|
if (collection != null)
|
|
{
|
|
foreach (ElementId elementId in collection)
|
|
{
|
|
this.host.ChildToParent[elementId.IntegerValue] = element2.Id.IntegerValue;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex2)
|
|
{
|
|
this.host.log.WriteException("ERR_RailingParentFinder", ex2);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000084 RID: 132 RVA: 0x00007450 File Offset: 0x00005650
|
|
public static ICollection<ElementId> CollectSubElements(Railing railingElem)
|
|
{
|
|
IList<ElementId> list = new List<ElementId>();
|
|
if (railingElem != null)
|
|
{
|
|
ElementId topRail = railingElem.TopRail;
|
|
if (topRail != ElementId.InvalidElementId)
|
|
{
|
|
list.Add(topRail);
|
|
}
|
|
IList<ElementId> handRails = railingElem.GetHandRails();
|
|
if (handRails != null)
|
|
{
|
|
foreach (ElementId elementId in handRails)
|
|
{
|
|
HandRail handRail = railingElem.Document.GetElement(elementId) as HandRail;
|
|
if (handRail != null)
|
|
{
|
|
list.Add(elementId);
|
|
foreach (ElementId elementId2 in handRail.GetSupports())
|
|
{
|
|
list.Add(elementId2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
// Token: 0x0400007E RID: 126
|
|
private ParentFinder host;
|
|
}
|
|
}
|