Ejemplo n.º 1
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private List <Bar> ReadBars(List <string> ids = null)
        {
            //Implement code for reading bars
            List <Bar> bhomBars = new List <Bar>();

            // Get stories
            IStories IStories   = m_Model.GetStories();
            int      numStories = IStories.GetCount();

            // Get all elements on each story
            for (int i = 0; i < numStories; i++)
            {
                //Get Columns
                IColumns IColumns   = IStories.GetAt(i).GetColumns();
                int      numColumns = IColumns.GetCount();

                //Get Beams
                IFloorType   IFloorType     = IStories.GetAt(i).GetFloorType();
                ILayoutBeams ILayoutBeams   = IFloorType.GetLayoutBeams();
                IBeams       IBeams         = IStories.GetAt(i).GetBeams();
                int          numLayoutBeams = ILayoutBeams.GetCount();
                int          numBeams       = IBeams.GetCount();

                //Get Vertical Braces
                IVerticalBraces IVBraces   = IStories.GetAt(i).GetVerticalBraces();
                int             numVBraces = IVBraces.GetCount();

                //Get Horizontal Braces
                ILayoutHorizBraces ILayoutHorizBraces = IStories.GetAt(i).GetFloorType().GetLayoutHorizBraces();
                IHorizBraces       IHorizBraces       = IStories.GetAt(i).GetHorizBraces();
                int numHBraces = ILayoutHorizBraces.GetCount();

                //Get Elevation
                double dElevation = IStories.GetAt(i).dElevation;

                // Convert Columns
                for (int j = 0; j < numColumns; j++)
                {
                    IColumn      IColumn      = IColumns.GetAt(j);
                    Bar          bhomBar      = BH.Adapter.RAM.Convert.ToBHoMObject(IColumn);
                    RAMFrameData ramFrameData = bhomBar.FindFragment <RAMFrameData>(typeof(RAMFrameData));
                    if (ramFrameData != null)
                    {
                        ramFrameData.FloorType = IFloorType.strLabel;
                        bhomBar.Fragments.AddOrReplace(ramFrameData);
                    }
                    bhomBars.Add(bhomBar);
                }

                // Convert Beams
                for (int j = 0; j < numBeams; j++)
                {
                    IBeam        IBeam        = IBeams.GetAt(j);
                    ILayoutBeam  ILayoutBeam  = ILayoutBeams.GetAt(j);
                    Bar          bhomBar      = BH.Adapter.RAM.Convert.ToBHoMObject(IBeam, ILayoutBeam, dElevation);
                    RAMFrameData ramFrameData = bhomBar.FindFragment <RAMFrameData>(typeof(RAMFrameData));
                    if (ramFrameData != null)
                    {
                        ramFrameData.FloorType = IFloorType.strLabel;
                        bhomBar.Fragments.AddOrReplace(ramFrameData);
                    }
                    bhomBars.Add(bhomBar);
                }

                // Convert Vertical Braces
                for (int j = 0; j < numVBraces; j++)
                {
                    IVerticalBrace IVerticalBrace = IVBraces.GetAt(j);
                    Bar            bhomBar        = BH.Adapter.RAM.Convert.ToBHoMObject(IVerticalBrace);
                    RAMFrameData   ramFrameData   = bhomBar.FindFragment <RAMFrameData>(typeof(RAMFrameData));
                    if (ramFrameData != null)
                    {
                        ramFrameData.FloorType = IFloorType.strLabel;
                        bhomBar.Fragments.AddOrReplace(ramFrameData);
                    }
                    bhomBars.Add(bhomBar);
                }

                // Convert Horizontal Braces
                for (int j = 0; j < numHBraces; j++)
                {
                    IHorizBrace       IHorizBrace       = IHorizBraces.GetAt(j);
                    ILayoutHorizBrace ILayoutHorizBrace = ILayoutHorizBraces.GetAt(j);
                    Bar          bhomBar      = BH.Adapter.RAM.Convert.ToBHoMObject(IHorizBrace, ILayoutHorizBrace, dElevation);
                    RAMFrameData ramFrameData = bhomBar.FindFragment <RAMFrameData>(typeof(RAMFrameData));
                    if (ramFrameData != null)
                    {
                        ramFrameData.FloorType = IFloorType.strLabel;
                        bhomBar.Fragments.AddOrReplace(ramFrameData);
                    }
                    bhomBars.Add(bhomBar);
                }
            }

            return(bhomBars);
        }