Пример #1
0
        public static RModel GetRenderModel(Mesh mesh, RSkeleton skeleton)
        {
            var model = new RModel
            {
                BoundingSphere = new Vector4(mesh.BoundingSphereCenter.ToOpenTK(), mesh.BoundingSphereRadius)
            };

            // Use a shared buffer to improve performance.
            // The render meshes will keep references to these objects.
            var vertexBuffer0 = new BufferObject(BufferTarget.ArrayBuffer);
            vertexBuffer0.SetData(mesh.VertexBuffers[0].Buffer, BufferUsageHint.StaticDraw);

            var vertexBuffer1 = new BufferObject(BufferTarget.ArrayBuffer);
            vertexBuffer1.SetData(mesh.VertexBuffers[1].Buffer, BufferUsageHint.StaticDraw);

            foreach (MeshObject meshObject in mesh.Objects)
            {
                var singleBindIndex = skeleton.GetBoneIndex(meshObject.ParentBoneName);

                var rMesh = new RMesh(meshObject.Name,
                    meshObject.SubIndex,
                    meshObject.ParentBoneName,
                    singleBindIndex,
                    new Vector4(meshObject.BoundingSphereCenter.ToOpenTK(),
                    meshObject.BoundingSphereRadius),
                    CreateRenderMesh(mesh, skeleton, meshObject, vertexBuffer0, vertexBuffer1),
                    // TODO: The actual in game check is more complicated, and involves checking names, subindex, and usage.
                    meshObject.Attributes.Select(m => m.AttributeStrings[0].Text).ToList()
                );

                model.SubMeshes.Add(rMesh);
            }

            return model;
        }
Пример #2
0
        public RModel GetRenderModel(RSkeleton Skeleton = null)
        {
            RModel model = new RModel();

            // The bounding sphere containing all meshes.
            var modelSphere = mesh.GetBoundingSphere();

            model.BoundingSphere = new Vector4(modelSphere.Item1, modelSphere.Item2, modelSphere.Item3, modelSphere.Item4);

            foreach (MeshObject meshObject in mesh.Objects)
            {
                PrintAttributeInformation(meshObject);

                RMesh rMesh = new RMesh
                {
                    Name           = meshObject.Name,
                    SingleBindName = meshObject.ParentBoneName,
                };

                // Get bounding sphere.
                var sphere = meshObject.GetBoundingSphere();
                rMesh.BoundingSphere = new Vector4(sphere.Item1, sphere.Item2, sphere.Item3, sphere.Item4);

                // Get vertex data.
                var vertexAccessor           = new SSBHVertexAccessor(mesh);
                var vertexIndices            = vertexAccessor.ReadIndices(0, meshObject.IndexCount, meshObject);
                List <CustomVertex> vertices = CreateVertices(Skeleton, meshObject, vertexAccessor, vertexIndices);

                rMesh.RenderMesh = new RenderMesh(vertices, new List <uint>(vertexIndices));

                model.subMeshes.Add(rMesh);
            }

            return(model);
        }
Пример #3
0
        public RModel GetRenderModel(RSkeleton skeleton = null)
        {
            var model = new RModel
            {
                BoundingSphere = new Vector4(mesh.BoundingSphereX, mesh.BoundingSphereY, mesh.BoundingSphereZ, mesh.BoundingSphereRadius)
            };

            foreach (MeshObject meshObject in mesh.Objects)
            {
                //PrintAttributeInformation(meshObject);

                var rMesh = new RMesh
                {
                    Name           = meshObject.Name,
                    SingleBindName = meshObject.ParentBoneName,
                    BoundingSphere = new Vector4(meshObject.BoundingSphereX, meshObject.BoundingSphereY,
                                                 meshObject.BoundingSphereZ, meshObject.BoundingSphereRadius),
                    RenderMesh = CreateRenderMesh(skeleton, meshObject),
                };

                model.SubMeshes.Add(rMesh);
            }

            return(model);
        }
