欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Revit二次开发-3

程序员文章站 2022-04-02 09:39:31
...

选取元素

{
    try
    {
        UIDocument uidoc = revit.Application.ActiveUIDocument;
        Document doc = revit.Application.ActiveUIDocument.Document;
        Reference pickedElemRef = uidoc.Selection.PickObject(ObjectType.Element);
        Element elem = uidoc.Document.GetElement(pickedElemRef.ElementId);
        string info = "所选元素类型为:";
        info += "\n\t" + elem.GetType().ToString();
        TaskDialog.Show("Revit", info);
    }
    catch(Exception e)
    {
        message = e.Message;
        return Autodesk.Revit.UI.Result.Failed;
    }

    return Autodesk.Revit.UI.Result.Succeeded;
}
相关标签: Revit