コード例 #1
0
 public static string ToNative(this Structural2DThermalLoad load)
 {
     return(new GSA2DThermalLoading()
     {
         Value = load
     }.SetGWACommand());
 }
コード例 #2
0
 public static string ToNative(this Structural2DThermalLoad load)
 {
     return(SchemaConversion.Helper.ToNativeTryCatch(load, () => new GSA2DThermalLoading()
     {
         Value = load
     }.SetGWACommand()));
 }
コード例 #3
0
        public void ParseGWACommand(List <GSA2DElement> e2Ds, List <GSA2DMember> m2Ds)
        {
            if (this.GWACommand == null)
            {
                return;
            }

            var obj = new Structural2DThermalLoad();

            var pieces = this.GWACommand.ListSplit("\t");

            var counter = 1; // Skip identifier

            obj.Name          = pieces[counter++];
            obj.ApplicationId = HelperClass.GetApplicationId(this.GetGSAKeyword(), this.GSAId);

            var elementList = pieces[counter++];

            obj.ElementRefs = new List <string>();

            if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis)
            {
                var elementId = Initialiser.Interface.ConvertGSAList(elementList, SpeckleGSAInterfaces.GSAEntity.ELEMENT);
                foreach (var id in elementId)
                {
                    IGSASpeckleContainer elem = e2Ds.Where(e => e.GSAId == id).FirstOrDefault();

                    if (elem == null)
                    {
                        continue;
                    }

                    obj.ElementRefs.Add((elem.Value as SpeckleObject).ApplicationId);
                    this.SubGWACommand.Add(elem.GWACommand);
                }
            }
            else
            {
                var groupIds = HelperClass.GetGroupsFromGSAList(elementList).ToList();
                foreach (var id in groupIds)
                {
                    var memb2Ds = m2Ds.Where(m => m.Group == id);

                    obj.ElementRefs.AddRange(memb2Ds.Select(m => (string)m.Value.ApplicationId));
                    this.SubGWACommand.AddRange(memb2Ds.Select(m => m.GWACommand));
                }
            }

            obj.LoadCaseRef = HelperClass.GetApplicationId(typeof(GSALoadCase).GetGSAKeyword(), Convert.ToInt32(pieces[counter++]));

            var loadingType = pieces[counter++];

            switch (loadingType)
            {
            case "CONS":
                obj.TopTemperature    = Convert.ToDouble(pieces[counter++]);
                obj.BottomTemperature = obj.TopTemperature;
                break;

            case "DZ":
                obj.TopTemperature    = Convert.ToDouble(pieces[counter++]);
                obj.BottomTemperature = Convert.ToDouble(pieces[counter++]);
                break;

            case "GEN":
                // GENERALIZE THIS TO AN AVERAGE
                for (var i = 0; i < 3; i++)
                {
                    obj.TopTemperature    += Convert.ToDouble(pieces[counter++]);
                    obj.BottomTemperature += Convert.ToDouble(pieces[counter++]);
                }
                obj.TopTemperature    /= 4;
                obj.BottomTemperature /= 4;
                break;
            }

            this.Value = obj;
        }