Пример #4
0
        public RModel GetRenderModel(RSkeleton skeleton = null)
        {
            var model = new RModel
            {
                BoundingSphere = new Vector4(mesh.BoundingSphereX, mesh.BoundingSphereY, mesh.BoundingSphereZ, mesh.BoundingSphereRadius)
            };

            foreach (MeshObject meshObject in mesh.Objects)
            {
                PrintAttributeInformation(meshObject);

                var rMesh = new RMesh
                {
                    Name           = meshObject.Name,
                    SingleBindName = meshObject.ParentBoneName,
                };

                // Get bounding sphere.
                rMesh.BoundingSphere = new Vector4(meshObject.BoundingSphereX, meshObject.BoundingSphereY, meshObject.BoundingSphereZ, meshObject.BoundingSphereRadius);

                // Get vertex data.
                rMesh.RenderMesh = GetRenderMesh(skeleton, meshObject, rMesh);

                model.subMeshes.Add(rMesh);
            }

            return(model);
        }
        internal bool DeleteSelectedObject()
        {
            ComponentBasic b = GetSelectedComponent();

            if (b.CompType == ComponentTypes.ctLinear)
            {
                ComponentNode n1 = ((ComponentLinear)b).StartNode;
                ComponentNode n2 = ((ComponentLinear)b).EndNode;
                // Выясним, есть ли ещё компоненты, соединённые с этими узлами
                // Если нет - удаляем и узлы
                if (RModel.NodeSingle(n1))
                {
                    RModel.CompsList.Remove(n1);
                }
                if (RModel.NodeSingle(n2))
                {
                    RModel.CompsList.Remove(n2);
                }
            }
            if (b.CompType == ComponentTypes.ctNode)
            {
                // При удалении узла возникают ситуации
                // 1. Удаление крайнего узла. В этом случае требуется подтверждение на удаление,
                // поскольку удаляться должен и заканчивающийся в этом узле линейный компонент
                // 2. Удаление узла, в котором сходятся несколько элементов
                //   2.1. Если элементов два - сращиваем элементы в один
                //          То есть, фактически удаляем один из них - тот, на котором нет распределённой нагрузки
                //          а оставшийся улиняем до конца удалённого элемента
                //   2.2 TODO: В общем, слишком муторно, отложу на потом.
            }
            RModel.CompsList.Remove(b);
            editedComp = null;
            Invalidate();
            return(true);
        }
 private void AddNewLinear()
 {
     // Добавляем элемент в модель
     // Если в модели уже были узлы начала и конца этого нового элемента
     // то новые узлы не добавляем. В противном случае - добавляем и узлы
     if (EditedComp?.CompType == ComponentTypes.ctLinear)
     {
         ComponentLinear lin   = (ComponentLinear)EditedComp;
         ComponentNode   node1 = modelVM.GetNodeAtPoint(lin.Start);
         ComponentNode   node2 = modelVM.GetNodeAtPoint(lin.End);
         if (node1 == null)
         {
             RModel.CompsList.Add(lin.StartNode);
             node1 = lin.StartNode;
         }
         if (node2 == null)
         {
             RModel.CompsList.Add(lin.EndNode);
             node2 = lin.EndNode;
         }
         EditedComp = new ComponentLinear(node1, node2, RModel);
         RModel.EnableChangeTracking();
         RModel.CompsList.Add(EditedComp);
         RModel.DisableChangeTracking();
     }
 }
Пример #7
0
        public RModel GetRenderModel(RSkeleton skeleton = null)
        {
            var model = new RModel
            {
                BoundingSphere = new Vector4(mesh.BoundingSphereCenter.ToOpenTK(), mesh.BoundingSphereRadius)
            };

            // Use a shared buffer to improve performance.
            // The render meshes will keep references to these objects.
            var vertexBuffer0 = new BufferObject(BufferTarget.ArrayBuffer);

            vertexBuffer0.SetData(mesh.VertexBuffers[0].Buffer, BufferUsageHint.StaticDraw);

            var vertexBuffer1 = new BufferObject(BufferTarget.ArrayBuffer);

            vertexBuffer1.SetData(mesh.VertexBuffers[1].Buffer, BufferUsageHint.StaticDraw);

            foreach (MeshObject meshObject in mesh.Objects)
            {
                var rMesh = new RMesh
                {
                    Name           = meshObject.Name,
                    SubIndex       = meshObject.SubIndex,
                    SingleBindName = meshObject.ParentBoneName,
                    BoundingSphere = new Vector4(meshObject.BoundingSphereCenter.X, meshObject.BoundingSphereCenter.Y,
                                                 meshObject.BoundingSphereCenter.Z, meshObject.BoundingSphereRadius),
                    RenderMesh = CreateRenderMesh(skeleton, meshObject, vertexBuffer0, vertexBuffer1),
                };

                model.SubMeshes.Add(rMesh);
            }

            return(model);
        }
