}//getSectionDatabase public IRobotNamesArray loadProfileDatabase(string database, string type) { //Access the IRobotLabelServer IRobotLabelServer labelServer = getLabelServer(); //Change the current section database string sDBName = database; IRobotSectionDatabase sectionDBase = getSectionDatabase(sDBName); IRobotNamesArray profiles = (RobotNamesArray)sectionDBase.GetAll(); RobotNamesArray filtered = new RobotNamesArray(); int filterSize = 1; for (int i = 1; i < profiles.Count; i++) { //Defines the size of the Array //Console.WriteLine(profiles.Get(i)); if (profiles.Get(i).StartsWith(type)) { filterSize++; } } //Console.WriteLine(filterSize); filtered.SetSize(filterSize); //Labeling the filter int pos = 1; for (int i = 1; i < profiles.Count; i++) { if (profiles.Get(i).StartsWith(type)) { filtered.Set(pos, profiles.Get(i)); pos++; } } return(filtered); }//loadProfileDatabase
private void Form1_Load(object sender, EventArgs e) { //Start connection with Robot structure = Structure.getInstance(); structure.createProject(); lblStatus.Text = "Status: Projeto pronto."; //Adding itens to the profile combo boxes //Beans section //lblStatus.Text = "Status: Carregando banco de dados de perfis..."; IRobotNamesArray ciscSection = structure.loadProfileDatabase("CISC", "W "); IRobotNamesArray pipeSection = structure.loadProfileDatabase("AISC", "P "); for (int i = 1; i < ciscSection.Count; i++) { cbBeamSection.Items.Add(ciscSection.Get(i)); cbWheelBeamSection.Items.Add(ciscSection.Get(i)); } for (int i = 1; i < pipeSection.Count; i++) { cbPipeSection.Items.Add(pipeSection.Get(i)); cbColumnBracket.Items.Add(pipeSection.Get(i)); } if (nupNumericDivision.Value == 0) { cbColumnBracket.Enabled = false; } cbBeamSection.SelectedIndex = 0; cbWheelBeamSection.SelectedIndex = 0; cbPipeSection.SelectedIndex = 0; cbColumnBracket.SelectedIndex = 0; //Setting the default units structure.unitSettings("mm", "mm"); }
//窗体加载时 private void Form1_Load(object sender, EventArgs e) { // connect to Robot //实例化一个ROBOT程序类 iapp = new RobotApplicationClass(); if (iapp.Project.IsActive == 0) { // we need an opened project to get names of available supports and bar sections // create a new project if not connected to existing one //创建一个2D框架的工程 iapp.Project.New(IRobotProjectType.I_PT_FRAME_2D); } // fill combo-boxes with names of bar sections available in Robot //从ROBOT中获取断面库,然后给定义梁,柱的下拉列表赋值 IRobotNamesArray inames = iapp.Project.Structure.Labels.GetAvailableNames(IRobotLabelType.I_LT_BAR_SECTION); for (int i = 1; i < inames.Count; ++i) { comboColumns.Items.Add(inames.Get(i)); comboBeams.Items.Add(inames.Get(i)); } comboBeams.SelectedIndex = 0; comboColumns.SelectedIndex = 0; // fill combo-boxes with names of supports available in Robot //从Robot中获取支撑种类,填充到支撑下拉列表中 inames = iapp.Project.Structure.Labels.GetAvailableNames(IRobotLabelType.I_LT_SUPPORT); for (int i = 1; i < inames.Count; ++i) { comboSupportLeft.Items.Add(inames.Get(i)); comboSupportRight.Items.Add(inames.Get(i)); } comboSupportLeft.SelectedIndex = 0; comboSupportRight.SelectedIndex = 0; }