コード例 #1
0
        private void duStuff(ILoads rLoads, double mult, int i, ref ErrorInfo[] err, ref ICalculation calc)
        {
            ILoadCase          lCase = rLoads.GetLoadCase(1, ItemAt.AtNo);
            AnalysisParameters param = new AnalysisParameters();

            param.ModifyLoadingByFactor = true;
            param.LoadingFactor         = mult;
            param.Method = AnalysisMethodType.SecondOrder;

            //Loads
            //lc.PrepareModification();
            rLoads.PrepareModification();
            try
            {
                lCase.SetAnalysisParameters(ref param);
            }
            finally
            {
                rLoads.FinishModification();
                //lc.FinishModification();
                lCase = null;
            }

            err = calc.Calculate(LoadingType.LoadCaseType, 1);
            if (err.Length == 0)
            {
                IResults       res   = calc.GetResultsInFeNodes(LoadingType.LoadCaseType, 1);
                MaximumResults max   = res.GetMaximum();
                Point3D        point = max.Displacement;
                double         value = Math.Sqrt(Math.Pow(point.X, 2) + Math.Pow(point.Y, 2) + Math.Pow(point.Z, 2));
                chart1.Series["deflection"].Points.AddXY(i, value);
            }
        }
コード例 #2
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();
            }
        }
コード例 #3
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);
                }
            }
        }