Exemple #1
0
        public List <int>[] getData()
        {
            int n = 4;

            List <int>[] lista = new List <int> [4];

            for (int i = 0; i < n; i++)
            {
                lista[i] = new List <int>();
            }

            IRobotCollection fe_col = robApp.Project.Structure.FiniteElems.GetAll();

            for (int i = 1; i <= Count(); i++)
            {
                var fe = fe_col.Get(i);
                IRobotFiniteElementNodes EleNodes = fe.Nodes;
                int nNodes = EleNodes.Count;

                for (int j = 1; j <= nNodes; j++)
                {
                    lista[j - 1].Add(EleNodes.Get(j));
                }
            }

            return(lista);
        }
Exemple #2
0
        public List <double>[] getData()
        {
            List <double>[] lista = new List <double> [3];
            lista[0] = new List <double>();
            lista[1] = new List <double>();
            lista[2] = new List <double>();

            IRobotNodeServer nd        = robApp.Project.Structure.Nodes;
            IRobotCollection nodes_col = nd.GetAll();
            int licznik = 1;

            for (int i = 1; i <= Count(); i++)
            {
                if (nd.Exist(i) == 0)
                {
                    lista[0].Add(0);
                    lista[1].Add(0);
                    lista[2].Add(0);
                }
                else
                {
                    var node = nodes_col.Get(licznik);
                    lista[0].Add(node.X);
                    lista[1].Add(node.Y);
                    lista[2].Add(node.Z);
                    licznik += 1;
                }
            }
            return(lista);
        }
Exemple #3
0
        public static List <ResultsR> GetResults()
        {
            List <ResultsR>      Results      = new List <ResultsR>();
            IRobotCollection     Bars         = robotApp.Project.Structure.Bars.GetAll();
            IRobotCaseCollection LoadingCases = robotApp.Project.Structure.Cases.GetAll();

            for (int i = 1; i <= Bars.Count; i++)
            {
                IRobotBar Element = Bars.Get(i);
                for (int j = 1; j <= LoadingCases.Count; j++)
                {
                    IRobotCase         Case      = LoadingCases.Get(j);
                    int                caseNum   = Case.Number;
                    IRobotBarForceData Force     = barForceServer.Value(i, caseNum, 0.5);
                    double             FX        = Force.FX;
                    double             FY        = Force.FY;
                    double             FZ        = Force.FZ;
                    double             MX        = Force.MX;
                    double             MY        = Force.MY;
                    double             MZ        = Force.MZ;
                    double             KY        = Force.KY;
                    double             KZ        = Force.KZ;
                    ResultsR           barResult = new ResultsR(FX, FY, FZ, MX, MY, MZ, KY, KZ);
                    Results.Add(barResult);
                }
            }
            return(Results);
        }
Exemple #4
0
        //查看结果Tab页面的初始化
        private void tabControl2_Selected(object sender, TabControlEventArgs e)
        {
            // fill combo-box with names of all load cases defined in the structure
            comboLoadCase.Items.Clear();
            IRobotCollection icases = iapp.Project.Structure.Cases.GetAll();

            for (int i = 1; i <= icases.Count; ++i)
            {
                IRobotCase ic  = (IRobotCase)icases.Get(i);
                int        idx = comboLoadCase.Items.Add(ic.Name);
            }
            // select the first item
            if (comboLoadCase.Items.Count > 0)
            {
                comboLoadCase.SelectedIndex = 0;
            }
        }
