Exemple #1
0
        /***************************************************/

        public static UniformLoadSet ToBHoMObject(this ISurfaceLoadPropertySet ramSrfLoadPropSet)
        {
            RAMLiveLoadTypes liveType = RAMLiveLoadTypes.LiveUnReducibleLCa;

            if (ramSrfLoadPropSet.eLiveLoadType != ELoadCaseType.DeadLCa)
            {
                liveType = ramSrfLoadPropSet.eLiveLoadType.ToBHoM();
            }
            else
            {
                Engine.Base.Compute.RecordWarning($"Live Load type for load set {ramSrfLoadPropSet.strLabel} was set as Dead. This usually means that no live load is applied in RAM; check results.");
            }

            UniformLoadSet uniformLoadSet = Engine.Adapters.RAM.Create.RAMUniformLoadSet(
                ramSrfLoadPropSet.dDeadLoad.FromKilopoundForcePerSquareInch(),
                ramSrfLoadPropSet.dConstDeadLoad.FromKilopoundForcePerSquareInch(),
                ramSrfLoadPropSet.dConstLiveLoad.FromKilopoundForcePerSquareInch(),
                liveType,
                ramSrfLoadPropSet.dPartitionLoad.FromKilopoundForcePerSquareInch(),
                ramSrfLoadPropSet.dConstLiveLoad.FromKilopoundForcePerSquareInch(),
                ramSrfLoadPropSet.dMassDeadLoad.FromKilopoundForcePerSquareInch(),
                ramSrfLoadPropSet.strLabel
                );

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

            RAMId.Id = ramSrfLoadPropSet.lUID;
            uniformLoadSet.SetAdapterId(RAMId);

            return(uniformLoadSet);
        }
Exemple #2
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private bool CreateCollection(IEnumerable <UniformLoadSet> loadSets)
        {
            foreach (UniformLoadSet loadSet in loadSets)
            {
                try
                {
                    ISurfaceLoadPropertySets ramSurfaceLoadPropertySets = m_Model.GetSurfaceLoadPropertySets();

                    int existingLoadPropSetID = 0;

                    //Check if load set already exists
                    for (int i = 0; i < ramSurfaceLoadPropertySets.GetCount(); i++)
                    {
                        ISurfaceLoadPropertySet ramPropSet = ramSurfaceLoadPropertySets.GetAt(i);
                        if (ramPropSet.strLabel == loadSet.Name)
                        {
                            existingLoadPropSetID = ramPropSet.lUID;
                        }
                    }

                    if (existingLoadPropSetID == 0)
                    {
                        //Add the loadset if it does not already exist
                        ISurfaceLoadPropertySet ramLoadSet = ramSurfaceLoadPropertySets.Add(loadSet.Name);

                        int liveCount = 0;

                        foreach (UniformLoadSetRecord loadRecord in loadSet.Loads)
                        {
                            switch (loadRecord.Name)
                            {
                            case "ConstructionDeadLCa":
                                ramLoadSet.dConstDeadLoad = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                break;

                            case "ConstructionLiveLCa":
                                ramLoadSet.dConstLiveLoad = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                break;

                            case "DeadLCa":
                                ramLoadSet.dDeadLoad = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                break;

                            case "MassDeadLCa":
                                ramLoadSet.dMassDeadLoad = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                break;

                            case "PartitionLCa":
                                ramLoadSet.dPartitionLoad = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                break;

                            case "LiveLCa":
                                ramLoadSet.eLiveLoadType = ELoadCaseType.LiveReducibleLCa;
                                ramLoadSet.dLiveLoad     = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                liveCount++;
                                break;

                            case "LiveStorageLCa":
                                ramLoadSet.eLiveLoadType = ELoadCaseType.LiveStorageLCa;
                                ramLoadSet.dLiveLoad     = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                liveCount++;
                                break;

                            case "LiveUnReducibleLCa":
                                ramLoadSet.eLiveLoadType = ELoadCaseType.LiveUnReducibleLCa;
                                ramLoadSet.dLiveLoad     = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                liveCount++;
                                break;

                            case "LiveRoofLCa":
                                ramLoadSet.eLiveLoadType = ELoadCaseType.LiveRoofLCa;
                                ramLoadSet.dLiveLoad     = loadRecord.Load.ToKilopoundForcePerSquareInch();
                                liveCount++;
                                break;

                            default:
                                Engine.Base.Compute.RecordWarning($"the record {loadRecord.Name} in {loadSet.Name} was not recognized. Create your UniformLoadSet using CreateRAMUniformLoadSet() in the RAM toolkit!");
                                break;
                            }
                        }
                        ;

                        if (liveCount > 1)
                        {
                            Engine.Base.Compute.RecordWarning("More than one live load has been set; only the last one will be applied");
                        }

                        //Set the custom data to return if created
                        RAMId RAMId = new RAMId();
                        RAMId.Id = ramLoadSet.lUID;
                        loadSet.SetAdapterId(RAMId);
                    }
                    else
                    {
                        //Set the custom data to return if already existing
                        RAMId RAMId = new RAMId();
                        RAMId.Id = existingLoadPropSetID;
                        loadSet.SetAdapterId(RAMId);
                    }
                }
                catch
                {
                    CreateElementError("UniformLoadSet", loadSet.Name);
                }
            }

            //Save file
            m_IDBIO.SaveDatabase();

            return(true);
        }