/// <summary>
        /// Exports a curtain wall to IFC curtain wall.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="hostElement">
        /// The host object element to be exported.
        /// </param>
        /// <param name="productWrapper">
        /// The IFCProductWrapper.
        /// </param>
        public static void ExportWall(ExporterIFC exporterIFC, Wall hostElement, IFCProductWrapper productWrapper)
        {
            // Don't export the Curtain Wall itself, which has no useful geometry; instead export all of the GReps of the
            // mullions and panels.
            CurtainGrid grid = hostElement.CurtainGrid;

            if (grid == null)
            {
                return;
            }

            ICollection <ElementId> allSubElements = grid.GetPanelIds();

            foreach (ElementId subElem in grid.GetMullionIds())
            {
                allSubElements.Add(subElem);
            }
            ExportBase(exporterIFC, allSubElements, hostElement, productWrapper);
        }
        Stream(ArrayList data, CurtainGrid grid)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(CurtainGrid)));

            data.Add(new Snoop.Data.Enumerable("Curtain Cells", grid.GetCurtainCells()));
            data.Add(new Snoop.Data.Enumerable("Mullions", grid.GetMullionIds(), m_activeDoc));
            data.Add(new Snoop.Data.Enumerable("Unlocked mullions", grid.GetUnlockedMullionIds(), m_activeDoc));
            data.Add(new Snoop.Data.Angle("Grid 1 angle", grid.Grid1Angle));
            data.Add(new Snoop.Data.String("Grid 1 justification", grid.Grid1Justification.ToString()));
            data.Add(new Snoop.Data.Double("Grid 1 offset", grid.Grid1Offset));
            data.Add(new Snoop.Data.Angle("Grid 2 angle", grid.Grid2Angle));
            data.Add(new Snoop.Data.String("Grid 2 justification", grid.Grid2Justification.ToString()));
            data.Add(new Snoop.Data.Double("Grid 2 offset", grid.Grid2Offset));
            data.Add(new Snoop.Data.Int("Number of panels", grid.NumPanels));
            data.Add(new Snoop.Data.Enumerable("Panels", grid.GetPanelIds(), m_activeDoc));
            data.Add(new Snoop.Data.Enumerable("Unlocked panels", grid.GetUnlockedPanelIds(), m_activeDoc));
            data.Add(new Snoop.Data.Int("Number of U lines", grid.NumULines));
            data.Add(new Snoop.Data.Enumerable("U grid lines", grid.GetUGridLineIds(), m_activeDoc));
            data.Add(new Snoop.Data.Int("Number of V lines", grid.NumVLines));
            data.Add(new Snoop.Data.Enumerable("V grid lines", grid.GetVGridLineIds(), m_activeDoc));
        }
Beispiel #3
0
        /// <summary>
        /// obtain all the properties of the curtain grid
        /// </summary>
        public void ReloadGridProperties()
        {
            if (null == m_activeGrid)
            {
                if (true == m_myDocument.WallCreated)
                {
                    m_activeGrid = m_myDocument.CurtainWall.CurtainGrid;
                }
                else
                {
                    return;
                }
            }

            // horizontal grid pattern
            Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());

            act.Start();
            switch (m_activeGrid.Grid2Justification)
            {
            case CurtainGridAlignType.Beginning:
                m_gridProperties.HorizontalJustification = CurtainGridAlign.Beginning;
                break;

            case CurtainGridAlignType.Center:
                m_gridProperties.HorizontalJustification = CurtainGridAlign.Center;
                break;

            case CurtainGridAlignType.End:
                m_gridProperties.HorizontalJustification = CurtainGridAlign.End;
                break;

            default:
                break;
            }
            m_gridProperties.HorizontalAngle       = m_activeGrid.Grid2Angle * 180.0 / Math.PI;
            m_gridProperties.HorizontalOffset      = m_activeGrid.Grid2Offset;
            m_gridProperties.HorizontalLinesNumber = m_activeGrid.NumULines;
            // vertical grid pattern
            switch (m_activeGrid.Grid1Justification)
            {
            case CurtainGridAlignType.Beginning:
                m_gridProperties.VerticalJustification = CurtainGridAlign.Beginning;
                break;

            case CurtainGridAlignType.Center:
                m_gridProperties.VerticalJustification = CurtainGridAlign.Center;
                break;

            case CurtainGridAlignType.End:
                m_gridProperties.VerticalJustification = CurtainGridAlign.End;
                break;

            default:
                break;
            }
            m_gridProperties.VerticalAngle       = m_activeGrid.Grid1Angle * 180.0 / Math.PI;
            m_gridProperties.VerticalOffset      = m_activeGrid.Grid1Offset;
            m_gridProperties.VerticalLinesNumber = m_activeGrid.NumVLines;
            // other data
            m_gridProperties.PanelNumber          = m_activeGrid.NumPanels;
            m_gridProperties.UnlockedPanelsNumber = m_activeGrid.GetUnlockedPanelIds().Count;
            m_gridProperties.CellNumber           = m_activeGrid.GetCurtainCells().Count;
            if (0 != m_activeGrid.GetMullionIds().Count)
            {
                m_gridProperties.MullionsNumber         = m_activeGrid.GetMullionIds().Count;
                m_gridProperties.UnlockedmullionsNumber = m_activeGrid.GetUnlockedMullionIds().Count;
            }
            act.Commit();
        }
Beispiel #4
0
        /// <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");
            }
        }
      Stream(ArrayList data, CurtainGrid grid)
      {
         data.Add(new Snoop.Data.ClassSeparator(typeof(CurtainGrid)));

         data.Add(new Snoop.Data.Enumerable("Curtain Cells", grid.GetCurtainCells()));
         data.Add(new Snoop.Data.Enumerable("Mullions", grid.GetMullionIds(), m_activeDoc));
         data.Add(new Snoop.Data.Enumerable("Unlocked mullions", grid.GetUnlockedMullionIds(), m_activeDoc));
         data.Add(new Snoop.Data.Angle("Grid 1 angle", grid.Grid1Angle));
         data.Add(new Snoop.Data.String("Grid 1 justification", grid.Grid1Justification.ToString()));
         data.Add(new Snoop.Data.Double("Grid 1 offset", grid.Grid1Offset));
         data.Add(new Snoop.Data.Angle("Grid 2 angle", grid.Grid2Angle));
         data.Add(new Snoop.Data.String("Grid 2 justification", grid.Grid2Justification.ToString()));
         data.Add(new Snoop.Data.Double("Grid 2 offset", grid.Grid2Offset));
         data.Add(new Snoop.Data.Int("Number of panels", grid.NumPanels));
         data.Add(new Snoop.Data.Enumerable("Panels", grid.GetPanelIds(), m_activeDoc));
         data.Add(new Snoop.Data.Enumerable("Unlocked panels", grid.GetUnlockedPanelIds(), m_activeDoc));
         data.Add(new Snoop.Data.Int("Number of U lines", grid.NumULines));
         data.Add(new Snoop.Data.Enumerable("U grid lines", grid.GetUGridLineIds(), m_activeDoc));
         data.Add(new Snoop.Data.Int("Number of V lines", grid.NumVLines));
         data.Add(new Snoop.Data.Enumerable("V grid lines", grid.GetVGridLineIds(), m_activeDoc));
      }