public static SpeckleObject ToSpeckle(this GSABridgeVehicle dummyObject)
        {
            var newLines       = ToSpeckleBase <GSABridgeVehicle>();
            var typeName       = dummyObject.GetType().Name;
            var alignmentsLock = new object();
            //Get all relevant GSA entities in this entire model
            var alignments = new SortedDictionary <int, GSABridgeVehicle>();

            Parallel.ForEach(newLines.Keys, k =>
            {
                var p         = newLines[k];
                var alignment = new GSABridgeVehicle()
                {
                    GWACommand = p
                };
                //Pass in ALL the nodes and members - the Parse_ method will search through them
                try
                {
                    alignment.ParseGWACommand();
                    lock (alignmentsLock)
                    {
                        alignments.Add(k, alignment);
                    }
                }
                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(alignments.Values.ToList());

            return((alignments.Keys.Count > 0) ? new SpeckleObject() : new SpeckleNull());
        }
Пример #2
0
        public static SpeckleObject ToSpeckle(this GSABridgeVehicle dummyObject)
        {
            var newLines = ToSpeckleBase <GSABridgeVehicle>();

            var alignmentsLock = new object();
            //Get all relevant GSA entities in this entire model
            var alignments = new List <GSABridgeVehicle>();

            Parallel.ForEach(newLines.Values, p =>
            {
                var alignment = new GSABridgeVehicle()
                {
                    GWACommand = p
                };
                //Pass in ALL the nodes and members - the Parse_ method will search through them
                alignment.ParseGWACommand();
                lock (alignmentsLock)
                {
                    alignments.Add(alignment);
                }
            });

            Initialiser.GSASenderObjects.AddRange(alignments);

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