public static SpeckleObject ToSpeckle(this GSAMaterialSteel dummyObject)
        {
            var newLines = ToSpeckleBase <GSAMaterialSteel>();

            var materialsLock = new object();
            var materials     = new List <GSAMaterialSteel>();

            Parallel.ForEach(newLines.Values, p =>
            {
                try
                {
                    var mat = new GSAMaterialSteel()
                    {
                        GWACommand = p
                    };
                    mat.ParseGWACommand();
                    lock (materialsLock)
                    {
                        materials.Add(mat);
                    }
                }
                catch { }
            });

            Initialiser.GSASenderObjects.AddRange(materials);

            return((materials.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }
示例#2
0
        public static SpeckleObject ToSpeckle(this GSAMaterialSteel dummyObject)
        {
            var newLines      = ToSpeckleBase <GSAMaterialSteel>();
            var typeName      = dummyObject.GetType().Name;
            var materialsLock = new object();
            var materials     = new SortedDictionary <int, GSAMaterialSteel>();

            Parallel.ForEach(newLines.Keys, k =>
            {
                var pPieces = newLines[k].ListSplit(Initialiser.AppResources.Proxy.GwaDelimiter);
                var gsaId   = pPieces[1];
                try
                {
                    var mat = new GSAMaterialSteel()
                    {
                        GWACommand = newLines[k]
                    };
                    mat.ParseGWACommand();
                    lock (materialsLock)
                    {
                        materials.Add(k, mat);
                    }
                }
                catch (Exception ex)
                {
                    Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.Display, MessageLevel.Error, typeName, gsaId);
                    Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.TechnicalLog, MessageLevel.Error, ex, typeName, gsaId);
                }
            });

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

            return((materials.Keys.Count > 0) ? new SpeckleObject() : new SpeckleNull());
        }
示例#3
0
        public static SpeckleObject ToSpeckle(this GSAMaterialSteel dummyObject)
        {
            var newLines = ToSpeckleBase <GSAMaterialSteel>();

            var materials = new List <GSAMaterialSteel>();

            foreach (var p in newLines.Values)
            {
                try
                {
                    var mat = new GSAMaterialSteel()
                    {
                        GWACommand = p
                    };
                    mat.ParseGWACommand();
                    materials.Add(mat);
                }
                catch { }
            }

            Initialiser.GSASenderObjects[typeof(GSAMaterialSteel)].AddRange(materials);

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