Beispiel #1
0
        public static SpeckleObject ToSpeckle(this GSANodalInfluenceEffect dummyObject)
        {
            var newLines = ToSpeckleBase <GSANodalInfluenceEffect>();

            var infls = new List <GSANodalInfluenceEffect>();
            var nodes = Initialiser.GSASenderObjects[typeof(GSANode)].Cast <GSANode>().ToList();

            foreach (var p in newLines.Values)
            {
                try
                {
                    var infl = new GSANodalInfluenceEffect()
                    {
                        GWACommand = p
                    };
                    infl.ParseGWACommand(nodes);
                    infls.Add(infl);
                }
                catch { }
            }

            Initialiser.GSASenderObjects[typeof(GSANodalInfluenceEffect)].AddRange(infls);

            return((infls.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }
        public static SpeckleObject ToSpeckle(this GSANodalInfluenceEffect dummyObject)
        {
            var newLines  = ToSpeckleBase <GSANodalInfluenceEffect>();
            var typeName  = dummyObject.GetType().Name;
            var inflsLock = new object();
            var infls     = new SortedDictionary <int, GSANodalInfluenceEffect>();
            var nodes     = Initialiser.GsaKit.GSASenderObjects.Get <GSANode>();

            Parallel.ForEach(newLines.Keys, k =>
            {
                try
                {
                    var p    = newLines[k];
                    var infl = new GSANodalInfluenceEffect()
                    {
                        GWACommand = p
                    };
                    infl.ParseGWACommand(nodes);
                    lock (inflsLock)
                    {
                        infls.Add(k, infl);
                    }
                }
                catch (Exception ex)
                {
                    Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.Display, MessageLevel.Error, typeName, k.ToString());
                    Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.TechnicalLog, MessageLevel.Error, ex, typeName, k.ToString());
                }
            });

            Initialiser.GsaKit.GSASenderObjects.AddRange(infls.Values.ToList());

            return((infls.Keys.Count > 0) ? new SpeckleObject() : new SpeckleNull());
        }
        public static SpeckleObject ToSpeckle(this GSANodalInfluenceEffect dummyObject)
        {
            var newLines = ToSpeckleBase <GSANodalInfluenceEffect>();

            var inflsLock = new object();
            var infls     = new List <GSANodalInfluenceEffect>();
            var nodes     = Initialiser.GSASenderObjects.Get <GSANode>();

            Parallel.ForEach(newLines.Values, p =>
            {
                try
                {
                    var infl = new GSANodalInfluenceEffect()
                    {
                        GWACommand = p
                    };
                    infl.ParseGWACommand(nodes);
                    lock (inflsLock)
                    {
                        infls.Add(infl);
                    }
                }
                catch { }
            });

            Initialiser.GSASenderObjects.AddRange(infls);

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