Exemplo n.º 1
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);
        }