|
- <p>
- </p><p>[Transaction(TransactionMode.Manual)]</p><p>[Regeneration(RegenerationOption.Manual)]</p><p>//[Journaling(JournalingMode.NoCommandData)]</p><p>public class TaskDlg : IExternalCommand</p><p>{</p><p> public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)</p><p> {</p><p> RevitApp.Application app = revit.Application.Application;</p><p> Document activeDoc = revit.Application.ActiveUIDocument.Document;</p><p>
- </p><p> TaskDialog mainDlg = new TaskDialog("Hello Revit");</p><p> mainDlg.MainInstruction = "Hi,Revit";</p><p> mainDlg.MainContent = "内容";</p><p>
- </p><p> mainDlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "link1");</p><p> mainDlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "link2");</p><p>
- </p><p> mainDlg.CommonButtons = TaskDialogCommonButtons.Close;</p><p> mainDlg.DefaultButton = TaskDialogResult.Close;</p><p>
- </p><p> mainDlg.FooterText = "<a href=\"http://revit.5d6d.com\">revit二次开发论坛</a>";</p><p> TaskDialogResult tResult = mainDlg.Show();</p><p>
- </p><p> if (TaskDialogResult.CommandLink1 == tResult)</p><p> {</p><p> TaskDialog dlgLink1 = new TaskDialog("info1");</p><p> dlgLink1.MainInstruction =</p><p> "Revit Version Name is:" + app.VersionName + "\n"</p><p> + "Revit Version Number is:" + app.VersionNumber + "\n"</p><p> + "Revit Version Build is:" + app.VersionBuild;</p><p> dlgLink1.Show();</p><p> }</p><p> else if (TaskDialogResult.CommandLink2 == tResult)</p><p> {</p><p> TaskDialog.Show("Active Document Inforamtion",</p><p> "Active document:" + activeDoc.Title + "\n"</p><p> + "Active view name:" + activeDoc.ActiveView.Name);</p><p> }</p><p>
- </p><p> return Autodesk.Revit.UI.Result.Succeeded;</p><p> }</p><p>}</p>
复制代码 |
|