使用python在Revit中放置详图构件

2024-03-28 20:11:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试创建运行以下代码的详图构件按钮。不过,我需要它在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

任何帮助都将不胜感激!你知道吗


Tags: oftheapplicationtypeelementsymboldocument按钮
1条回答
网友
1楼 · 发布于 2024-03-28 20:11:20

commandData参数是Revit传递给外部命令的Execute方法的参数。它包括使外部命令能够与Revit及其数据库联系的数据。你知道吗

宏提供了访问Revit及其数据库的不同方法。你知道吗

通过Revit API getting started materialRevit developer guide hello world walkthroughs查看如何设置外部命令以根据需要传递commandData。你知道吗

相关问题 更多 >