public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Autodesk.Revit.ApplicationServices.Application app = uiapp.Application; Document doc = uidoc.Document; ElementSelector elementSelector = new ElementSelector(); Element element = elementSelector.SeclectElement(doc, uidoc); ParameterProcess parameterProcess = new ParameterProcess(); SampleCreateSharedParameter sampleCreateSharedParameter = new SampleCreateSharedParameter(doc, app); sampleCreateSharedParameter.LINK = @"C:\Users\OAI-IICM\Desktop\APIRevit-C#\Project\IICM\API_revit_IICM_1020\Define\Structural-Parameters.txt"; shareParameters.AddRange(sampleCreateSharedParameter.GetListShareParamerter(element)); int loop = 1; do { foreach (Parameter para in element.Parameters) { ParameterModel p = parameterProcess.GetParameterInformation(para, doc, id); if (shareParameters.Contains(p.NAME)) { listParamrter.Add(p); id++; } } if (listParamrter.Count > 0) { break; } sampleCreateSharedParameter.CreateSampleSharedParameters(element); ++loop; } while (loop < 2);; ///show dialog update param /// using (FormIO formIO = new FormIO(listParamrter)) { DialogResult dr = formIO.ShowDialog(); if (dr == DialogResult.OK) { //do update List <ParameterModel> listNewParam = new List <ParameterModel>(); listNewParam = formIO.VALUE; foreach (var new_para in listNewParam) { parameterProcess.setParameterToElent(new_para.PARAMETER, doc, new_para.VALUE); } } } return(Result.Succeeded); //throw new NotImplementedException(); }
private void Init() { configManager = ConfigManager.Instance; MotionCardManager = Hardware.MotionCardManager.Instance; IoCardManager = Hardware.IoCardManager.Instance; IoDeviceManager = Hardware.IoDeviceManager.Instance; CameraManager = Hardware.CameraManager.Instance; AxisManager = Hardware.AxisManager.Instance; LogicAxisUnitManager = Hardware.LogicAxisUnite.LogicAxisUnitManager.Instance; int rtn = -1; try { rtn = EzdLaser.Lmc1Initial(AppDomain.CurrentDomain.BaseDirectory + "Laser", 0, new IntPtr { }); } catch (Exception ex) { FileOperate.Log.WriteString($"金橙子激光器连接异常: {ex.Message}, rtn is {rtn}"); } //Stationtest stationtest = new Stationtest("test"); //StationManager.Instance.StationDictionry.Add(stationtest.StationName, stationtest); //StationManager.Instance.InitAll(); DelegateUIControl.Instance.RichTxtBoxZdS.Add("FormMain_RichTBoxZD_Log", this.rTBZD_Log); try { if (IoDeviceManager.IODeviceS.Count > 0) { formIO = new FormIO(); formIO.Dock = DockStyle.Fill; tabNavigationPage_IoDevice.Controls.Add(formIO); } else { tabNavigationPage_IoDevice.PageVisible = false; } if (CameraManager.Cameras.Count > 0) { formVision = new FormVision(); formVision.Dock = DockStyle.Fill; tabNavigationPage_Cameras.Controls.Add(formVision); } else { tabNavigationPage_Cameras.PageVisible = false; } if (LogicAxisUnitManager.Instance.LogicAxisUnitS.Count > 0) { FormAxisUnit formAxisUnit = new FormAxisUnit(); formAxisUnit.Dock = DockStyle.Fill; tabNavigationPage_LogicAxisUnit.Controls.Add(formAxisUnit); tabNavigationPage_LogicAxisUnit.PageVisible = true; } else { tabNavigationPage_LogicAxisUnit.PageVisible = false; } if (AxisManager.AxisDeviceS.Count > 0) { formAxis = new FormAxis(); formAxis.Dock = DockStyle.Fill; tabNavigationPage_AxisDevice.Controls.Add(formAxis); tabNavigationPage_AxisDevice.PageVisible = true; } else { tabNavigationPage_AxisDevice.PageVisible = false; } tabPane.SelectedPage = tabPage_Auto; tabNagPage_Menu.PageVisible = false; foreach (var mem in tabPane_Menu.Pages) { if (mem.PageVisible == true) { tabNagPage_Menu.PageVisible = true; break; } } FormAuto formAuto = new FormAuto(); formAuto.Dock = DockStyle.Fill; this.splitContainer1.Panel1.Controls.Add(formAuto); } catch (Exception ex) { MessageBox.Show(ex.Message, "异常"); Environment.Exit(0); } }