Example #1
0
        public static string Description(this ExplicitSection section)
        {
            if (section == null)
            {
                return("null section");
            }

            return($"Explicit A: {section.Area:G3} Iy: {section.Iy:G3} Iz: {section.Iz:G3} J: {section.J:G3} - {CheckGetMaterialName(section.Material)}");
        }
Example #2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static ISectionProperty FromRFEM(this rf.ICrossSection rfISectionProperty, rf.Material rfMaterial)
        {
            rf.CrossSection rfSectionProperty = rfISectionProperty.GetData();

            string sectionName = rfSectionProperty.Description;

            rf3.DB_CRSC_PROPERTY[] sectionDBProps = null;
            object libraryObj = null;

            if (sectionName != "")
            {
                try
                {
                    libraryObj = rfISectionProperty.GetDatabaseCrossSection();
                    rf3.IrfCrossSectionDB sectionFromDB = libraryObj as rf3.IrfCrossSectionDB;

                    int propCount = sectionFromDB.rfGetPropertyCount();
                    sectionDBProps = new rf3.DB_CRSC_PROPERTY[propCount];
                    sectionFromDB.rfGetPropertyArrAll(propCount, sectionDBProps);
                }
                catch
                {
                    Engine.Base.Compute.RecordWarning("Could not create section named " + sectionName + " from library parameters. Best guess on name will be used");
                }
            }


            IMaterialFragment materialFragment = rfMaterial.FromRFEM();
            IProfile          profile          = Engine.Adapters.RFEM.Compute.GetSectionProfile(sectionName, sectionDBProps);

            if (profile != null)
            {
                IGeometricalSection geoSection = BH.Engine.Structure.Create.SectionPropertyFromProfile(profile, materialFragment, rfSectionProperty.TextID);// this creates the right property if the right material is provided
                geoSection.SetAdapterId(typeof(RFEMId), rfSectionProperty.No);
                geoSection.Name = rfSectionProperty.TextID;

                return(geoSection);
            }
            else
            {
                ExplicitSection expSection = new ExplicitSection();
                expSection.Material = materialFragment;
                expSection.Area     = rfSectionProperty.AxialArea;
                expSection.J        = rfSectionProperty.TorsionMoment;
                expSection.Asy      = rfSectionProperty.ShearAreaY;
                expSection.Asz      = rfSectionProperty.ShearAreaZ;
                expSection.Iy       = rfSectionProperty.BendingMomentY;
                expSection.Iz       = rfSectionProperty.BendingMomentZ;
                expSection.SetAdapterId(typeof(RFEMId), rfSectionProperty.No);
                expSection.Name = rfSectionProperty.TextID;
                return(expSection);
            }
        }
Example #3
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private List <ISectionProperty> ReadSectionProperties(List <string> ids = null)
        {
            List <ISectionProperty> ISectionProperties = new List <ISectionProperty>();

            //Material defaultbhomMat = new Material();

            ISectionProperty sec2b = new ExplicitSection();

            //sec2b.Material = BH.Engine.Common.Create.Material("otherSteel", MaterialType.Steel, 210000, 0.3, 0.00012, 78500);
            sec2b.Name = "Section 2b";

            ISectionProperties.Add(sec2b);

            return(ISectionProperties);

            //throw new NotImplementedException();
        }
Example #4
0
        /***************************************************/

        public static ISectionProperty ToBHoMSection(this IBeam ramBar)
        {
            //Create BHoM SectionProperty
            ISectionProperty  sectionProperty = new ExplicitSection();
            IMaterialFragment Material        = null;

            if (ramBar.eMaterial == EMATERIALTYPES.EConcreteMat)
            {
                Material = Engine.Structure.Create.Concrete("Concrete");
            }
            else if (ramBar.eMaterial == EMATERIALTYPES.ESteelMat)
            {
                Material = Engine.Structure.Create.Steel("Steel");
            }
            else
            {
                Material = Engine.Structure.Create.Steel("Other");
            }
            sectionProperty.Material = Material;
            sectionProperty.Name     = ramBar.strSectionLabel;

            return(sectionProperty);
        }
Example #5
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);
        }
Example #6
0
        /***************************************************/

        public static string Description(this ExplicitSection section)
        {
            return("Explicit A: " + section.Area + " Iy: " + section.Iy + " Iz: " + section.Iz + " J: " + section.J + " - " + CheckGetMaterialName(section.Material));
        }
