我正在尝试创建运行以下代码的详图构件按钮。不过,我需要它在2015-2018年可能是2019年的未来工作。你知道吗
目前我已经制作了自定义功能区和按钮,但是由于第一行中的commandData
不起作用,我无法让这个脚本工作。我试着将其作为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
任何帮助都将不胜感激!你知道吗
commandData
参数是Revit传递给外部命令的Execute
方法的参数。它包括使外部命令能够与Revit及其数据库联系的数据。你知道吗宏提供了访问Revit及其数据库的不同方法。你知道吗
通过Revit API getting started material或Revit developer guide hello world walkthroughs查看如何设置外部命令以根据需要传递
commandData
。你知道吗相关问题 更多 >
编程相关推荐