Exemple #5
0
        //查看计算结果
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab == tabPage5)//进行tabpage位置判断
            {
                // fill combo-box with names of all load cases defined in the structure
                comboBoxLoadCombine.Items.Clear();
                IRobotCollection icases = iapp.Project.Structure.Cases.GetAll();
                for (int i = 1; i <= icases.Count; ++i)
                {
                    IRobotCase ic  = (IRobotCase)icases.Get(i);
                    int        idx = comboBoxLoadCombine.Items.Add(ic.Name);
                }
                // select the first item
                if (comboBoxLoadCombine.Items.Count > 0)
                {
                    comboBoxLoadCombine.SelectedIndex = 0;
                }


                if (iapp.Project.Structure.Results.Available == 0) //计算结果不可用
                {
                    iapp.Project.CalcEngine.Calculate();           //进行结构计算
                }
                //清除表格
                dataGridView1.Rows.Clear();
                int        index    = comboBoxLoadCombine.SelectedIndex + 1;                        //当前选择的工况索引
                IRobotCase icc      = (IRobotCase)iapp.Project.Structure.Cases.GetAll().Get(index); //根据下拉框选择当前工况
                int        case_num = icc.Number;

                for (int n = 0; n < 5; ++n)
                {
                    int indexData = dataGridView1.Rows.Add();
                    dataGridView1.Rows[indexData].Cells[0].Value = n + 1;
                    dataGridView1.Rows[indexData].Cells[1].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0).MY / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[2].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0.5).MY / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[3].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 1).MY / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[4].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0).FZ / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[5].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0.5).FZ / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[6].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 1).FZ / 1000).ToString("####0.00");
                }
            }
        }
Exemple #6
0
        public static void GetResults()
        {
            IRobotCollection     Bars         = robotApp.Project.Structure.Bars.GetAll();
            IRobotCaseCollection LoadingCases = robotApp.Project.Structure.Cases.GetAll();

            for (int i = 1; i <= Bars.Count; i++)
            {
                IRobotBar Element = Bars.Get(i);
                for (int j = 1; j <= LoadingCases.Count; j++)
                {
                    IRobotCase         Case    = LoadingCases.Get(j);
                    int                caseNum = Case.Number;
                    IRobotBarForceData Force   = barForceServer.Value(i, caseNum, 0.5);
                    double             FX      = Force.FX;
                    double             FY      = Force.FY;
                    double             FZ      = Force.FZ;
                    double             MX      = Force.MX;
                    double             MY      = Force.MY;
                    double             MZ      = Force.MZ;
                }
            }
        }
Exemple #7
0
        private void CreatePlates(double liveLoad, List <int> forLiveLoads, double windLoad, List <int> forWindLoads, double buildingLoad,
                                  List <int> forBuildingLoads, List <int> forDeadLoadsSlabs, IRobotSimpleCase ll, IRobotSimpleCase wl,
                                  IRobotSimpleCase bl, double fatManLoad, IRobotSimpleCase dl, List <int> forDeadLoadsBars)
        {
            #region material info

            //create the slab material
//			string materialName = "Catia_material_slab";
//			IRobotLabel Label = _structure.Labels.Create(IRobotLabelType.I_LT_MATERIAL, materialName);
//			RobotMaterialData Material = Label.Data as RobotMaterialData;
//			Material.Type = IRobotMaterialType.I_MT_CONCRETE;
//			Material.E = 30000000000;
//			Material.NU = 0.16;
//			Material.RO = 25000;
//			Material.Kirchoff = Material.E / (2*(1 + Material.NU));
//			_project.Structure.Labels.Store(Label);

            //create the panel type
            string             catSlabSectionName = "Catia_Slab";
            IRobotLabel        Label     = _structure.Labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, catSlabSectionName);
            RobotThicknessData thickness = Label.Data as RobotThicknessData;
//			thickness.MaterialName = materialName;
            thickness.MaterialName  = "CONCR";
            thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS;
            RobotThicknessHomoData thicknessData = thickness.Data as RobotThicknessHomoData;
            if (_plateInfo.Count != 0)
            {
                thicknessData.ThickConst = _plateInfo[0].Thickness / 1000; //test one panel for thickness
            }
            else
            {
                thicknessData.ThickConst = .02;
            }

            _project.Structure.Labels.Store(Label);

            //create the panel material
//			string materialName = "Catia_material_panel";
//			Label = _structure.Labels.Create(IRobotLabelType.I_LT_MATERIAL, materialName);
//			Material = Label.Data as RobotMaterialData;
//			Material.Type = IRobotMaterialType.I_MT_CONCRETE;
//			Material.Type = IRobotMaterialType.I_MT_ALUMINIUM;
//			Material.E = 69000000000;
//			Material.NU = 0.16;		//the poisson ratio
//			Material.RO = 25000;	//the mass
//			Material.Kirchoff = Material.E / (2*(1 + Material.NU));
//			_project.Structure.Labels.Store(Label);

            string catPanelSectionName = "Catia_Panel";
            Label     = _structure.Labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, catPanelSectionName);
            thickness = Label.Data as RobotThicknessData;
//			thickness.MaterialName = materialName;
            thickness.MaterialName   = "ALUM";
            thickness.ThicknessType  = IRobotThicknessType.I_TT_HOMOGENEOUS;
            thicknessData            = thickness.Data as RobotThicknessHomoData;
            thicknessData.ThickConst = 0.003175; //a 1/8" thick aluminum panel, we'll need to use a single finite element
            _project.Structure.Labels.Store(Label);

            string catShearPanelName = "Catia_Shear";
            Label     = _structure.Labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, catShearPanelName);
            thickness = Label.Data as RobotThicknessData;
            thickness.MaterialName   = "CONCR";
            thickness.ThicknessType  = IRobotThicknessType.I_TT_HOMOGENEOUS;
            thicknessData            = thickness.Data as RobotThicknessHomoData;
            thicknessData.ThickConst = 0.3; //a 1/8" thick aluminum panel, we'll need to use a single finite element
            _project.Structure.Labels.Store(Label);

            #endregion

            int plateId = 10000;

            for (int i = 0; i < _plateInfo.Count; i++)
            {
                Console.WriteLine("Now creating plate " + plateId.ToString() + "...");
                List <int> robotNodes = new List <int>();

                var p = (AnalyticalPlate)_plateInfo[i];  //the plate to create

                //at this point we know the CATIA nodes and the robot nodes
                //but the robot node list for each plate is empty
                //find the robot node that corresponds to each catia node in the list
                //fill up the corresponding robot id list

                //foreach (string catIndex in p.CatiaPoints)
                //{
                //    foreach (Node n in _nodeInfo)
                //    {
                //        //if the node id equals that in the catia points list
                //        if (n.catiaID.Equals(catIndex))
                //        {
                //            robotNodes.Add(n.robotID);	//add the int robot id to the other list
                //        }
                //        else
                //        {
                //            continue;	//continue;
                //        }
                //    }
                //}

                p.Nodes = robotNodes; //change out the robotNodes list on the object

                //the robot point array to hold all the pts
                RobotPointsArray pts = new RobotPointsArrayClass();
                pts.SetSize(p.Nodes.Count);

                int ptIndex = 1;

                //fill up the points array
                foreach (int rId in p.Nodes)
                {
                    IRobotNode robNode = _structure.Nodes.Get(rId) as IRobotNode;
                    pts.Set(ptIndex, robNode.X, robNode.Y, robNode.Z);
                    //MessageBox.Show(robNode.X.ToString());
                    ptIndex++;
                }

                //int plateId = _structure.Objects.FreeNumber;

                _project.Structure.Objects.CreateContour(plateId, pts);
                IRobotObjObject obj = _structure.Objects.Get(plateId) as IRobotObjObject;
                obj.Main.Attribs.Meshed = 1;

                if (p.PlateType == PlateType.Slab)
                {
                    obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catSlabSectionName);
                    obj.SetLabel(IRobotLabelType.I_LT_PANEL_REINFORCEMENT, "Panel");
                }
                else if (p.PlateType == PlateType.Panel)
                {
                    obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catPanelSectionName);
                }
                else if (p.PlateType == PlateType.Shear)
                {
                    obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catShearPanelName);
                    obj.SetLabel(IRobotLabelType.I_LT_PANEL_REINFORCEMENT, "Wall");
                }
                else
                {
                    obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catPanelSectionName);
                }


                obj.Initialize();
                obj.Update();


                //create some loads
                //if the live load has a value
//				if(p.PlateType == PlateType.slab)
                if (p.LiveLoad > 0.0)
                {
                    Console.WriteLine("Now creating live load on slab " + plateId.ToString() + "...");

                    liveLoad = p.LiveLoad;
                    forLiveLoads.Add(plateId);
                }
                //if the wind load has a value
//				else if (p.PlateType == PlateType.panel)
                if (p.WindLoad > 0.0)
                {
                    Console.WriteLine("Now creating wind load on panel " + plateId.ToString() + "...");

                    windLoad = p.WindLoad;
                    forWindLoads.Add(plateId);
                }

                if (p.BuildingLoad > 0.0)
                {
                    Console.WriteLine("Now creating building load on panel " + plateId.ToString() + "...");
                    buildingLoad = p.BuildingLoad;
                    forBuildingLoads.Add(plateId);
                }
                forDeadLoadsSlabs.Add(plateId); //all

                p.Id = plateId;                 //set the plateId on the object
                plateId++;
            }

            IRobotLoadRecord rec = null;

            if (forLiveLoads.Count > 0)
            {
                //add the live loads on all panels
                rec = ll.Records.Get(1);
                rec.Objects.FromText(forLiveLoads[0].ToString() + "to" + forLiveLoads[forLiveLoads.Count - 1].ToString());
                rec.SetValue(2, -liveLoad);
                rec.SetValue(11, 0);
            }

            if (forWindLoads.Count > 0)
            {
                //add the forces on the wind panels
                rec = wl.Records.Get(1);
                rec.Objects.FromText(forWindLoads[0].ToString() + "to" + forWindLoads[forWindLoads.Count - 1].ToString());

                rec.SetValue(0, _windx * windLoad); //the X value
                rec.SetValue(1, _windy * windLoad); //the Y value
                rec.SetValue(2, _windz * windLoad); // the Z value
//				rec.SetValue(11, 1);	//this sets it use the "local" normal for the wind direction
                rec.SetValue(11, 0);                //this is the default - loads act in the global direction

                //add the uplift on the wind panels
//				rec = wl_uplift.Records.Get(1);
//				rec.Objects.FromText(forWindLoads[0].ToString() +"to"+forWindLoads[forWindLoads.Count-1].ToString());
//				rec.SetValue(2, -windLoad);
//				rec.SetValue(11,1);
            }

            if (forBuildingLoads.Count > 0)
            {
                rec = bl.Records.Get(1);
                rec.Objects.FromText(forBuildingLoads[0].ToString() + "to" +
                                     forBuildingLoads[forBuildingLoads.Count - 1].ToString());
                rec.SetValue(2, -buildingLoad);
                rec.SetValue(11, 0);
            }

            //create a randomly placed live load on the structure
            //the fat man load
            IRobotCollection nodes = _nodes.GetAll();
            Random           r     = new Random();
            int randPoint          = r.Next((nodes.Get(1) as IRobotNode).Number, (nodes.Get(nodes.Count) as IRobotNode).Number);
//			Debug.WriteLine(randPoint);
            rec = ll.Records.Get(2);
            rec.SetValue(2, -fatManLoad);
            rec.Objects.FromText(randPoint.ToString());

            //set the dead loads for the structure
            rec = dl.Records.Get(1);

            //add dead loads to bars
            if (forDeadLoadsBars.Count > 0 && forDeadLoadsSlabs.Count == 0)
            {
                rec.Objects.FromText(forDeadLoadsBars[0].ToString() + "to" +
                                     forDeadLoadsBars[forDeadLoadsBars.Count - 1].ToString());
            }
            //add dead loads to bars and slabs
            else if (forDeadLoadsBars.Count > 0 && forDeadLoadsSlabs.Count > 0)
            {
                rec.Objects.FromText(forDeadLoadsBars[0].ToString() + "to" +
                                     forDeadLoadsBars[forDeadLoadsBars.Count - 1].ToString() + " " +
                                     forDeadLoadsSlabs[0].ToString() + "to" +
                                     forDeadLoadsSlabs[forDeadLoadsSlabs.Count - 1].ToString());
            }
            //add dead loads to slabs only
            else if (forDeadLoadsBars.Count == 0 && forDeadLoadsSlabs.Count > 0)
            {
                rec.Objects.FromText(forDeadLoadsSlabs[0].ToString() + "to" +
                                     forDeadLoadsSlabs[forDeadLoadsSlabs.Count - 1].ToString());
            }
            rec.SetValue(2, -1); //set the z value

//			Console.WriteLine("Waiting for load application...");
//			System.Threading.Thread.Sleep(10000);
        }
Exemple #8
0
        public void DoCommand(int cmd_id)
        {
            IRobotStructure structure = robot_app.Project.Structure;

            // Get bars and nodes
            IRobotCollection bars  = structure.Bars.GetAll();
            IRobotCollection nodes = structure.Nodes.GetAll();

            // Create 3D points at nodes
            var points = new Dictionary <int, Point3D>();

            for (int i = 1; i <= nodes.Count; i++)
            {
                var node = (IRobotNode)nodes.Get(i);
                points[i] = new Point3D(node.X, node.Y, node.Z);
            }

            // Create 3D vectors for each bar and index of bars connected to a node
            var vectors    = new Dictionary <int, Vector3D>();
            var vect_by_pt = new DefaultDict <int, List <Vector3D> >();

            for (int i = 1; i <= bars.Count; i++)
            {
                var bar      = (IRobotBar)bars.Get(i);
                var start_pt = points[bar.StartNode];
                var end_pt   = points[bar.EndNode];
                vectors[i] = end_pt - start_pt;
                vect_by_pt[bar.StartNode].Add(vectors[i]);
                vect_by_pt[bar.EndNode].Add(vectors[i]);
            }
            ;

            foreach (KeyValuePair <int, Vector3D> vector in vectors)
            {
                // `u` is the vector corresponding to the bar
                Vector3D     u      = vector.Value;
                UnitVector3D u_norm = u.Normalize();
                int          start  = bars.Get(vector.Key).StartNode;
                // TODO: How about the other end?

                // Find the most orthogonal vector `v`
                Vector3D most_orth_v = u;
                double   cur_min     = 1;
                foreach (Vector3D x in vect_by_pt[start])
                {
                    UnitVector3D x_norm   = x.Normalize();
                    double       dot_prod = Math.Abs(u_norm.DotProduct(x_norm));
                    if (dot_prod < cur_min)
                    {
                        most_orth_v = x;
                        cur_min     = dot_prod;
                    }
                }

                if (cur_min > 0.95)
                {
                    continue;
                }

                var v      = most_orth_v;
                var v_norm = v.Normalize();

                // Vector `a` is vector a orthogonal to `u` in (u,v) plane
                Vector3D     a      = v - u_norm.DotProduct(v) * u;
                UnitVector3D a_norm = a.Normalize();

                // Vector `c` is orthogonal to `u` in the global (X,Y) plane
                UnitVector3D c = u_norm.CrossProduct(UnitVector3D.ZAxis);
                // Vector `d` is orthogonal to `c` and `u`
                UnitVector3D d = c.CrossProduct(u_norm);

                // Calculate the angles of `a` with `d` and `c`
                Angle theta1 = a.AngleTo(d);
                Angle theta2 = a.AngleTo(c);

                // Calculate gamma from `theta1` and `theta2`
                Angle  gamma    = (theta2.Degrees < 90) ? theta1 : -theta1;
                double gamma_up = (gamma.Degrees < 0) ? gamma.Degrees + 90 : gamma.Degrees - 90;

                // Set `Gamma` attribute of bar
                IRobotBar bar = bars.Get(vector.Key);
                bar.Gamma = gamma_up;
            }

            // Redraw all views
            robot_app.Project.ViewMngr.Refresh();
        }