コード例 #1
0
        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);
        }
コード例 #2
0
        public void RandDeteleVertGrids(Document doc, Wall curtainWall, int probabilityVert, double vertCounterMax)
        {
            CurtainGrid             grid      = curtainWall.CurtainGrid;
            ICollection <ElementId> vertGrids = grid.GetVGridLineIds();
            List <int> removalCounters        = null;

            foreach (ElementId eIdV in vertGrids)
            {
                CurtainGridLine cglV = (CurtainGridLine)doc.GetElement(eIdV);
                Debug("CW Grid ID" + cglV.Id);
                List <Curve> curvesV = cglV.AllSegmentCurves.Cast <Curve>().ToList();

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

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

                    if (randNumber < probabilityVert && removalCounters[i] < vertCounterMax)
                    {
                        Debug("removal counters value" + removalCounters[i]);
                        cglV.RemoveSegment(cV);
                        removalCounters[i]++;
                        Debug("Deleted Vert Seg " + i);
                        Debug("Vert randNumber " + randNumber);
                        Debug("curve list length" + curvesV.Count);
                    }

                    else
                    {
                        removalCounters[i] = 0;
                        Debug("Did not delete Vert Seg " + i);
                        Debug("Vert randNumber " + randNumber);
                    }
                }
                Debug("CW Grid ID after" + cglV.Id);
            }
        }
コード例 #3
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));
        }
コード例 #4
0
        /// <summary>
        /// get all the V grid lines' data of the curtain grid
        /// </summary>
        private void GetVLines()
        {
            m_vGridLines.Clear();
            Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());

            act.Start();
            //ElementSet vLines = m_activeGrid.VGridLines;
            ICollection <ElementId> vLines = m_activeGrid.GetVGridLineIds();

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

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

                m_vGridLines.Add(line);
            }
        }
コード例 #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));
      }