public Wall DeteleAllGrids(Document doc, Wall curtainWall)
        {
            CurtainGrid grid = curtainWall.CurtainGrid;

            ICollection <ElementId> horizGrids = grid.GetUGridLineIds();
            ICollection <ElementId> vertGrids  = grid.GetVGridLineIds();

            foreach (ElementId eIdH in horizGrids)
            {
                Debug("Horiz Grid ID " + eIdH);
                CurtainGridLine cglH             = (CurtainGridLine)doc.GetElement(eIdH);
                Parameter       typeAssociationH = cglH.GetParameters("Type Association").FirstOrDefault();
                Debug($"Horiz Type Association {typeAssociationH?.AsValueString()}");
                Debug("Horiz Lock " + cglH.Lock);

                if (typeAssociationH?.AsInteger() == 1)
                {
                    typeAssociationH.Set(0);
                    Debug("Horiz Type Association Reset " + (typeAssociationH?.AsValueString() ?? "null"));
                    Debug("Horiz Type Association Element Id " + typeAssociationH.AsElementId());
                }

                if (cglH.Lock)
                {
                    cglH.Lock = false;
                    Debug("Horiz Lock Reset " + cglH.Lock);
                }

                doc.Delete(eIdH);
            }

            //deletes all vert grids
            foreach (ElementId eIdV in vertGrids)
            {
                Debug("Vert Grid ID " + eIdV);
                CurtainGridLine cglV             = (CurtainGridLine)doc.GetElement(eIdV);
                Parameter       typeAssociationV = cglV.GetParameters("Type Association").FirstOrDefault();
                Debug("Vert Type Association " + (typeAssociationV?.AsValueString() ?? "null"));
                Debug("Vert Lock " + cglV.Lock);

                if (typeAssociationV?.AsInteger() == 1)
                {
                    typeAssociationV.Set(0);
                    Debug("Vert Type Association Reset " + (typeAssociationV?.AsValueString() ?? "null"));
                    Debug("Vert Type Association Element Id " + typeAssociationV.AsElementId());
                }

                if (cglV.Lock)
                {
                    cglV.Lock = false;
                    Debug("Vert Lock Reset " + cglV.Lock);
                }

                doc.Delete(eIdV);
            }

            return(curtainWall);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        /// <summary>
        /// get all the U grid lines' data of the curtain grid
        /// </summary>
        private void GetULines()
        {
            m_uGridLines.Clear();
            Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());

            act.Start();
            //ElementSet uLines = m_activeGrid.UGridLines;
            ICollection <ElementId> uLines = m_activeGrid.GetUGridLineIds();

            act.Commit();
            if (0 == uLines.Count)
            {
                return;
            }

            foreach (ElementId e in uLines)
            {
                CurtainGridLine line = m_activeDocument.GetElement(e) as CurtainGridLine;

                m_uGridLines.Add(line);
            }
        }
        public void RandDeteleHorizGrids(Document doc, Wall curtainWall, int porbabilityHoriz, double horizCounterMax)
        {
            CurtainGrid             grid       = curtainWall.CurtainGrid;
            ICollection <ElementId> horizGrids = grid.GetUGridLineIds();
            List <int> removalCounters         = null;

            foreach (ElementId eIdH in horizGrids)
            {
                CurtainGridLine cglH = (CurtainGridLine)doc.GetElement(eIdH);
                Debug("CW Grid ID" + cglH.Id);
                List <Curve> curvesH = cglH.AllSegmentCurves.Cast <Curve>().ToList();

                if (removalCounters == null)
                {
                    removalCounters = curvesH.Select(g => 0).ToList();
                }

                for (int i = 0; i < curvesH.Count; i++)
                {
                    Curve cH         = curvesH[i];
                    int   randNumber = rand.Next(0, 99);

                    if (randNumber < porbabilityHoriz && removalCounters[i] < horizCounterMax)
                    {
                        cglH.RemoveSegment(cH);
                        removalCounters[i]++;
                        Debug("Deleted Horiz Seg " + i);
                        Debug("Horiz randNumber " + randNumber);
                    }
                    else
                    {
                        removalCounters[i] = 0;
                        Debug("Did not delete Horiz Seg " + i);
                        Debug("Horiz randNumber " + randNumber);
                    }
                }
                Debug("CW Grid ID after" + cglH.Id);
            }
        }
Exemplo n.º 5
0
      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));
      }