public static Elements.Panel CurtainWallPanelToHyparPanel(Autodesk.Revit.DB.Panel panel) { //TODO:wrap this in a try catch for now until i build some actual handlers try { Polygon poly = null; ElementId uGridId = ElementId.InvalidElementId; ElementId vGridId = ElementId.InvalidElementId; panel.GetRefGridLines(ref uGridId, ref vGridId); CurtainGrid hostingGrid = null; if (panel.Host is Wall wall) { hostingGrid = wall.CurtainGrid; } CurtainCell cell = hostingGrid.GetCell(uGridId, vGridId); var loops = cell.CurveLoops; foreach (CurveArray loop in loops) { List <Vector3> vertices = new List <Vector3>(); foreach (Curve l in loop) { vertices.Add(l.GetEndPoint(0).ToVector3()); } poly = new Polygon(vertices); } Elements.Panel newPanel = new Elements.Panel(poly, BuiltInMaterials.Glass); return(newPanel); } catch (Exception) { return(null); } }