Example #7
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <ISectionProperty> ReadSectionProperties(List <string> ids = null)
        {
            List <ISectionProperty> propList = new List <ISectionProperty>();
            Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x));

            int nameCount = 0;

            string[] nameArr = { };
            m_model.PropFrame.GetNameList(ref nameCount, ref nameArr);

            ids = FilterIds(ids, nameArr);
            List <string> backLog = new List <string>();

            foreach (string id in ids)
            {
                eFramePropType   propertyType = eFramePropType.General;
                ISectionProperty bhomProperty = null;
                IProfile         bhomProfile  = null;
                SAP2000Id        sap2000id    = new SAP2000Id();

                sap2000id.Id = id;

                m_model.PropFrame.GetTypeOAPI(id, ref propertyType);

                string constructor = "standard";

                string materialName = "";
                string fileName = "";
                double t3 = 0;
                double t2 = 0;
                double tf = 0;
                double tw = 0;
                double tfb = 0;
                double t2b = 0;
                double dis = 0;
                double radius = 0;
                double angle = 0;
                int    color = 0;
                string notes = "";
                string guid = "";
                double Area, As2, As3, Torsion, I22, I33, S22, S33, Z22, Z33, R22, R33;
                Area = As2 = As3 = Torsion = I22 = I33 = S22 = S33 = Z22 = Z33 = R22 = R33 = 0;

                switch (propertyType)
                {
                case eFramePropType.I:
                    m_model.PropFrame.GetISection(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref t2b, ref tfb, ref color, ref notes, ref guid);
                    if (t2 == t2b)
                    {
                        bhomProfile = BH.Engine.Spatial.Create.ISectionProfile(t3, t2, tw, tf, 0, 0);
                    }
                    else
                    {
                        bhomProfile = BH.Engine.Spatial.Create.FabricatedISectionProfile(t3, t2, t2b, tw, tf, tfb, 0);
                    }
                    break;

                case eFramePropType.Channel:
                    m_model.PropFrame.GetChannel(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.ChannelProfile(t3, t2, tw, tf, 0, 0);
                    break;

                case eFramePropType.T:
                case eFramePropType.ConcreteTee:
                    m_model.PropFrame.GetTee(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.TSectionProfile(t3, t2, tw, tf);
                    break;

                case eFramePropType.Angle:
                case eFramePropType.Concrete_L:
                    m_model.PropFrame.GetAngle(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.AngleProfile(t3, t2, tw, tf, 0, 0);
                    break;

                case eFramePropType.DblAngle:
                    break;

                case eFramePropType.Box:
                case eFramePropType.ConcreteBox:
                    m_model.PropFrame.GetTube(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref color, ref notes, ref guid);
                    if (tf == tw)
                    {
                        bhomProfile = BH.Engine.Spatial.Create.BoxProfile(t3, t2, tf, 0, 0);
                    }
                    else
                    {
                        bhomProfile = BH.Engine.Spatial.Create.FabricatedBoxProfile(t3, t2, tw, tf, tf, 0);
                    }
                    break;

                case eFramePropType.Pipe:
                case eFramePropType.ConcretePipe:
                    m_model.PropFrame.GetPipe(id, ref fileName, ref materialName, ref t3, ref tw, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.TubeProfile(t3, tw);
                    break;

                case eFramePropType.Rectangular:
                case eFramePropType.SteelPlate:
                    m_model.PropFrame.GetRectangle(id, ref fileName, ref materialName, ref t3, ref t2, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.RectangleProfile(t3, t2, 0);
                    break;

                case eFramePropType.Auto:    //not member will have this assigned but it still exists in the propertyType list
                    bhomProfile = BH.Engine.Spatial.Create.CircleProfile(0.2);
                    break;

                case eFramePropType.Circle:
                case eFramePropType.SteelRod:
                    m_model.PropFrame.GetCircle(id, ref fileName, ref materialName, ref t3, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.CircleProfile(t3);
                    break;

                case eFramePropType.General:
                    m_model.PropFrame.GetGeneral(id, ref fileName, ref materialName, ref t3, ref t2, ref Area, ref As2, ref As3, ref Torsion, ref I22, ref I33, ref S22, ref S33, ref Z22, ref Z33, ref R22, ref R33, ref color, ref notes, ref guid);
                    constructor = "explicit";
                    break;

                case eFramePropType.Cold_Z:
                    m_model.PropFrame.GetColdZ(id, ref fileName, ref materialName, ref t3, ref t2, ref tw, ref radius, ref tfb, ref angle, ref color, ref notes, ref guid);
                    bhomProfile = BH.Engine.Spatial.Create.ZSectionProfile(t3, t2, tw, tw, radius, 0);
                    break;

                case eFramePropType.Variable:
                    if (!backLog.Contains(id))
                    {
                        //Can't read tapered sections until all other sections have been read.
                        backLog.Add(id);
                        continue;
                    }
                    break;

                case eFramePropType.DbChannel:
                case eFramePropType.SD:
                case eFramePropType.Joist:
                case eFramePropType.Bridge:
                case eFramePropType.Cold_C:
                case eFramePropType.Cold_2C:
                case eFramePropType.Cold_L:
                case eFramePropType.Cold_2L:
                case eFramePropType.Cold_Hat:
                case eFramePropType.BuiltupICoverplate:
                case eFramePropType.PCCGirderI:
                case eFramePropType.PCCGirderU:
                case eFramePropType.BuiltupIHybrid:
                case eFramePropType.BuiltupUHybrid:
                case eFramePropType.FilledTube:
                case eFramePropType.FilledPipe:
                case eFramePropType.EncasedRectangle:
                case eFramePropType.EncasedCircle:
                case eFramePropType.BucklingRestrainedBrace:
                case eFramePropType.CoreBrace_BRB:
                case eFramePropType.ConcreteCross:
                default:
                    break;
                }

                // Section Material

                IMaterialFragment material = null;
                if (!bhomMaterials.TryGetValue(materialName, out material))
                {
                    Engine.Base.Compute.RecordWarning($"Could not get material for SectionProperty {id}. A generic has been returned.");
                }

                if (bhomProfile == null)
                {
                    Engine.Base.Compute.RecordWarning("Reading sections of type " + propertyType.ToString() + " is not supported. An empty section with a default material has been returned.");
                    constructor = "explicit";
                }

                switch (constructor)
                {
                case "explicit":
                    bhomProperty = new ExplicitSection()
                    {
                        Area     = Area,
                        Asy      = As2,
                        Asz      = As3,
                        Iy       = I22,
                        Iz       = I33,
                        J        = Torsion,
                        Rgy      = R22,
                        Rgz      = R33,
                        Wply     = S22,
                        Wplz     = S33,
                        Wely     = Z22,
                        Welz     = Z33,
                        Material = material,
                        Name     = id
                    };
                    break;

                case "standard":
                    bhomProperty = BH.Engine.Structure.Create.SectionPropertyFromProfile(bhomProfile, material, id);
                    break;
                }

                // Apply Property Modifiers
                bhomProperty.Fragments.Add(ReadFrameSectionModifiers(id));

                // Apply the AdapterId
                bhomProperty.SetAdapterId(sap2000id);

                // Add to the list
                propList.Add(bhomProperty);
            }

            //Read any leftover sections (currently only tapered profiles)
            if (backLog.Count > 0)
            {
                foreach (string id in backLog)
                {
                    ISectionProperty bhomProperty = null;
                    SAP2000Id        sap2000id    = new SAP2000Id
                    {
                        Id = id
                    };

                    bhomProperty = ReadTaperedSection(id, propList);

                    bhomProperty.SetAdapterId(sap2000id);

                    bhomProperty.Fragments.Add(ReadFrameSectionModifiers(id));

                    propList.Add(bhomProperty);
                }
            }
            return(propList);
        }
Example #8
0
        /***************************************************/

        private void SetSection(ExplicitSection bhomSection)
        {
            SetGeneral(bhomSection);
        }
Example #9
0
        /***************************************************/

        private List <ISectionProperty> ReadSectionProperty(List <string> ids = null)
        {
            List <ISectionProperty> propList = new List <ISectionProperty>();
            Dictionary <String, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => x.DescriptionOrName());

            int nameCount = 0;

            string[] names = { };
            m_model.PropFrame.GetNameList(ref nameCount, ref names);

            ids = FilterIds(ids, names);

            eFramePropType propertyType = eFramePropType.General;

            List <string> backlog = new List <string>();

            do
            {
                foreach (string id in ids)
                {
                    m_model.PropFrame.GetTypeOAPI((string)id, ref propertyType);

                    ISectionProperty bhSectionProperty = null;
                    IProfile         dimensions        = null;
                    string           materialName      = "";

                    string fileName = "";
                    double t3       = 0;
                    double t2       = 0;
                    double tf       = 0;
                    double tw       = 0;
                    double twt      = 0;
                    double tfb      = 0;
                    double t2b      = 0;
                    int    colour   = 0;
                    string notes    = "";
                    string guid     = null;

                    bool verticalFlip = false;
                    bool horFlip      = false;

                    double Area, As2, As3, Torsion, I22, I33, S22, S33, Z22, Z33, R22, R33;
                    Area = As2 = As3 = Torsion = I22 = I33 = S22 = S33 = Z22 = Z33 = R22 = R33 = 0;

                    string constructSelector = "fromDimensions";

                    #region long switch on section property type
                    switch (propertyType)
                    {
                    case eFramePropType.I:
                        m_model.PropFrame.GetISection(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref t2b, ref tfb, ref colour, ref notes, ref guid);
                        if (t2 == t2b)
                        {
                            dimensions = Engine.Spatial.Create.ISectionProfile(t3, t2, tw, tf, 0, 0);
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.FabricatedISectionProfile(t3, t2, t2b, tw, tf, tfb, 0);
                        }
                        break;

                    case eFramePropType.Channel:
                        m_model.PropFrame.GetChannel(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.ChannelProfile(t3, t2, tw, tf, 0, 0);
                        break;

                    case eFramePropType.T:
                        break;

                    case eFramePropType.Angle:
                        m_model.PropFrame.GetAngle(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.AngleProfile(t3, t2, tw, tf, 0, 0);
                        break;

                    case eFramePropType.DblAngle:
                        break;

                    case eFramePropType.Box:
                        m_model.PropFrame.GetTube(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        if (tf == tw)
                        {
                            dimensions = Engine.Spatial.Create.BoxProfile(t3, t2, tf, 0, 0);
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.FabricatedBoxProfile(t3, t2, tw, tf, tf, 0);
                        }
                        break;

                    case eFramePropType.Pipe:
                        m_model.PropFrame.GetPipe(id, ref fileName, ref materialName, ref t3, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.TubeProfile(t3, tw);
                        break;

                    case eFramePropType.Rectangular:
                        m_model.PropFrame.GetRectangle(id, ref fileName, ref materialName, ref t3, ref t2, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.RectangleProfile(t3, t2, 0);
                        break;

                    case eFramePropType.Auto:    //not member will have this assigned but it still exists in the propertyType list
                        dimensions = Engine.Spatial.Create.CircleProfile(0.2);
                        break;

                    case eFramePropType.Circle:
                        m_model.PropFrame.GetCircle(id, ref fileName, ref materialName, ref t3, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.CircleProfile(t3);
                        break;

                    case eFramePropType.General:
                        constructSelector = "explicit";
                        m_model.PropFrame.GetGeneral(id, ref fileName, ref materialName, ref t3, ref t2, ref Area, ref As2, ref As3, ref Torsion, ref I22, ref I33, ref S22, ref S33, ref Z22, ref Z33, ref R22, ref R33, ref colour, ref notes, ref guid);
                        break;

                    case eFramePropType.DbChannel:
                        break;

                    case eFramePropType.SD:
                        break;

                    case eFramePropType.Variable:

                        if (!backlog.Contains(id))
                        {
                            // the sub sections need to exist to get their profiles
                            backlog.Add(id);
                            continue;
                        }
                        backlog.Remove(id);

                        int      numberItems = 0;
                        string[] startSec    = null;
                        string[] endSec      = null;
                        double[] myLength    = null;
                        int[]    myType      = null;
                        int[]    ei33        = null;
                        int[]    ei22        = null;

                        m_model.PropFrame.GetNonPrismatic(id, ref numberItems, ref startSec, ref endSec, ref myLength, ref myType, ref ei33, ref ei22, ref colour, ref notes, ref guid);

                        // Check type
                        if (myType.Any(x => x != 1))
                        {
                            Engine.Base.Compute.RecordWarning("BhoM can only pull Non-prismatic sections with relative length values.");
                            break;
                        }

                        // convert length values to relative positions between 0 and 1
                        List <double> positions = new List <double>()
                        {
                            0
                        };
                        for (int i = 0; i < myLength.Length; i++)
                        {
                            positions.Add(System.Convert.ToDouble(myLength[i]) + positions[i]);
                        }
                        double totLength = myLength.Sum();
                        positions = positions.Select(x => x / System.Convert.ToDouble(totLength)).ToList();

                        // Getting a Profile from a name in the propList
                        Func <string, IProfile> getProfile = sectionName =>
                        {
                            ISectionProperty sec = propList.First(x => x.DescriptionOrName() == sectionName);
                            if (sec is IGeometricalSection)
                            {
                                return((sec as IGeometricalSection).SectionProfile);
                            }
                            else
                            {
                                return(null);
                            }
                        };

                        // convert start/end section for each segment to a list of profiles (where each profile is both start and end for two segments)
                        List <IProfile> profiles = new List <IProfile>();
                        profiles.Add(getProfile(startSec.First()));
                        endSec.ToList().ForEach(x => profiles.Add(getProfile(x)));

                        // check that start/end section are equal
                        for (int i = numberItems - 1; i >= 1; i--)
                        {
                            if (startSec[i] != endSec[i - 1])
                            {
                                profiles.Insert(i + 1, getProfile(startSec[i]));
                                positions.Insert(i + 1, positions[i] + System.Convert.ToDouble(Tolerance.Distance));
                            }
                        }

                        // Find the material of all elements and create a singel one (or have warning)
                        foreach (string subSectionName in startSec.Concat(endSec))
                        {
                            ISectionProperty sec = propList.First(x => x.DescriptionOrName() == subSectionName);
                            if (materialName == "")
                            {
                                materialName = sec.Material.DescriptionOrName();
                            }
                            else if (materialName != sec.Material.DescriptionOrName())
                            {
                                materialName = "";
                                Engine.Base.Compute.RecordWarning("All sub-sections must have the same material.");
                                break;
                            }
                        }

                        //Etabs can only accept sections that vary linearly along it's length
                        List <int> interpolationOrder = Enumerable.Repeat(1, positions.Count - 1).ToList();

                        if (profiles.Any(x => x == null))
                        {
                            Engine.Base.Compute.RecordNote("Tapered profiles require the sub-profiles to be geometrically defined, they can not be any kind of explicit section.");
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.TaperedProfile(positions, profiles, interpolationOrder);
                        }
                        break;

                    case eFramePropType.Joist:
                        break;

                    case eFramePropType.Bridge:
                        break;

                    case eFramePropType.Cold_C:
                        break;

                    case eFramePropType.Cold_2C:
                        break;

                    case eFramePropType.Cold_Z:
                        break;

                    case eFramePropType.Cold_L:
                        break;

                    case eFramePropType.Cold_2L:
                        break;

                    case eFramePropType.Cold_Hat:
                        break;

                    case eFramePropType.BuiltupICoverplate:
                        break;

                    case eFramePropType.PCCGirderI:
                        break;

                    case eFramePropType.PCCGirderU:
                        break;

                    case eFramePropType.BuiltupIHybrid:
                        break;

                    case eFramePropType.BuiltupUHybrid:
                        break;

                    case eFramePropType.Concrete_L:
                        m_model.PropFrame.GetConcreteL(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref twt, ref horFlip, ref verticalFlip, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.AngleProfile(t3, t2, tw, tf, 0, 0, horFlip, verticalFlip);
                        break;

                    case eFramePropType.FilledTube:
                        break;

                    case eFramePropType.FilledPipe:
                        break;

                    case eFramePropType.EncasedRectangle:
                        break;

                    case eFramePropType.EncasedCircle:
                        break;

                    case eFramePropType.BucklingRestrainedBrace:
                        break;

                    case eFramePropType.CoreBrace_BRB:
                        break;

                    case eFramePropType.ConcreteTee:
                        m_model.PropFrame.GetConcreteTee(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref twt, ref verticalFlip, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.TSectionProfile(t3, t2, tw, tf, 0, 0, verticalFlip);
                        break;

                    case eFramePropType.ConcreteBox:
                        m_model.PropFrame.GetTube(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        if (tf == tw)
                        {
                            dimensions = Engine.Spatial.Create.BoxProfile(t3, t2, tf, 0, 0);
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.FabricatedBoxProfile(t3, t2, tw, tf, tf, 0);
                        }
                        break;

                    case eFramePropType.ConcretePipe:
                        m_model.PropFrame.GetPipe(id, ref fileName, ref materialName, ref t3, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.TubeProfile(t3, tw);
                        break;

                    case eFramePropType.ConcreteCross:
                        break;

                    case eFramePropType.SteelPlate:
                        m_model.PropFrame.GetPlate(id, ref fileName, ref materialName, ref t3, ref t2, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.RectangleProfile(t3, t2, 0);
                        break;

                    case eFramePropType.SteelRod:
                        m_model.PropFrame.GetRod(id, ref fileName, ref materialName, ref t3, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.CircleProfile(t3);
                        break;

                    default:
                        break;
                    }
                    if (dimensions == null)
                    {
                        Engine.Base.Compute.RecordNote(propertyType.ToString() + " properties are not implemented in ETABS adapter. An empty section has been returned.");
                        constructSelector = "explicit";
                    }
                    #endregion


                    IMaterialFragment material;

                    if (!bhomMaterials.TryGetValue(materialName, out material))
                    {
                        material = new GenericIsotropicMaterial()
                        {
                            Name = materialName
                        };
                        Engine.Base.Compute.RecordNote("Could not get material from ETABS. GenericIsotropic material with 0 values have been extracted in its place.");
                    }

                    switch (constructSelector)
                    {
                    case "fromDimensions":
                        bhSectionProperty = Engine.Structure.Create.SectionPropertyFromProfile(dimensions, material, id);
                        break;

                    case "explicit":
                        bhSectionProperty = new ExplicitSection()
                        {
                            Area = Area,
                            Asy  = As2,
                            Asz  = As3,
                            Iy   = I22,
                            Iz   = I33,
                            J    = Torsion,
                            Rgy  = R22,
                            Rgz  = R33,
                            Wply = S22,    //capacity - plastic (wply)
                            Wplz = S33,
                            Wely = Z22,    //capacity elastic
                            Welz = Z33
                        };
                        bhSectionProperty.Material = material;
                        bhSectionProperty.Name     = id;

                        break;

                    default:
                        continue;
                    }
                    SetAdapterId(bhSectionProperty, id);

                    double[] modifiers = null;
                    if (m_model.PropFrame.GetModifiers(id, ref modifiers) == 0 && modifiers != null && modifiers.Length > 6 && modifiers.Any(x => x != 1))
                    {
                        SectionModifier modifier = new SectionModifier
                        {
                            Area = modifiers[0],
                            Asz  = modifiers[1],
                            Asy  = modifiers[2],
                            J    = modifiers[3],
                            Iz   = modifiers[4],
                            Iy   = modifiers[5]
                        };
                        bhSectionProperty.Fragments.Add(modifier);
                    }

                    propList.Add(bhSectionProperty);
                }
                ids = new List <string>(backlog);
            } while (backlog.Count > 0);

            return(propList);
        }
Example #10
0
        public static ISectionProperty GetSectionProperty(cSapModel model, string propertyName, eFramePropType propertyType)
        {
            //if (modelData.sectionDict.ContainsKey(propertyName))
            //    return modelData.sectionDict[propertyName];

            ISectionProperty bhSectionProperty = null;
            IProfile         dimensions        = null;
            string           materialName      = "";

            string fileName = "";
            double t3       = 0;
            double t2       = 0;
            double tf       = 0;
            double tw       = 0;
            double twt      = 0;
            double tfb      = 0;
            double t2b      = 0;
            int    colour   = 0;
            string notes    = "";
            string guid     = "";

            bool verticalFlip = false;
            bool horFlip      = false;

            double Area, As2, As3, Torsion, I22, I33, S22, S33, Z22, Z33, R22, R33;

            Area = As2 = As3 = Torsion = I22 = I33 = S22 = S33 = Z22 = Z33 = R22 = R33 = 0;

            string constructSelector = "fromDimensions";


            #region long switch on section property type
            switch (propertyType)
            {
            case eFramePropType.I:
                model.PropFrame.GetISection(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref t2b, ref tfb, ref colour, ref notes, ref guid);
                if (t2 == t2b)
                {
                    dimensions = Engine.Geometry.Create.ISectionProfile(t3, t2, tw, tf, 0, 0);
                }
                else
                {
                    dimensions = Engine.Geometry.Create.FabricatedISectionProfile(t3, t2, t2b, tw, tf, tfb, 0);
                }
                break;

            case eFramePropType.Channel:
                model.PropFrame.GetChannel(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.ChannelProfile(t3, t2, tw, tf, 0, 0);
                break;

            case eFramePropType.T:
                break;

            case eFramePropType.Angle:
                model.PropFrame.GetAngle(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.AngleProfile(t3, t2, tw, tf, 0, 0);
                break;

            case eFramePropType.DblAngle:
                break;

            case eFramePropType.Box:
                model.PropFrame.GetTube(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                if (tf == tw)
                {
                    dimensions = Engine.Geometry.Create.BoxProfile(t3, t2, tf, 0, 0);
                }
                else
                {
                    dimensions = Engine.Geometry.Create.FabricatedBoxProfile(t3, t2, tw, tf, tf, 0);
                }
                break;

            case eFramePropType.Pipe:
                model.PropFrame.GetPipe(propertyName, ref fileName, ref materialName, ref t3, ref tw, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.TubeProfile(t3, tw);
                break;

            case eFramePropType.Rectangular:
                model.PropFrame.GetRectangle(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.RectangleProfile(t3, t2, 0);
                break;

            case eFramePropType.Auto:    //not member will have this assigned but it still exists in the propertyType list
                dimensions = Engine.Geometry.Create.CircleProfile(0.2);
                break;

            case eFramePropType.Circle:
                model.PropFrame.GetCircle(propertyName, ref fileName, ref materialName, ref t3, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.CircleProfile(t3);
                break;

            case eFramePropType.General:
                constructSelector = "explicit";
                model.PropFrame.GetGeneral(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref Area, ref As2, ref As3, ref Torsion, ref I22, ref I33, ref S22, ref S33, ref Z22, ref Z33, ref R22, ref R33, ref colour, ref notes, ref guid);
                break;

            case eFramePropType.DbChannel:
                break;

            case eFramePropType.SD:
                break;

            case eFramePropType.Variable:
                break;

            case eFramePropType.Joist:
                break;

            case eFramePropType.Bridge:
                break;

            case eFramePropType.Cold_C:
                break;

            case eFramePropType.Cold_2C:
                break;

            case eFramePropType.Cold_Z:
                break;

            case eFramePropType.Cold_L:
                break;

            case eFramePropType.Cold_2L:
                break;

            case eFramePropType.Cold_Hat:
                break;

            case eFramePropType.BuiltupICoverplate:
                break;

            case eFramePropType.PCCGirderI:
                break;

            case eFramePropType.PCCGirderU:
                break;

            case eFramePropType.BuiltupIHybrid:
                break;

            case eFramePropType.BuiltupUHybrid:
                break;

            case eFramePropType.Concrete_L:
                model.PropFrame.GetConcreteL(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref twt, ref horFlip, ref verticalFlip, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.AngleProfile(t3, t2, tw, tf, 0, 0, horFlip, verticalFlip);
                break;

            case eFramePropType.FilledTube:
                break;

            case eFramePropType.FilledPipe:
                break;

            case eFramePropType.EncasedRectangle:
                break;

            case eFramePropType.EncasedCircle:
                break;

            case eFramePropType.BucklingRestrainedBrace:
                break;

            case eFramePropType.CoreBrace_BRB:
                break;

            case eFramePropType.ConcreteTee:
                model.PropFrame.GetConcreteTee(propertyName, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref twt, ref verticalFlip, ref colour, ref notes, ref guid);
                dimensions = Engine.Geometry.Create.TSectionProfile(t2, t2, tw, tf, 0, 0, verticalFlip);
                break;

            case eFramePropType.ConcreteBox:
                break;

            case eFramePropType.ConcretePipe:
                break;

            case eFramePropType.ConcreteCross:
                break;

            case eFramePropType.SteelPlate:
                break;

            case eFramePropType.SteelRod:
                break;

            default:
                throw new NotImplementedException("Section convertion for the type: " + propertyType.ToString() + " is not implemented in ETABS adapter");
            }
            if (dimensions == null)
            {
                throw new NotImplementedException("Section convertion for the type: " + propertyType.ToString() + " is not implemented in ETABS adapter");
            }
            #endregion


            IMaterialFragment material;
            if (materialName == "")
            {
                material = Engine.Structure.Create.Steel("Steel");
            }
            else
            {
                material = GetMaterial(model, materialName);
            }


            switch (constructSelector)
            {
            case "fromDimensions":
                if (material is Steel || material is Aluminium)
                {
                    bhSectionProperty = Create.SteelSectionFromProfile(dimensions);
                }
                else if (material is Concrete)
                {
                    bhSectionProperty = Create.ConcreteSectionFromProfile(dimensions);
                }
                else
                {
                    Engine.Reflection.Compute.RecordWarning("Reading sections of material type " + material.GetType().Name + "is not supported. Section with name " + propertyName + " was not pulled");
                    return(null);
                }

                break;

            case "explicit":
                ExplicitSection eSection = new ExplicitSection();
                eSection.Area = Area;
                eSection.Asy  = As2;
                eSection.Asz  = As3;
                //eSection.CentreY = ;
                //eSection.CentreZ = ;
                //eSection.Iw = 0;//warping
                eSection.Iy   = I22;
                eSection.Iz   = I33;
                eSection.J    = Torsion;
                eSection.Rgy  = R22;
                eSection.Rgz  = R33;
                eSection.Wply = S22;    //capacity - plastic (wply)
                eSection.Wplz = S33;
                //eSection.Vpy = 0;
                //eSection.Vpz = 0;
                //eSection.Vy = 0;
                //eSection.Vz = 0;
                eSection.Wely = Z22;    //capacity elastic
                eSection.Welz = Z33;
                break;

            default:
                break;
            }

            bhSectionProperty.Material = material;
            bhSectionProperty.Name     = propertyName;
            bhSectionProperty.CustomData.Add(AdapterId, propertyName);
            //modelData.sectionDict.Add(propertyName, bhSectionProperty);

            return(bhSectionProperty);
        }
Example #11
0
 private static void SetSpecificSection(ExplicitSection section, cSapModel model)
 {
     model.PropFrame.SetGeneral(section.Name, section.Material.Name, section.CentreZ * 2, section.CentreY * 2, section.Area, section.Asy, section.Asz, section.J, section.Iy, section.Iz, section.Wply, section.Wplz, section.Wely, section.Wely, section.Rgy, section.Rgz);
 }
Example #12
0
        /***************************************************/

        private void SetSection(ExplicitSection section)
        {
            SetGeneral(section);
        }
Example #13
0
        /***************************************************/

        private IFAttribute CreateSection(ExplicitSection sectionProperty)
        {
            Engine.Base.Compute.RecordError("ExplicitSection is not supported in Lusas_Toolkit.");
            return(null);
        }
Example #14
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <Bar> ReadBars(List <string> ids = null)
        {
            List <Bar> bhomBars = new List <Bar>();
            Dictionary <string, Node>             bhomNodes    = ReadNodes().ToDictionary(x => GetAdapterId <string>(x));
            Dictionary <string, ISectionProperty> bhomSections = ReadSectionProperties().ToDictionary(x => GetAdapterId <string>(x));

            int nameCount = 0;

            string[] nameArr = { };
            m_model.FrameObj.GetNameList(ref nameCount, ref nameArr);

            ids = FilterIds(ids, nameArr);

            foreach (string id in ids)
            {
                SAP2000Id sap2000id = new SAP2000Id();
                sap2000id.Id = id;

                try
                {
                    Bar    bhomBar = new Bar();
                    string startId = "";
                    string endId   = "";
                    m_model.FrameObj.GetPoints(id, ref startId, ref endId);

                    bhomBar.StartNode = bhomNodes[startId];
                    bhomBar.EndNode   = bhomNodes[endId];

                    bool[]   restraintStart = new bool[6];
                    double[] springStart    = new double[6];
                    bool[]   restraintEnd   = new bool[6];
                    double[] springEnd      = new double[6];

                    m_model.FrameObj.GetReleases(id, ref restraintStart, ref restraintEnd, ref springStart, ref springEnd);
                    bhomBar.Release = Adapter.SAP2000.Convert.GetBarRelease(restraintStart, springStart, restraintEnd, springEnd);

                    //bhomBar.Release.StartRelease = Adapter.SAP2000.Convert.GetConstraint6DOF(restraintStart, springStart);
                    //bhomBar.Release.EndRelease = Adapter.SAP2000.Convert.GetConstraint6DOF(restraintEnd, springEnd);

                    string propertyName = "";
                    string sAuto        = ""; //This is the name of the auto select list assigned to the frame object, if any.

                    if (m_model.FrameObj.GetSection(id, ref propertyName, ref sAuto) == 0)
                    {
                        ISectionProperty bhProp = new ExplicitSection();
                        bhomSections.TryGetValue(propertyName, out bhProp);
                        bhomBar.SectionProperty = bhProp;
                    }

                    double angle    = 0;
                    bool   advanced = false;

                    if (m_model.FrameObj.GetLocalAxes(id, ref angle, ref advanced) == 0)
                    {
                        if (advanced)
                        {
                            Engine.Base.Compute.RecordWarning("Advanced local axes are not yet supported by this toolkit. Bar " + id + " has been created with orientation angle = 0");
                            angle = 0;
                        }
                        bhomBar.OrientationAngle = angle * System.Math.PI / 180;
                    }
                    else
                    {
                        Engine.Base.Compute.RecordWarning("Could not get local axes for bar " + id + ". Orientation angle is 0 by default");
                    }

                    // Get the groups the bar is assigned to
                    string   guid       = null;
                    int      numGroups  = 0;
                    string[] groupNames = new string[0];
                    if (m_model.FrameObj.GetGroupAssign(id, ref numGroups, ref groupNames) == 0)
                    {
                        foreach (string grpName in groupNames)
                        {
                            bhomBar.Tags.Add(grpName);
                        }
                    }

                    if (m_model.FrameObj.GetGUID(id, ref guid) == 0)
                    {
                        sap2000id.PersistentId = guid;
                    }

                    bhomBar.SetAdapterId(sap2000id);

                    /***************************************************/
                    /* SAP Fragments                                   */
                    /***************************************************/

                    // Automesh

                    bool   autoMesh          = false;
                    bool   autoMeshAtPoints  = false;
                    bool   autoMeshAtLines   = false;
                    int    numSegs           = 0;
                    double autoMeshMaxLength = 0.0;

                    m_model.FrameObj.GetAutoMesh(id, ref autoMesh, ref autoMeshAtPoints, ref autoMeshAtLines, ref numSegs, ref autoMeshMaxLength);
                    if (autoMesh)
                    {
                        bhomBar = bhomBar.SetBarAutoMesh(autoMesh, autoMeshAtPoints, autoMeshAtLines, numSegs, autoMeshMaxLength);
                    }

                    // Design Procedure

                    int designProcedure = (int)BarDesignProcedureType.NoDesign;

                    if (m_model.FrameObj.GetDesignProcedure(id, ref designProcedure) == 0)
                    {
                        BarDesignProcedureType designProcedureType = (BarDesignProcedureType)designProcedure;
                        bhomBar = bhomBar.SetBarDesignProcedure(designProcedureType);
                    }

                    // Insertion Point Offset
                    // Need to add more information to capture coordinate system?? GetCoordSys method and transform local csys
                    int  insertionPoint  = (int)BarInsertionPointLocation.Centroid;
                    bool mirror          = false;
                    bool modifyStiffness = false;

                    double[] offset1 = new double[3];
                    double[] offset2 = new double[3];
                    string   cSys    = "";

                    if (m_model.FrameObj.GetInsertionPoint(id, ref insertionPoint, ref mirror, ref modifyStiffness, ref offset1, ref offset2, ref cSys) == 0)
                    {
                        BarInsertionPointLocation barInsertionPoint = (BarInsertionPointLocation)insertionPoint;
                        bhomBar = bhomBar.SetBarInsertionPoint(barInsertionPoint, modifyStiffness);
                    }
                    bhomBars.Add(bhomBar);
                }

                catch
                {
                    ReadElementError("Bar", id.ToString());
                }
            }
            return(bhomBars);
        }