public static SpeckleObject ToSpeckle(this GSANodeResult dummyObject)
        {
            if (Initialiser.Settings.NodalResults.Count() == 0)
            {
                return(new SpeckleNull());
            }

            if (Initialiser.Settings.EmbedResults && !Initialiser.GSASenderObjects.ContainsKey(typeof(GSANode)))
            {
                return(new SpeckleNull());
            }

            if (Initialiser.Settings.EmbedResults)
            {
                var nodes = Initialiser.GSASenderObjects[typeof(GSANode)].Cast <GSANode>().ToList();

                foreach (var kvp in Initialiser.Settings.NodalResults)
                {
                    foreach (var loadCase in Initialiser.Settings.ResultCases)
                    {
                        if (!Initialiser.Interface.CaseExist(loadCase))
                        {
                            continue;
                        }

                        foreach (var node in nodes)
                        {
                            var id = node.GSAId;

                            if (node.Value.Result == null)
                            {
                                node.Value.Result = new Dictionary <string, object>();
                            }

                            var resultExport = Initialiser.Interface.GetGSAResult(id, kvp.Value.Item1, kvp.Value.Item2, kvp.Value.Item3, loadCase, Initialiser.Settings.ResultInLocalAxis ? "local" : "global");

                            if (resultExport == null || resultExport.Count() == 0)
                            {
                                continue;
                            }

                            if (!node.Value.Result.ContainsKey(loadCase))
                            {
                                node.Value.Result[loadCase] = new StructuralNodeResult()
                                {
                                    Value = new Dictionary <string, object>()
                                };
                            }
                            (node.Value.Result[loadCase] as StructuralNodeResult).Value[kvp.Key] = resultExport.ToDictionary(x => x.Key, x => (x.Value as List <double>)[0] as object);

                            node.ForceSend = true;
                        }
                    }
                }
            }
            else
            {
                Initialiser.GSASenderObjects[typeof(GSANodeResult)] = new List <object>();

                var results = new List <GSANodeResult>();

                var keyword = HelperClass.GetGSAKeyword(typeof(GSANode));

                var indices = Initialiser.Cache.LookupIndices(keyword).Where(i => i.HasValue).Select(i => i.Value).ToList();

                foreach (var kvp in Initialiser.Settings.NodalResults)
                {
                    foreach (var loadCase in Initialiser.Settings.ResultCases)
                    {
                        if (!Initialiser.Interface.CaseExist(loadCase))
                        {
                            continue;
                        }

                        for (var i = 0; i < indices.Count(); i++)
                        {
                            var id = indices[i];

                            //var id = 1;
                            //var highestIndex = (int)Initialiser.Interface.RunGWACommand("HIGHEST\t" + keyword);

                            //while (id <= highestIndex)
                            //{
                            //if ((int)Initialiser.Interface.RunGWACommand("EXIST\t" + keyword + "\t" + id.ToString()) == 1)
                            //{
                            var resultExport = Initialiser.Interface.GetGSAResult(id, kvp.Value.Item1, kvp.Value.Item2, kvp.Value.Item3, loadCase, Initialiser.Settings.ResultInLocalAxis ? "local" : "global");

                            if (resultExport == null || resultExport.Count() == 0)
                            {
                                id++;
                                continue;
                            }

                            var existingRes = results.FirstOrDefault(x => x.Value.TargetRef == id.ToString());
                            if (existingRes == null)
                            {
                                var newRes = new StructuralNodeResult()
                                {
                                    Value     = new Dictionary <string, object>(),
                                    TargetRef = HelperClass.GetApplicationId(typeof(GSANode).GetGSAKeyword(), id),
                                    IsGlobal  = !Initialiser.Settings.ResultInLocalAxis,
                                };
                                newRes.Value[kvp.Key] = resultExport;

                                newRes.GenerateHash();

                                results.Add(new GSANodeResult()
                                {
                                    Value = newRes
                                });
                            }
                            else
                            {
                                existingRes.Value.Value[kvp.Key] = resultExport;
                            }
                            //}
                            //id++;
                        }
                    }
                }

                Initialiser.GSASenderObjects[typeof(GSANodeResult)].AddRange(results);
            }

            return(new SpeckleObject());
        }
        private static bool CreateNodeResultObjects(string typeName, string axisStr)
        {
            var results = new List <GSANodeResult>();

            var keyword = typeof(GSANode).GetGSAKeyword();

            //Unlike embedding, separate results doesn't necessarily mean that there is a Speckle object created for each node.  There is always though
            //some GWA loaded into the cache
            if (!Initialiser.AppResources.Cache.GetKeywordRecordsSummary(keyword, out var gwa, out var indices, out var applicationIds))
            {
                return(false);
            }

            foreach (var kvp in Initialiser.AppResources.Settings.NodalResults)
            {
                foreach (var loadCase in Initialiser.AppResources.Settings.ResultCases.Where(rc => Initialiser.AppResources.Proxy.CaseExist(rc)))
                {
                    for (var i = 0; i < indices.Count(); i++)
                    {
                        try
                        {
                            var resultExport = Initialiser.AppResources.Proxy.GetGSAResult(indices[i], kvp.Value.Item1, kvp.Value.Item2, kvp.Value.Item3, loadCase, axisStr);

                            if (resultExport == null || resultExport.Count() == 0)
                            {
                                continue;
                            }
                            var targetRef = string.IsNullOrEmpty(applicationIds[i]) ? Helper.GetApplicationId(keyword, indices[i]) : applicationIds[i];

                            var existingRes = results.FirstOrDefault(x => x.Value.TargetRef == targetRef && x.Value.LoadCaseRef == loadCase);

                            if (existingRes == null)
                            {
                                var newRes = new StructuralNodeResult()
                                {
                                    Value       = new Dictionary <string, object>(),
                                    TargetRef   = targetRef,
                                    IsGlobal    = !Initialiser.AppResources.Settings.ResultInLocalAxis,
                                    LoadCaseRef = loadCase
                                };
                                newRes.Value[kvp.Key] = resultExport;

                                newRes.GenerateHash();

                                results.Add(new GSANodeResult()
                                {
                                    Value = newRes, GSAId = indices[i]
                                });
                            }
                            else
                            {
                                existingRes.Value.Value[kvp.Key] = resultExport;
                            }
                        }
                        catch (Exception ex)
                        {
                            var contextDesc = string.Join(" ", typeName, kvp.Key, loadCase);
                            Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.Display, MessageLevel.Error, contextDesc, i.ToString());
                            Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.TechnicalLog, MessageLevel.Error, ex, contextDesc, i.ToString());
                        }
                    }
                }
            }

            Initialiser.GsaKit.GSASenderObjects.AddRange(results);

            return(true);
        }