ViewHandleCommand.cs 797 B

12345678910111213141516171819202122232425262728
  1. using Autodesk.Revit.Attributes;
  2. using Autodesk.Revit.DB;
  3. using Autodesk.Revit.UI;
  4. using FWindSoft.Common;
  5. using FWindSoft.Revit;
  6. using FWindSoft.Revit.Menu;
  7. using FWindSoft.WindowsApi;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. namespace LRH.Tool
  14. {
  15. [Transaction(TransactionMode.Manual)]
  16. [Regeneration(RegenerationOption.Manual)]
  17. [Button(ButtonName = "句柄获取")]
  18. public class ViewHandleCommand : ExternalCommand
  19. {
  20. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  21. {
  22. var handle=WinAPI.FindChildWindowByTitle(App.MainHandle, RevitCore.Doc.ActiveView.Title);
  23. return Result.Succeeded;
  24. }
  25. }
  26. }