Ejemplo n.º 1
0
        public static void AddBar(RobotStructure structureRSA, RobotNode node1, RobotNode node2, IRobotLabel labelSect)
        {
            int            num1    = node1.Number;
            int            num2    = node2.Number;
            RobotBarServer barsRSA = structureRSA.Bars;
            int            freeNum = barsRSA.FreeNumber;

            barsRSA.Create(freeNum, num1, num2);
            RobotSelection selection = structureRSA.Selections.Create(IRobotObjectType.I_OT_BAR);

            selection.FromText(freeNum.ToString());
            barsRSA.SetLabel(selection, IRobotLabelType.I_LT_BAR_SECTION, labelSect.Name);
        }
        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.º 3
0
        /// <summary>
        /// Gets the FE meshes from a Robot model using the fast query method
        /// </summary>
        /// <param name="panel_ids"></param>
        /// <param name="coords"></param>
        /// <param name="vertex_indices"></param>
        /// <param name="str_nodes"></param>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static bool GetFEMeshQuery(out int[] panel_ids, out double[][] coords, out Dictionary <int, int[]> vertex_indices, string filePath = "LiveLink")
        {
            RobotApplication robot = null;

            if (filePath == "LiveLink")
            {
                robot = new RobotApplication();
            }

            //First call getnodesquery to get node points
            double[][] nodeCoords = null;

            //Dictionary<int, BHoM.Structural.Node> _str_nodes = new Dictionary<int, BHoM.Structural.Node>();
            //RobotToolkit.Node.GetNodesQuery(project, filePath);
            //Dictionary<int, int> _nodeIds = new Dictionary<int, int>();
            //for (int i = 0; i < _str_nodes.Count; i++)
            //{
            //    _nodeIds.Add(_str_nodes.ElementAt(i).Value.Number, i);
            //}

            RobotResultQueryParams      result_params = (RobotResultQueryParams)robot.Kernel.CmpntFactory.Create(IRobotComponentType.I_CT_RESULT_QUERY_PARAMS);
            RobotStructure              rstructure    = robot.Project.Structure;
            RobotSelection              FE_sel        = rstructure.Selections.CreateFull(IRobotObjectType.I_OT_FINITE_ELEMENT);
            IRobotResultQueryReturnType query_return  = IRobotResultQueryReturnType.I_RQRT_MORE_AVAILABLE;
            RobotSelection              cas_sel       = rstructure.Selections.Create(IRobotObjectType.I_OT_CASE);

            try { cas_sel.FromText(robot.Project.Structure.Cases.Get(1).Number.ToString()); } catch { }

            if (cas_sel.Count > 0)
            {
                result_params.Selection.Set(IRobotObjectType.I_OT_CASE, cas_sel);
            }

            //result_params.Selection.Set(IRobotObjectType.I_OT_NODE, FE_sel);

            result_params.SetParam(IRobotResultParamType.I_RPT_MULTI_THREADS, true);
            result_params.SetParam(IRobotResultParamType.I_RPT_THREAD_COUNT, 4);
            result_params.SetParam(IRobotResultParamType.I_RPT_SMOOTHING, IRobotFeResultSmoothing.I_FRS_NO_SMOOTHING);
            result_params.SetParam(IRobotResultParamType.I_RPT_DIR_X_DEFTYPE, IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN);
            result_params.SetParam(IRobotResultParamType.I_RPT_DIR_X, new double[] { 1, 0, 0 });

            result_params.SetParam(IRobotResultParamType.I_RPT_NODE, 1);
            result_params.SetParam(IRobotResultParamType.I_RPT_PANEL, 1);
            result_params.SetParam(IRobotResultParamType.I_RPT_ELEMENT, 1);
            result_params.SetParam(IRobotResultParamType.I_RPT_RESULT_POINT_COORDINATES, 1);

            result_params.ResultIds.SetSize(2);
            result_params.ResultIds.Set(1, (int)IRobotFeResultType.I_FRT_DETAILED_MXX);
            result_params.ResultIds.Set(2, (int)IRobotFeResultType.I_FRT_DETAILED_MYY);

            RobotResultRowSet row_set = new RobotResultRowSet();
            bool           ok         = false;
            RobotResultRow result_row = default(RobotResultRow);

            List <int> _panel_ids = new List <int>();
            Dictionary <int, int[]> _vertex_indices = new Dictionary <int, int[]>();
            int kounta = 0;

            while (!(query_return == IRobotResultQueryReturnType.I_RQRT_DONE))
            {
                query_return = rstructure.Results.Query(result_params, row_set);
                ok           = row_set.MoveFirst();
                while (ok)
                {
                    //int panel_num = (int)row_set.CurrentRow.GetValue(1252);
                    //_panel_ids.Add(panel_num);

                    int nodeId = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_NODE);
                    //int panelId = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_PANEL);
                    int elementId = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_ELEMENT);

                    //int number_of_indices = (row_set.CurrentRow.IsAvailable(567)) ? 4 : 3;
                    //int[] temp_indices = new int[number_of_indices];
                    //for (int i = 0; i < number_of_indices; i++)
                    //{
                    //    temp_indices[i] = (int)row_set.CurrentRow.GetValue(564 + i);
                    //}

                    var resultIds = row_set.ResultIds;

                    var xxxx = row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_RESULT_POINT_COORDINATES);



                    //_vertex_indices.Add(kounta, temp_indices);
                    //kounta++;
                    ok = row_set.MoveNext();
                }
                row_set.Clear();
            }
            result_params.Reset();

            panel_ids      = _panel_ids.ToArray();
            vertex_indices = _vertex_indices;
            coords         = nodeCoords;
            //str_nodes = _str_nodes;
            return(true);
        }