Exemple #1
0
        public static SpeckleObject ToSpeckle(this GSAGridLineLoad dummyObject)
        {
            var newLines = ToSpeckleBase <GSAGridLineLoad>();
            var loads    = new List <GSAGridLineLoad>();
            var keyword  = dummyObject.GetGSAKeyword();

            foreach (var k in newLines.Keys)
            {
                var p    = newLines[k];
                var load = new GSAGridLineLoad()
                {
                    GWACommand = p
                };
                try
                {
                    load.ParseGWACommand();
                }
                catch (Exception ex)
                {
                    Initialiser.AppResources.Messenger.Message(MessageIntent.TechnicalLog, MessageLevel.Error, ex,
                                                               "Keyword=" + keyword, "Index=" + k);
                }

                // Break them apart
                for (var i = 0; i < load.Value.Value.Count - 3; i += 3)
                {
                    var actualLoad = new GSAGridLineLoad()
                    {
                        GWACommand = load.GWACommand,
                        Value      = new Structural1DLoadLine()
                        {
                            Name        = load.Value.Name,
                            Value       = (load.Value.Value as List <double>).Skip(i).Take(6).ToList(),
                            Loading     = load.Value.Loading,
                            LoadCaseRef = load.Value.LoadCaseRef
                        }
                    };

                    loads.Add(actualLoad);
                }
            }

            if (loads.Count() > 0)
            {
                Initialiser.GsaKit.GSASenderObjects.AddRange(loads);
            }

            return((loads.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }
Exemple #2
0
        public static SpeckleObject ToSpeckle(this GSAGridLineLoad dummyObject)
        {
            var newLines = ToSpeckleBase <GSAGridLineLoad>();

            var loads = new List <GSAGridLineLoad>();

            foreach (var p in newLines.Values)
            {
                var load = new GSAGridLineLoad()
                {
                    GWACommand = p
                };
                load.ParseGWACommand();

                // Break them apart
                for (var i = 0; i < load.Value.Value.Count - 3; i += 3)
                {
                    var actualLoad = new GSAGridLineLoad()
                    {
                        GWACommand    = load.GWACommand,
                        SubGWACommand = new List <string>(load.SubGWACommand.ToArray()),
                        Value         = new Structural1DLoadLine()
                        {
                            Name        = load.Value.Name,
                            Value       = (load.Value.Value as List <double>).Skip(i).Take(6).ToList(),
                            Loading     = load.Value.Loading,
                            LoadCaseRef = load.Value.LoadCaseRef
                        }
                    };

                    loads.Add(actualLoad);
                }
            }

            Initialiser.GSASenderObjects.AddRange(loads);

            return((loads.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }