static void Main(string[] args)
        {
            Console.WriteLine("Starting Robot application...");
            //Cria um novo objeto da aplicação Robot
            IRobotApplication robApp = new RobotApplicationClass();

            //Se a aplicaçao não estiver visivel, torna o robot visivel para permitir iteracao
            if (robApp.Visible == 0)
            {
                robApp.Interactive = 1;
                robApp.Visible     = 1;
            }

            Console.WriteLine("Creating concrete project...");
            //Cria o projeto da viga de concreto
            robApp.Project.New(IRobotProjectType.I_PT_SHELL);

            Console.WriteLine("Executing project settings...");
            //Configuracao das preferencias
            RobotProjectPreferences projectPrefs = robApp.Project.Preferences;

            //Configuracoes do codigo de verificacao da estrutura de concreto
            projectPrefs.SetActiveCode(IRobotCodeType.I_CT_RC_THEORETICAL_REINF, "BAEL 91");

            //Configuracao das preferencias de malha
            RobotMeshParams meshParams = projectPrefs.MeshParams;

            meshParams.SurfaceParams.Method.Method          = IRobotMeshMethodType.I_MMT_DELAUNAY;
            meshParams.SurfaceParams.Generation.Type        = IRobotMeshGenerationType.I_MGT_ELEMENT_SIZE;
            meshParams.SurfaceParams.Generation.ElementSize = 0.5;
            meshParams.SurfaceParams.Delaunay.Type          = IRobotMeshDelaunayType.I_MDT_DELAUNAY;

            //Geração da estrutura
            Console.WriteLine("Generating structure");
            IRobotStructure str = robApp.Project.Structure;

            Console.WriteLine("Generating nodes...");
            str.Nodes.Create(1, 0, 0, 0);
            str.Nodes.Create(2, 3, 0, 0);
            str.Nodes.Create(3, 3, 3, 0);
            str.Nodes.Create(4, 0, 3, 0);
            str.Nodes.Create(5, 0, 0, 4);
            str.Nodes.Create(6, 3, 0, 4);
            str.Nodes.Create(7, 3, 3, 4);
            str.Nodes.Create(8, 0, 3, 4);

            str.Bars.Create(1, 1, 5);
            str.Bars.Create(2, 2, 6);
            str.Bars.Create(3, 3, 7);
            str.Bars.Create(4, 4, 8);
            str.Bars.Create(5, 5, 6);
            str.Bars.Create(6, 7, 8);

            Console.WriteLine("Generating labels...");
            RobotLabelServer labels = str.Labels;

            string columnSectionName = "Rect. Column 30*30";

            IRobotLabel label = labels.Create(IRobotLabelType.I_LT_BAR_SECTION, columnSectionName);

            RobotBarSectionData section = (RobotBarSectionData)label.Data;

            section.ShapeType = IRobotBarSectionShapeType.I_BSST_CONCR_COL_R;

            RobotBarSectionConcreteData concrete = (RobotBarSectionConcreteData)section.Concrete;

            concrete.SetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_B, 0.3);
            concrete.SetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H, 0.3);

            section.CalcNonstdGeometry();
            labels.Store(label);

            Console.WriteLine("Defining sections...");
            RobotSelection selectionBars = str.Selections.Get(IRobotObjectType.I_OT_BAR);

            selectionBars.FromText("1 2 3 4");
            str.Bars.SetLabel(selectionBars, IRobotLabelType.I_LT_BAR_SECTION, columnSectionName);

            RobotSectionDatabaseList steelSections = projectPrefs.SectionsActive;

            if (steelSections.Add("RCAT") == 1)
            {
                Console.WriteLine("Warning! Steel section base RCAT not found...");
            }

            selectionBars.FromText("5 6");
            label = labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "HEA 340");
            str.Labels.Store(label);
            str.Bars.SetLabel(selectionBars, IRobotLabelType.I_LT_BAR_SECTION, "HEA 340");

            Console.WriteLine("Defining materials...");

            string materialName = "Concrete 30";

            label = labels.Create(IRobotLabelType.I_LT_MATERIAL, materialName);

            RobotMaterialData material = (RobotMaterialData)label.Data;

            material.Type     = IRobotMaterialType.I_MT_CONCRETE;
            material.E        = 3E+09;
            material.NU       = 1 / 6;
            material.RO       = 25000;
            material.Kirchoff = material.E / (2 * (1 + material.NU));

            Console.WriteLine("Generating slab...");
            RobotPointsArray points = (RobotPointsArray)robApp.CmpntFactory.Create(IRobotComponentType.I_CT_POINTS_ARRAY);

            points.SetSize(5);
            points.Set(1, 0, 0, 4);
            points.Set(2, 3, 0, 4);
            points.Set(3, 3, 3, 4);
            points.Set(4, 0, 3, 4);
            points.Set(5, 0, 0, 4);

            string slabSectionName = "Slab 30";

            label = labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, slabSectionName);

            RobotThicknessData thickness = (RobotThicknessData)label.Data;

            thickness.MaterialName  = materialName;
            thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS;

            RobotThicknessHomoData thicknessData = (RobotThicknessHomoData)thickness.Data;

            thicknessData.ThickConst = 0.3;
            labels.Store(label);

            RobotObjObject slab;
            int            objNumber = str.Objects.FreeNumber;

            str.Objects.CreateContour(objNumber, points);
            slab = (RobotObjObject)str.Objects.Get(objNumber);
            slab.Main.Attribs.Meshed = 1;
            slab.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, slabSectionName);
            slab.Initialize();

            Console.WriteLine("Adding hole in the slab...");

            points.Set(1, 1.1, 1.1, 4);
            points.Set(2, 2.5, 1.1, 4);

            RobotObjObject hole;



            Console.ReadLine();
        }
Ejemplo n.º 2
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);
        }