Revit二次开发之TaskDialog
revit自身对话框
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
//[Journaling(JournalingMode.NoCommandData)]
public class TaskDlg : IExternalCommand
{
public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
{
RevitApp.Application app = revit.Application.Application;
Document activeDoc = revit.Application.ActiveUIDocument.Document;
TaskDialog mainDlg = new TaskDialog("Hello Revit");
mainDlg.MainInstruction = "Hi,Revit";
mainDlg.MainContent = "内容";
mainDlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "link1");
mainDlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "link2");
mainDlg.CommonButtons = TaskDialogCommonButtons.Close;
mainDlg.DefaultButton = TaskDialogResult.Close;
mainDlg.FooterText = "<a href=\"http://revit.5d6d.com\">revit二次开发论坛</a>";
TaskDialogResult tResult = mainDlg.Show();
if (TaskDialogResult.CommandLink1 == tResult)
{
TaskDialog dlgLink1 = new TaskDialog("info1");
dlgLink1.MainInstruction =
"Revit Version Name is:" + app.VersionName + "\n"
+ "Revit Version Number is:" + app.VersionNumber + "\n"
+ "Revit Version Build is:" + app.VersionBuild;
dlgLink1.Show();
}
else if (TaskDialogResult.CommandLink2 == tResult)
{
TaskDialog.Show("Active Document Inforamtion",
"Active document:" + activeDoc.Title + "\n"
+ "Active view name:" + activeDoc.ActiveView.Name);
}
return Autodesk.Revit.UI.Result.Succeeded;
}
}
[Regeneration(RegenerationOption.Manual)]
//[Journaling(JournalingMode.NoCommandData)]
public class TaskDlg : IExternalCommand
{
public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
{
RevitApp.Application app = revit.Application.Application;
Document activeDoc = revit.Application.ActiveUIDocument.Document;
TaskDialog mainDlg = new TaskDialog("Hello Revit");
mainDlg.MainInstruction = "Hi,Revit";
mainDlg.MainContent = "内容";
mainDlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "link1");
mainDlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "link2");
mainDlg.CommonButtons = TaskDialogCommonButtons.Close;
mainDlg.DefaultButton = TaskDialogResult.Close;
mainDlg.FooterText = "<a href=\"http://revit.5d6d.com\">revit二次开发论坛</a>";
TaskDialogResult tResult = mainDlg.Show();
if (TaskDialogResult.CommandLink1 == tResult)
{
TaskDialog dlgLink1 = new TaskDialog("info1");
dlgLink1.MainInstruction =
"Revit Version Name is:" + app.VersionName + "\n"
+ "Revit Version Number is:" + app.VersionNumber + "\n"
+ "Revit Version Build is:" + app.VersionBuild;
dlgLink1.Show();
}
else if (TaskDialogResult.CommandLink2 == tResult)
{
TaskDialog.Show("Active Document Inforamtion",
"Active document:" + activeDoc.Title + "\n"
+ "Active view name:" + activeDoc.ActiveView.Name);
}
return Autodesk.Revit.UI.Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。