Пример #8
0
        //Gets all the members in the model and bakes them as breps to the rhino.
        public static Tuple <Member[], Dlubal.RFEM5.CrossSection[]> GetMembers(string comment)
        {
            OpenConnection();
            try
            {
                IModelData rData = RModel.GetModelData();

                Dlubal.RFEM5.Line[]         lines     = rData.GetLines();
                Dlubal.RFEM5.CrossSection[] crossSecs = rData.GetCrossSections();
                Member[] members = rData.GetMembers();
                members = members.Where(o => o.Comment == comment).ToArray();
                List <Member> mList = new List <Member>();

                Dictionary <int, Brep> rCrossSecs = new Dictionary <int, Brep>();
                foreach (Dlubal.RFEM5.CrossSection crossSec in crossSecs)
                {
                    rCrossSecs.Add(crossSec.No, GetCrscDBShape(crossSec.TextID));
                }

                foreach (Member member in members)
                {
                    Dlubal.RFEM5.Line   line      = rData.GetLine(member.LineNo, ItemAt.AtNo).GetData();
                    Rhino.Geometry.Line rhLine    = lineRfemToRhino(line, rData);
                    Vector3d            direction = new Vector3d(rhLine.To - rhLine.From);
                    Plane     plane     = new Plane(rhLine.From, direction);
                    Brep      tempCross = (Brep)rCrossSecs[member.StartCrossSectionNo].Duplicate();
                    Transform tr        = Transform.PlaneToPlane(Plane.WorldXY, plane);
                    tempCross.Transform(tr);

                    Brep extruded = tempCross.Faces[0].CreateExtrusion(rhLine.ToNurbsCurve(), true);
                    ProjectPlugIn.Instance.beamBreps.Add(Tuple.Create(member.No, extruded));
                }

                foreach (Member m in members)
                {
                    Dlubal.RFEM5.CrossSection c = Array.Find(crossSecs, o => o.No == m.StartCrossSectionNo);
                    if (c.TextID.Split(' ')[0] == "Rechteck" || c.TextID.Split(' ')[0] == "Kreis")
                    {
                        mList.Add(m);
                    }
                }
                CloseConnection();
                return(Tuple.Create(mList.ToArray(), crossSecs));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Cleans Garbage collector for releasing all COM interfaces and objects
                System.GC.Collect();
                System.GC.WaitForPendingFinalizers();
                CloseConnection();
            }


            return(Tuple.Create <Member[], Dlubal.RFEM5.CrossSection[]>(null, null));
        }
Пример #9
0
        public IRModel CreateModel()
        {
            var model = new RModel();

            RHelper.ScriptHelper = new ScriptHelper {
                Model = model
            };
            RHelper.ScriptLoader = new ScriptLoader();
            ModelState.Model     = model;
            return(model);
        }
Пример #10
0
        public void FrameSelection(RModel model)
        {
            if (model == null)
            {
                return;
            }

            // Bounding spheres will help account for the vastly different model sizes.
            var sphere = model.BoundingSphere;

            camera.FrameBoundingSphere(sphere.Xyz, sphere.W, 5);
        }
 private void DimensionLinePlace(IssoPoint2D pt1)
 {
     // Завершение ввода нового линейного компонента
     if (EditedComp?.CompType != ComponentTypes.ctBinding)
     {
         return;
     }
     ((IssoBinding)EditedComp).LinePlace = pt1;
     RModel.EnableChangeTracking();
     RModel.CompsList.Add(EditedComp);
     RModel.DisableChangeTracking();
     EditorAction = EditorActions.None;
 }
        internal void ZoomAll()
        {
            // Изменяем масштаб отображения так, чтобы вся модель помещалась на экране
            // Координаты нижней левой точки тоже меняем
            float[] bounds = RModel.GetBounds();
            float   w      = Math.Max(bounds[2] - bounds[0], 1);
            float   h      = Math.Max(bounds[3] - bounds[1], 1);

            ScaleFactor         = Math.Min(ViewHeight / h, ViewWidth / w) * 0.90f;
            ModelViewFragment.X = bounds[0] - ViewWidth * 0.05f / ScaleFactor;
            ModelViewFragment.Y = bounds[1] - ViewHeight * 0.05f / ScaleFactor;
            Invalidate();
        }
        private void CreateForce(IssoPoint2D pt1)
        {
            ComponentNode node = GetLoadStartNode(pt1, ComponentTypes.ctForce);

            if (node != null)
            {
                ComponentLoad load = new ComponentLoad(ComponentTypes.ctForce, -100, node);
                RModel.EnableChangeTracking();
                RModel.CompsList.Add(load);
                RModel.DisableChangeTracking();
                EditedComp = load;
            }
            else
            {
                EditedComp = null;
            }
        }
