/// <summary> /// Links in a Revit File or files /// using a Dialog box within the active document; /// pins the instance of the Revit Link Origin-to-Origin automatically. /// Returns the name of the main file which should be used for Copy-Monitoriing etc /// </summary> /// <param name="doc">Active Document</param> public static ElementId CreateLinkRevit(this Document doc) { // Ask the user which links they would like to add to the project // Call the ShowDialog method to show the dialog box filtered to show only Revit Projects // Choose the main link to base the document on for Copy-Monitoring TaskDialog td_mainrvtlnk = TaskDialogUtil.Create("Main Revit Link", "Select the link which should be used to set up Grids and Levels for Copy Monitoring", TaskDialogIcon.TaskDialogIconNone); OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = false; ofd.Filter = "Revit Documents|*.rvt"; TaskDialog td_addtlrvtlnk = TaskDialogUtil.Create("Additional Revit Links", "Select any additional links which should be added to the project", TaskDialogIcon.TaskDialogIconNone); OpenFileDialog ofd2 = new OpenFileDialog(); ofd2.Multiselect = true; ofd2.Filter = "Revit Documents|*.rvt"; td_mainrvtlnk.Show(); DialogResult dr = ofd.ShowDialog(); //If the user clicks ok - record the name of main RVT Link if (dr == System.Windows.Forms.DialogResult.OK || dr == DialogResult.Cancel) { //Add the link selected to a list for later string lnk_cm = ofd.FileName; td_addtlrvtlnk.Show(); DialogResult dr2 = ofd2.ShowDialog(); //If the user clicks ok - continue if (dr2 == System.Windows.Forms.DialogResult.OK || dr2 == DialogResult.Cancel) { //Link in the revit files //Add the links selected to a list List <string> rvtfiles = new List <string>(); rvtfiles.Add(ofd.FileName); foreach (string x in ofd2.FileNames) { rvtfiles.Add(x); } InstanceMaker(doc, rvtfiles); } } // Gets the elementID of the link you want for copy-monitoring ElementId cm_linkid = RevitLinkType.GetTopLevelLink(doc, ModelPathUtils.ConvertUserVisiblePathToModelPath(ofd.FileName)); return(cm_linkid); }
public HResult SetFooterIcon(NiTaskDialogIcon footerIcon) { try { _taskDialog.FooterIcon = TaskDialogUtil.EncodeIcon(footerIcon); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult SetProgressBarState(NiProgressBarState state) { try { _active.SetProgressBarState(TaskDialogUtil.DecodeProgressBarState(state)); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult SetCommonButtons(NiTaskDialogCommonButtons commonButtons) { try { _taskDialog.CommonButtons = TaskDialogUtil.EncodeCommonButtons(commonButtons); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult UpdateFooterIcon(NiTaskDialogIcon icon) { try { _active.UpdateFooterIcon(TaskDialogUtil.EncodeIcon(icon)); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult GetFooterIcon(out NiTaskDialogIcon footerIcon) { footerIcon = 0; try { footerIcon = TaskDialogUtil.DecodeIcon(_taskDialog.FooterIcon); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult GetMainIcon(out NiTaskDialogIcon mainIcon) { mainIcon = 0; try { mainIcon = TaskDialogUtil.DecodeIcon(_taskDialog.MainIcon); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult GetCommonButtons(out NiTaskDialogCommonButtons commonButtons) { commonButtons = 0; try { commonButtons = TaskDialogUtil.DecodeCommonButtons(_taskDialog.CommonButtons); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }