revit二次开发的问题
初学revit二次开发,下面一段代码,生成无错,执行无反应,是代码的问题吗?
using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.Attributes;
namespace HelloRevit
{ [Transaction(TransactionMode.Manual)] public class Class1 : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication revit = commandData.Application; ElementSet collection = new ElementSet(); ElementSet selWall = new ElementSet(); foreach (ElementId elementId in revit.ActiveUIDocument.Selection.GetElementIds()) { collection.Insert(revit.ActiveUIDocument.Document.GetElement(elementId)); foreach (Element ele in collection) { Wall wall = ele as Wall; if (wall !=null) { selWall.Insert(ele); } } } return Result.Succeeded; } }
}