public static Dictionary <string, object> ByDirection(global::Revit.Elements.Wall hostingElement) { //obtains the current document for later use Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; List <global::Revit.Elements.Mullion> horizontal = new List <Mullion>(); List <global::Revit.Elements.Mullion> vertical = new List <Mullion>(); var mullions = Mullion.ByElement(hostingElement); foreach (var mullion in mullions) { if (mullion.LocationCurve.StartPoint.Z == mullion.LocationCurve.EndPoint.Z) { horizontal.Add(mullion); } else { vertical.Add(mullion); } } var orderedHorizontal = horizontal.OrderBy(m => m.LocationCurve.StartPoint.Z).ThenBy(m => m.LocationCurve.StartPoint.X); var orderedVertical = vertical.OrderBy(m => m.LocationCurve.StartPoint.X).ThenBy(m => m.LocationCurve.StartPoint.Z); var outInfo = new Dictionary <string, object> { { "horizontal", orderedHorizontal }, { "vertical", orderedVertical } }; return(outInfo); }
public static Dictionary <string, object> ByWallElement(global::Revit.Elements.Wall curtainWall) { Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; Autodesk.Revit.DB.Wall internalWall = (Autodesk.Revit.DB.Wall)curtainWall.InternalElement; //obtains internal curtain grid Autodesk.Revit.DB.CurtainGrid internalCurtainGrid = internalWall.CurtainGrid; //gets U Grid Ids ICollection <Autodesk.Revit.DB.ElementId> uGridIds = internalCurtainGrid.GetUGridLineIds(); //make new list for U grids List <global::Revit.Elements.Element> uGrids = new List <global::Revit.Elements.Element>(uGridIds.Select(id => doc.GetElement(id).ToDSType(true)).ToArray()); //gets V Grid Ids ICollection <Autodesk.Revit.DB.ElementId> vGridIds = internalCurtainGrid.GetVGridLineIds(); //make new list for V grids List <global::Revit.Elements.Element> vGrids = new List <global::Revit.Elements.Element>(vGridIds.Select(id => doc.GetElement(id).ToDSType(true)).ToArray()); //returns the outputs var outInfo = new Dictionary <string, object> { { "curtainGrid", internalCurtainGrid }, { "uGrids", uGrids }, { "vGrids", vGrids }, }; return(outInfo); }