/// <summary> /// Extracts a Dynamo Solid from a Revit Wall object and creates a ParasiteObject /// from the extracted geometry /// </summary> /// <param name="element"></param> /// <param name="outPutSolids"></param> /// <param name="parasiteObjects"></param> /// <param name="OP"></param> /// <param name="doc"></param> public static void GeometryDataFromWall(Element element, List <DynamoSolid> outPutSolids, List <ParasiteObject> parasiteObjects, Options OP, Document doc) { if (element is WallType) { // Cast Element to WallType WallType wallType = element as WallType; // Get Geometry Element GeometryElement geometryElement = wallType.get_Geometry(OP); // Skip if null if (geometryElement != null) { P_Parameter paramChildLayer = new P_Parameter(P_ParameterType.ChildLayer, wallType.Name, P_StorageType.String); P_Parameter paramLayer = new P_Parameter(P_ParameterType.Layer, element.Category.Name, P_StorageType.String); DynamoParasiteFactory.CreateParasiteObjectFromGeometryElement(geometryElement, new P_Parameter[] { paramChildLayer, paramLayer }, outPutSolids, parasiteObjects); } } // END WALLTYPE CLASS CONDITION else if (element is Wall) { Wall wall = element as Wall; CurtainGrid cgrid = wall.CurtainGrid; // THIS MEANS WALL IS A GLAZED CURTAIN WALL if (cgrid != null) { ICollection <ElementId> panelIds = cgrid.GetPanelIds(); Element[] panels = panelIds.Select(a => doc.GetElement(a)).ToArray(); for (int p = 0; p < panels.Length; p++) { // Ignores Family instances in the Curtain wall. For example doors if (!(panels[p] is Panel panel)) { continue; } GeometryElement geometryElement = panel.get_Geometry(OP); if (geometryElement != null) { P_Parameter paramChildLayer = new P_Parameter(P_ParameterType.ChildLayer, panel.Category.Name, P_StorageType.String); P_Parameter paramLayer = new P_Parameter(P_ParameterType.Layer, element.Category.Name, P_StorageType.String); DynamoParasiteFactory.CreateParasiteObjectFromGeometryElement(geometryElement, new P_Parameter[] { paramChildLayer, paramLayer }, outPutSolids, parasiteObjects); } } ICollection <ElementId> mullionIds = cgrid.GetMullionIds(); Element[] mullions = mullionIds.Select(a => doc.GetElement(a)).ToArray(); for (int m = 0; m < mullions.Length; m++) { Mullion mullion = mullions[m] as Mullion; //if (!(mullions[m] is Mullion mullion)) continue; GeometryElement geometryElement = mullion.get_Geometry(OP); if (geometryElement != null) { P_Parameter paramChildLayer = new P_Parameter(P_ParameterType.ChildLayer, mullion.Category.Name, P_StorageType.String); P_Parameter paramLayer = new P_Parameter(P_ParameterType.Layer, element.Category.Name, P_StorageType.String); DynamoParasiteFactory.CreateParasiteObjectFromGeometryElement(geometryElement, new P_Parameter[] { paramChildLayer, paramLayer }, outPutSolids, parasiteObjects); } } } // End of wall that is a curtain wall // THIS MEANS ITS A NORMAL WALL else { GeometryElement geometryElement = element.get_Geometry(OP); if (geometryElement != null) { P_Parameter paramChildLayer = new P_Parameter(P_ParameterType.ChildLayer, wall.WallType.Name, P_StorageType.String); P_Parameter paramLayer = new P_Parameter(P_ParameterType.Layer, element.Category.Name, P_StorageType.String); DynamoParasiteFactory.CreateParasiteObjectFromGeometryElement(geometryElement, new P_Parameter[] { paramChildLayer, paramLayer }, outPutSolids, parasiteObjects); } } } // END WALL CLASS CONDITION else { throw new ParasiteNotImplementedExceptions("Wall type not implemented yet"); } }