GraphicsStreamElementXform()
        {
            if (m_revitApp.ActiveUIDocument.Selection.GetElementIds().Count == 0) {
                MessageBox.Show("Please select elements and re-run test.", "No Elements Selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            GraphicsStreamRevit grStream = new GraphicsStreamRevit(m_revitApp);
            grStream.PushView(m_revitApp.ActiveUIDocument.Document.ActiveView);

            Options opts = m_revitApp.Application.Create.NewGeometryOptions();
            opts.ComputeReferences = true;
            opts.View = m_revitApp.ActiveUIDocument.Document.ActiveView;
            grStream.PushGeometryOptions(opts);

                // transform everything by 50 in both the X and Y axes
            Transform xform = new Transform(Transform.Identity);
            xform.Origin = new XYZ(50.0, 50.0, 0.0);
            grStream.PushXform(xform);
            var selElementIds = m_revitApp.ActiveUIDocument.Selection.GetElementIds();
           
            Document dbDoc = m_revitApp.ActiveUIDocument.Document;
            foreach (ElementId elemId in selElementIds) {
                grStream.Stream(dbDoc.GetElement(elemId));
            }
        }
        public void CurtainSystemToWireframe()
        {
            if (m_revitApp.ActiveUIDocument.Selection.GetElementIds().Count == 0)
            {
                MessageBox.Show("Please select elements and re-run test.", "No Elements Selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            GraphicsStreamRevit grStream = new GraphicsStreamRevit(m_revitApp);
            grStream.PushView(m_revitApp.ActiveUIDocument.Document.ActiveView);

            Options opts = m_revitApp.Application.Create.NewGeometryOptions();
            opts.ComputeReferences = true;
            opts.View = m_revitApp.ActiveUIDocument.Document.ActiveView;
            grStream.PushGeometryOptions(opts);

            // transform everything by 50 in both the X and Y axes
            Transform xform = new Transform(Transform.Identity);
            xform.Origin = new XYZ(50.0, 50.0, 0.0);
            grStream.PushXform(xform);
            Document dbDoc = m_revitApp.ActiveUIDocument.Document;
            var selElementIds = m_revitApp.ActiveUIDocument.Selection.GetElementIds();
            foreach (ElementId elemId in selElementIds)
            {
               Element elem = dbDoc.GetElement(elemId);
                if (elem is Wall) {
                    Wall wall = elem as Wall;

                    if (wall.WallType.Kind == WallKind.Curtain) {
                        WriteCurtainCells(wall.CurtainGrid, grStream); // call same function for each
                    }
                }
                else if (elem is ExtrusionRoof) {
                    ExtrusionRoof roof = elem as ExtrusionRoof;

                    foreach (CurtainGrid grid in roof.CurtainGrids) {
                        WriteCurtainCells(grid, grStream);
                    }
                }
                else if (elem is CurtainSystem) {
                    CurtainSystem curtSys = elem as CurtainSystem;

                    foreach (CurtainGrid grid in curtSys.CurtainGrids) {
                        WriteCurtainCells(grid, grStream);
                    }
                }
            }
        }