Пример #14
0
        public async void Initialize()
        {
            Title                 = "CHORALE";
            BackgroundColor       = Resources.ColorBlue;
            TextColor             = Resources.ColorWhite;
            ProgressBarVisibility = System.Windows.Visibility.Visible;

            await Task.Run(() =>
            {
                GraphDataList       = EcologDao.GetGraphDataOnSemanticLink(SemanticLink, Direction);
                RecentGraphDataList = EcologDao.GetRecentGraphDataOnSemanticLink(SemanticLink, Direction);
                OutlierExclusion();
                ChoraleModel = ChoraleModel.Init(GraphDataList);
                RModel       = RModel.Init(GraphDataList);
            });

            SwitchToChoralePage();
        }
Пример #15
0
        /// <summary>
        /// Populates the meshes tab, and binds the given model to subcomponents such as the animation bar.
        /// </summary>
        /// <param name="model"></param>
        private void DisplayMeshes(RModel model)
        {
            animationBar.Model = model;

            if (model != null)
            {
                foreach (var mesh in model.subMeshes)
                {
                    ListViewItem item = new ListViewItem
                    {
                        Text    = mesh.Name,
                        Tag     = mesh,
                        Checked = true
                    };

                    meshList.Items.Add(item);
                }
            }
        }
Пример #16
0
        private void MapImageView_OnDrop(object sender, DragEventArgs e)
        {
            if (!e.Data.GetDataPresent("resurs"))
            {
                return;
            }

            RModel resurs = e.Data.GetData("resurs") as RModel;

            if (resurs == null)
            {
                return;
            }

            bool result = mapImageView.Children.Cast<Image>()
                .Any(x => x.Tag != null && x.Tag.ToString() == resurs.Oznaka);

            System.Windows.Point d0 = e.GetPosition(mapImageView);

            foreach (var mon in Resursi)
            {
                if (mon.Oznaka != resurs.Oznaka && mon.X != -1 && mon.Y != -1 && Math.Abs(mon.X - d0.X) <= 30 &&
                    Math.Abs(mon.Y - d0.Y) <= 30)
                {
                    System.Windows.MessageBox.Show("Nemoguće postaviti preko postojećeg resursa", "");
                    return;
                }

            }

            if (result)
            {
                System.Windows.MessageBox.Show("Ovaj resurs se već nalazi na mapi.", "");
                return;
            }

            var positionX = e.GetPosition(mapImageView).X;
            var positionY = e.GetPosition(mapImageView).Y;
            resurs.X = positionX;
            resurs.Y = positionY;

            putOnMap(resurs, true);
        }
        public async void Initialize()
        {
            //var SemanticLinks = SemanticLinkDao.OutwardSemanticLinks;
            //Direction = new TripDirection { Direction = "outward" };
            //SemanticLink = SemanticLinks.FirstOrDefault(s => s.SemanticLinkId == 13);
            Title                 = "CHORALE";
            BackgroundColor       = Resources.ColorBlue;
            TextColor             = Resources.ColorWhite;
            ProgressBarVisibility = System.Windows.Visibility.Visible;

            await Task.Run(() =>
            {
                GraphDataList = EcologDao.GetGraphDataOnSemanticLink(SemanticLink, Direction);
                OutlierExclusion();
                ChoraleModel = ChoraleModel.Init(GraphDataList);
                RModel       = RModel.Init(GraphDataList);
            });

            SwitchToChoralePage();
        }
