Exemplo n.º 1
0
        //Sets all the member loads to RFEM (Only uniform distributed load is implemented
        private static void setRFEMmemberLoads(ILoads rLoads, MemberLoad[] rMemberLoads)
        {
            Dictionary <int, List <MemberLoad> > loads = new Dictionary <int, List <MemberLoad> >();

            foreach (MemberLoad rMemberLoad in rMemberLoads)
            {
                if (!loads.ContainsKey(int.Parse(rMemberLoad.Comment)))
                {
                    List <MemberLoad> nLoad = new List <MemberLoad>();
                    MemberLoad        a     = rMemberLoad;
                    a.Comment = "";
                    nLoad.Add(a);

                    loads[int.Parse(rMemberLoad.Comment)] = nLoad;
                }
                else
                {
                    MemberLoad a = rMemberLoad;
                    a.Comment = "";
                    loads[int.Parse(rMemberLoad.Comment)].Add(a);
                }
            }
            foreach (int n in loads.Keys)
            {
                ILoadCase lCase = rLoads.GetLoadCase(n, ItemAt.AtNo);
                lCase.PrepareModification();

                lCase.SetMemberLoads(loads[n].ToArray());
                lCase.FinishModification();
            }
        }
Exemplo n.º 2
0
        public static void CreateModel(Karamba.Models.Model kModel)
        {
            if (RModel != null)
            {
                Node[]         rNodes         = Nodes(kModel.nodes);
                NodalSupport[] rSupports      = Supports(kModel.supports);
                Material[]     rMaterials     = Materials(kModel.materials);
                CrossSection[] rCrossSections = CrossSections(kModel.crosecs, kModel);
                Tuple <Member[], Dlubal.RFEM5.Line[]> vali = Members(kModel.elems);
                Member[]            rMembers      = vali.Item1;
                Dlubal.RFEM5.Line[] rLines        = vali.Item2;
                LoadCase[]          lCases        = LoadCases();
                MemberLoad[]        rMemberLoads  = MemberLoads(kModel.eloads);
                NodalLoad[]         rNodalLoads   = NodalLoads(kModel.ploads);
                MemberHinge[]       rMemberHinges = MemberHinges(kModel.joints);

                //Get active RFEM5 application
                try
                {
                    IModelData rData  = RModel.GetModelData();
                    ILoads     rLoads = RModel.GetLoads();

                    //Model elements
                    rData.PrepareModification();

                    rData.SetNodes(rNodes);
                    rData.SetNodalSupports(rSupports);
                    rData.SetMaterials(rMaterials);
                    rData.SetCrossSections(rCrossSections);
                    rData.SetMemberHinges(rMemberHinges);
                    rData.SetLines(rLines);
                    rData.SetMembers(rMembers);

                    rData.FinishModification();

                    //Load cases
                    rLoads.PrepareModification();
                    rLoads.SetLoadCases(lCases);
                    rLoads.FinishModification();

                    //Loads
                    ILoadCase lCase = rLoads.GetLoadCase(1, ItemAt.AtNo);
                    lCase.PrepareModification();
                    lCase.SetMemberLoads(rMemberLoads);
                    lCase.SetNodalLoads(rNodalLoads);
                    lCase.FinishModification();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }