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

            var propsLock = new object();
            var props     = new List <GSA1DProperty>();
            var steels    = Initialiser.GSASenderObjects.Get <GSAMaterialSteel>();
            var concretes = Initialiser.GSASenderObjects.Get <GSAMaterialConcrete>();

            Parallel.ForEach(newLines.Values, p =>
            {
                try
                {
                    var prop = new GSA1DProperty()
                    {
                        GWACommand = p
                    };
                    prop.ParseGWACommand(Initialiser.Settings.Units, steels, concretes);
                    lock (propsLock)
                    {
                        props.Add(prop);
                    }
                }
                catch { }
            });

            Initialiser.GSASenderObjects.AddRange(props);

            return((props.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }
Esempio n. 2
0
        public static SpeckleObject ToSpeckle(this GSA1DProperty dummyObject)
        {
            var newLines = ToSpeckleBase <GSA1DProperty>();

            var props     = new List <GSA1DProperty>();
            var steels    = Initialiser.GSASenderObjects[typeof(GSAMaterialSteel)].Cast <GSAMaterialSteel>().ToList();
            var concretes = Initialiser.GSASenderObjects[typeof(GSAMaterialConcrete)].Cast <GSAMaterialConcrete>().ToList();

            foreach (var p in newLines.Values)
            {
                try
                {
                    var prop = new GSA1DProperty()
                    {
                        GWACommand = p
                    };
                    prop.ParseGWACommand(Initialiser.Settings.Units, steels, concretes);
                    props.Add(prop);
                }
                catch { }
            }

            Initialiser.GSASenderObjects[typeof(GSA1DProperty)].AddRange(props);

            return((props.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }
Esempio n. 3
0
        public static SpeckleObject ToSpeckle(this GSA1DProperty dummyObject)
        {
            var settings            = Initialiser.AppResources.Settings;
            var anyElement1dResults = settings.ResultTypes != null && settings.ResultTypes.Any(rt => rt.ToString().ToLower().Contains("1d"));

            if (settings.TargetLayer == GSATargetLayer.Analysis && settings.StreamSendConfig == StreamContentConfig.TabularResultsOnly && !anyElement1dResults)
            {
                return(new SpeckleNull());
            }

            var newLines  = ToSpeckleBase <GSA1DProperty>();
            var typeName  = dummyObject.GetType().Name;
            var propsLock = new object();
            var props     = new SortedDictionary <int, GSA1DProperty>();
            var steels    = Initialiser.GsaKit.GSASenderObjects.Get <GSAMaterialSteel>();
            var concretes = Initialiser.GsaKit.GSASenderObjects.Get <GSAMaterialConcrete>();
            var keyword   = dummyObject.GetGSAKeyword();

            Parallel.ForEach(newLines.Keys, k =>
            {
                var pPieces = newLines[k].ListSplit(Initialiser.AppResources.Proxy.GwaDelimiter);
                var gsaId   = pPieces[1];
                try
                {
                    var prop = new GSA1DProperty()
                    {
                        GWACommand = newLines[k]
                    };
                    prop.ParseGWACommand(Initialiser.AppResources.Settings.Units, steels, concretes);
                    lock (propsLock)
                    {
                        props.Add(k, prop);
                    }
                }
                catch (Exception ex)
                {
                    Initialiser.AppResources.Messenger.Message(MessageIntent.TechnicalLog, MessageLevel.Error, ex,
                                                               "Keyword=" + keyword, "Index=" + k);
                }
            });

            if (props.Values.Count() > 0)
            {
                Initialiser.GsaKit.GSASenderObjects.AddRange(props.Values.ToList());
            }

            return((props.Keys.Count > 0) ? new SpeckleObject() : new SpeckleNull());
        }
        public static SpeckleObject ToSpeckle(this GSA1DProperty dummyObject)
        {
            var newLines  = ToSpeckleBase <GSA1DProperty>();
            var typeName  = dummyObject.GetType().Name;
            var propsLock = new object();
            var props     = new SortedDictionary <int, GSA1DProperty>();
            var steels    = Initialiser.GsaKit.GSASenderObjects.Get <GSAMaterialSteel>();
            var concretes = Initialiser.GsaKit.GSASenderObjects.Get <GSAMaterialConcrete>();

            Parallel.ForEach(newLines.Keys, k =>
            {
                var pPieces = newLines[k].ListSplit(Initialiser.AppResources.Proxy.GwaDelimiter);
                var gsaId   = pPieces[1];
                try
                {
                    var prop = new GSA1DProperty()
                    {
                        GWACommand = newLines[k]
                    };
                    prop.ParseGWACommand(Initialiser.AppResources.Settings.Units, steels, concretes);
                    lock (propsLock)
                    {
                        props.Add(k, prop);
                    }
                }
                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(props.Values.ToList());

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