1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public static void IdlingHandler(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs args) { UIApplication uiapp = sender as UIApplication; if (uiapp != null) { Autodesk.Revit.UI.UIDocument uidoc = uiapp.ActiveUIDocument; Autodesk.Revit.DB.Document doc = uidoc.Document; if (uidoc != null && doc != null) { Reference re = uidoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, ""); Element e = doc.GetElement(re); UserControl1.mainPage.Label1.Content = e.Id.ToString() + "\r"; uiapp.Idling -= IdlingHandler; } } else { System.Windows.Forms.MessageBox.Show("Must should Idling!"); } }
|