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

        public static Bar ToBHoMObject(IHorizBrace ramHorizBrace, ILayoutHorizBrace ramLayoutHorizBrace, double dElevation)
        {
            string sectionName = ramHorizBrace.strSectionLabel;

            ISectionProperty sectionProperty = ToBHoMSection(ramHorizBrace);

            // Get the start and end pts of every brace
            double StartSupportX       = new double();
            double StartSupportY       = new double();
            double StartSupportZOffset = new double();
            double EndSupportX         = new double();
            double EndSupportY         = new double();
            double EndSupportZOffset   = new double();
            double StoryZ = dElevation;


            // Get coordinates from ILayout Brace
            ramLayoutHorizBrace.GetLayoutCoordinates(out StartSupportX, out StartSupportY, out StartSupportZOffset, out EndSupportX, out EndSupportY, out EndSupportZOffset);
            Node startNode = new Node {
                Position = new oM.Geometry.Point()
                {
                    X = StartSupportX.FromInch(), Y = StartSupportY.FromInch(), Z = StoryZ.FromInch() + StartSupportZOffset.FromInch()
                }
            };
            Node endNode = new Node {
                Position = new oM.Geometry.Point()
                {
                    X = EndSupportX.FromInch(), Y = EndSupportY.FromInch(), Z = StoryZ.FromInch() + EndSupportZOffset.FromInch()
                }
            };

            Bar bhomBar = new Bar {
                StartNode = startNode, EndNode = endNode, SectionProperty = sectionProperty, Name = sectionName
            };

            bhomBar.OrientationAngle = 0;

            // Unique RAM ID
            RAMId RAMId = new RAMId();

            RAMId.Id = ramLayoutHorizBrace.lUID;
            bhomBar.SetAdapterId(RAMId);

            //Add Frame Data fragment
            RAMFrameData ramFrameData = new RAMFrameData();

            ramFrameData.FrameNumber = ramLayoutHorizBrace.lLabel;
            ramFrameData.Material    = ramLayoutHorizBrace.eMaterial.ToString();
            bhomBar.Fragments.Add(ramFrameData);

            bhomBar.Tags.Add("HorizontalBrace");

            return(bhomBar);
        }
Ejemplo n.º 2
0
        /***************************************************/

        public static ISectionProperty ToBHoMSection(this IHorizBrace ramBar)
        {
            //Create BHoM SectionProperty
            ISectionProperty sectionProperty = new ExplicitSection();

            IMaterialFragment Material = null;

            if (ramBar.eMaterial == EMATERIALTYPES.EConcreteMat)
            {
                Material = Engine.Structure.Create.Concrete("Concrete");
                //sectionProperty = Create.ConcreteRectangleSection(IBeam.dWebDepth, IBeam.dFlangeWidthTop, Material, sectionName);
            }
            else if (ramBar.eMaterial == EMATERIALTYPES.ESteelMat)
            {
                Material = Engine.Structure.Create.Steel("Steel");
                //sectionProperty = Create.SteelRectangleSection(IBeam.dWebDepth, IBeam.dFlangeWidthTop, 0,Material,sectionName);
            }

            sectionProperty.Material = Material;
            sectionProperty.Name     = ramBar.strSectionLabel;

            return(sectionProperty);
        }
Ejemplo n.º 3
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);
        }