我正在尝试创建运行以下代码的详细信息组件按钮。但是,我需要它在2015-2018工作,可能在2019年。
目前我已经制作了自定义功能区和按钮,但由于第一行中的macro
不起作用,我无法使此脚本正常工作。我已尝试将其作为FamilySymbol symbol = GetElements<FamilySymbol> (commandData.Application.ActiveUIDocument.Document)
.Where(item => item.Name == "NameYouWant")
.First();
commandData.Application.ActiveUIDocument.PromptForFamilyInstancePlacement(symbol);
/// <summary>
/// Get the collection of elements of the specified type.
/// <para>The specified type must derive from Element, or you can use Element but you get everything :)</para>
/// </summary>
/// <typeparam name="T">The type of element to get</typeparam>
/// <returns>The list of elements of the specified type</returns>
public IEnumerable<T> GetElements<T>(Document document) where T : Element
{
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(T));
return collector.Cast<T>();
}
进行测试,以便在继续之前尝试查看它是否会先发挥作用。
Family = Break Line
Type = Break Line
它位于项目浏览器的详细信息项目中
for (var p in $scope.bulk.Langugaes) {
$scope.lsLanguagewithTextndValue.push($scope.bulk.Langugaes[p].Value, $scope.bulk.Langugaes[p].Text);
}
任何帮助将不胜感激!
答案 0 :(得分:0)
commandData
参数是Revit传递给外部命令的Execute
方法的参数。它包括使外部命令与Revit及其数据库联系的数据。
宏提供了一种访问Revit及其数据库的不同方法。
通过Revit API getting started material或Revit developer guide hello world walkthroughs查看如何设置外部命令以根据需要传入commandData
。