初學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; } }
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/271782.html
標籤:C#
下一篇:簡單創建ASP.NET網站(1)