Пример #18
0
        private void putOnMap(RModel monument, bool shouldEdit)
        {
            Image img = new Image();
            img.Source = new BitmapImage(new Uri(monument.Ikonica));
            img.Width = 40;
            img.Height = 40;
            img.Tag = monument.Oznaka;
            img.ToolTip = monument.Ime;
            img.MouseMove += ExistingImageMove;
            img.MouseRightButtonDown += DeleteImage;

            Binding myBinding = new Binding();
            myBinding.Source = findResourceById(monument.Oznaka);
            myBinding.Path = new PropertyPath("Ikonica");
            myBinding.Mode = BindingMode.TwoWay;
            myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            BindingOperations.SetBinding(img, Image.SourceProperty, myBinding);

            mapImageView.Children.Add(img);
            Canvas.SetLeft(img, monument.X - 20);
            Canvas.SetTop(img, monument.Y - 20);
        }
        public static List <Tuple <int, Vector3d, Vector3d> > GetMemberIternalForces(List <int> loadCases, LoadingType loadingType, int memberNumber)
        {
            OpenConnection();

            List <Tuple <int, Vector3d, Vector3d> > results = new List <Tuple <int, Vector3d, Vector3d> >();

            try
            {
                ICalculation      calc  = RModel.GetCalculation();
                IModelData        data  = RModel.GetModelData();
                ILoads            loads = RModel.GetLoads();
                LoadCombination[] lc    = loads.GetLoadCombinations();
                foreach (int loadcase in loadCases)
                {
                    try
                    {
                        IResults       res         = calc.GetResultsInFeNodes(loadingType, loadcase);
                        MemberForces[] mf          = res.GetMemberInternalForces(memberNumber, ItemAt.AtNo, true);
                        Vector3d       startForces = new Vector3d(mf[0].Forces.X, mf[0].Moments.Y, mf[0].Moments.Z);
                        Vector3d       endForces   = new Vector3d(mf[mf.Length - 1].Forces.X, mf[mf.Length - 1].Moments.Y, mf[mf.Length - 1].Moments.Z);
                        results.Add(Tuple.Create(loadcase, startForces, endForces));
                    }
                    catch { continue; }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Cleans Garbage collector for releasing all COM interfaces and objects
                System.GC.Collect();
                System.GC.WaitForPendingFinalizers();
            }
            finally
            {
                CloseConnection();
            }
            return(results);
        }
        public RModel <T> FirstOrDefault(Expression <Func <T, bool> > filter, bool ShowTombstone = false, params Expression <Func <T, object> >[] includes)
        {
            RModel <T> res = new RModel <T>();

            try
            {
                var query = _context.Set <T>() as IQueryable <T>;
                if (!ShowTombstone)
                {
                    query = query.Where(o => o.Tombstone == null);
                }
                if (filter != null)
                {
                    query = query.Where(filter);
                }

                if (includes != null)
                {
                    if (!ShowTombstone)
                    {
                        query = includes.Aggregate(query, (current, include) => current.Include(include).Where(o => o.Tombstone == null));
                    }
                    else
                    {
                        query = includes.Aggregate(query, (current, include) => current.Include(include));
                    }
                }

                res.ResultRow  = query.FirstOrDefault();
                res.ResultType = RType.OK;
            }
            catch (Exception ex)
            {
                res.ResultType = RType.Error;
                res.ErrorList.Add(ex.Message);
            }
            return(res);
        }
        private void SetDistLoad(IssoPoint2D pt1)
        {
            if (EditedComp?.CompType == ComponentTypes.ctDistributedLoad)
            {
                ComponentLoad load = (ComponentLoad)EditedComp;
                IssoPoint2D   p1   = load.AppNodes[0].Location;
                IssoPoint2D   p2   = load.AppNodes[1].Location;

                ComponentLinear lin = modelVM.GetLinear(p1, p2);

                if (lin != null)
                {
                    modelVM.SplitLinearAt(lin, p1);
                    lin = modelVM.GetLinear(p1, p2);
                    modelVM.SplitLinearAt(lin, p2);
                    lin = modelVM.GetLinear(p1, p2);
                    RModel.EnableChangeTracking();
                    RModel.CompsList.Add(new ComponentLoad(ComponentTypes.ctDistributedLoad, -10, lin));
                    RModel.DisableChangeTracking();
                }
                EditorAction = EditorActions.None;
            }
        }
Пример #22
0
        private RModel createVoucher(ACHD achd, List <ACBD> acbdList, List <ACBJ> acbjList)
        {
            //for (int i = 0; i < acbdList.Count(); i++)
            //{
            //    if (acbdList[i].SQNO == null || acbdList[i].SQNO == "")
            //    {
            //        acbdList[i].SQNO = (i + 1).ToString();
            //    };
            //}
            //for (int i = 0; i < acbjList.Count(); i++)
            //{
            //    acbjList[i].SQNO = (i + 1).ToString();
            //}
            RModel rModel = new RModel(false, 1, string.Empty);

            this.db = new GWEB_TESTEntities();
            try
            {
                //if (achd.TPID == "現入" && achd.TPID == "現出")

                //{
                //    achd.SBID = "1103";

                //}
                //this.db.ACSB.Where(p=>p. == "")
                this.db.ACHD.Add(achd);
                if (acbdList.Count() > 0)
                {
                    foreach (var item in acbdList)
                    {
                        if (item.SBID == null || item.SBID == "")
                        {
                            item.SBID = "";
                        }
                    }
                    this.db.ACBD.AddRange(acbdList);
                }

                acbjList.RemoveAll(p =>
                                   p.PJID == "" &&
                                   p.CAMT == null &&
                                   p.DAMT == null &&
                                   p.IVAM == null &&
                                   p.IVID == ""
                                   );
                if (acbjList.Count() > 0)
                {
                    acbjList.ForEach(x => {
                        x.DATE = achd.DATE;
                        x.SQID = achd.SQID;
                        x.TPID = achd.TPID;

                        //TT://錯誤資料測試中...//
                        //TODO:...
                        //x.PJID = model.ACID;
                        //x.PJSQ = model.ACID;
                    });
                    this.db.ACBJ.AddRange(acbjList);
                }
                db.SaveChanges();
                rModel.Code    = 0;
                rModel.Success = true;
                rModel.Msg     = string.Empty;
            }
            catch (Exception ex)
            {
                rModel.Code    = 1;
                rModel.Success = false;
                rModel.Msg     = ex.Message;

                //TODO:
                throw;
            }
            finally { db.Dispose(); }
            return(rModel);
        }
        public static List <double> GetUtilizations(Classes_and_structures.Column col, List <int> memberNumbs)
        {
            //Create new Columns for each of the imported column
            foreach (int no in memberNumbs)
            {
                ProjectPlugIn.Instance.Beams.Add(col.ShallowCopy(no.ToString()));
            }

            List <double> utilzTot = new List <double>();

            OpenConnection();
            try
            {
                Dictionary <int, Tuple <int, double> > utilz = new Dictionary <int, Tuple <int, double> >();
                foreach (int numb in memberNumbs)
                {
                    utilz.Add(numb, Tuple.Create(0, 0.0));
                }

                ICalculation      calc  = RModel.GetCalculation();
                IModelData        data  = RModel.GetModelData();
                ILoads            loads = RModel.GetLoads();
                LoadCombination[] lc    = loads.GetLoadCombinations();

                //int[] numbs = lc.Select(o => o.Loading.No).ToArray();
                //numbs = Array.FindAll(numbs, o => o > 100 || o < 200);
                List <int> numbs = new List <int>()
                {
                    149, 150, 153, 154, 157, 158, 159, 160, 166
                };
                int k = 0;
                foreach (int number in numbs)
                {
                    IResults res = calc.GetResultsInFeNodes(LoadingType.LoadCombinationType, number);

                    MemberForces[] mfs = res.GetMembersInternalForces(true);

                    ProjectPlugIn  ppi = ProjectPlugIn.Instance;
                    SimpleLoadCase slc;
                    for (int i = 0; i < mfs.Length; i++)
                    {
                        if (memberNumbs.Contains(mfs[i].MemberNo))
                        {
                            slc = new SimpleLoadCase(mfs[i].Forces.X, mfs[i].Moments.Z, mfs[i].Moments.Y,
                                                     col, number.ToString(), LimitState.Ultimate);

                            if (slc.Utilization > utilz[mfs[i].MemberNo].Item2)
                            {
                                utilz[mfs[i].MemberNo] = Tuple.Create(i, slc.Utilization);
                            }
                        }
                    }

                    foreach (int key in utilz.Keys)
                    {
                        Classes_and_structures.Column tempCol = (Classes_and_structures.Column)ProjectPlugIn.Instance.Beams
                                                                .Find(o => o.Name == key.ToString());
                        tempCol.LoadCases.Add(new SimpleLoadCase(mfs[utilz[key].Item1].Forces.X, mfs[utilz[key].Item1].Moments.Z, mfs[utilz[key].Item1].Moments.Y,
                                                                 tempCol, number.ToString(), LimitState.Ultimate));
                    }
                    mfs = null;

                    k++;
                }

                foreach (int memberNo in memberNumbs)
                {
                    Classes_and_structures.Column tempCol = (Classes_and_structures.Column)ProjectPlugIn.Instance.Beams
                                                            .Find(o => o.Name == memberNo.ToString());

                    SimpleLoadCase[] temp = tempCol.LoadCases.Select(o => o as SimpleLoadCase).ToArray();
                    utilzTot.Add(temp.MaxBy(o => o.Utilization).Utilization);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Cleans Garbage collector for releasing all COM interfaces and objects
                System.GC.Collect();
                System.GC.WaitForPendingFinalizers();
            }
            finally
            {
                CloseConnection();
            }

            return(utilzTot);
        }