首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用python在Revit中放置详图构件

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

Stack Overflow用户
提问于 2018-05-16 22:47:19
回答 1查看 104关注 0票数 0

我正在尝试创建运行以下代码的detail组件按钮。然而,我需要它在2015-2018年可能在2019年在未来工作。

目前,我有自定义功能区和按钮,但我不能得到这个脚本工作,因为在第一行的commandData不工作。我尝试将其作为macro进行测试,只是想先看看它是否能正常工作,然后再继续。

代码语言:javascript
复制
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>();
    }

它位于项目浏览器的详细信息项中

代码语言:javascript
复制
Family = Break Line
Type   = Break Line

任何帮助都将不胜感激!

EN

回答 1

Stack Overflow用户

发布于 2018-05-22 03:07:28

commandData参数是由Revit传递到外部命令的Execute方法中的参数。其中包括使外部命令能够与Revit及其数据库取得联系的数据。

宏提供了另一种访问Revit及其数据库的方法。

通过Revit API getting started material或Revit developer guide hello world walkthroughs了解如何设置外部命令,以便根据需要传入commandData。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50373980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档