每当AutoDea.Real.UI.RESULT.失败或AutoDea.Real.UI.RESULTE取消时返回。参数消息不为空,出现错误或警告对话框。此外,如果有元素添加到元素参数中,这些元素将在屏幕上突出显示。它是每当命令失败时,设置消息参数的方法,不管是否元素也被返回。
class IExternalcommand_elements : IExternalCommand
{
public Result Execute(
Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
{
message = "Please note the highlighted Walls.";
FilteredElementCollector collector =new FilteredElementCollector(commandData.Application.ActiveUIDocument.Document);
ICollection<Element> collection = collector.OfClass(typeof(Wall)).ToElements();
foreach (Element e in collection)
{
elements.Insert(e);
}
return Result.Failed;
}
}