【问题标题】:Use python to get filter rule information in Revit APIRevit API中使用python获取过滤规则信息
【发布时间】:2018-09-07 06:36:15
【问题描述】:

我已经启动了一个提取过滤规则信息的python脚本,但是找不到从“GetRuleParameters()”中获取信息的方法

非常感谢任何帮助。我看过很多关于创建规则过滤器的信息,但很少看到关于提取规则信息的信息。
Here is an example for filter overrides in a view

这是我所在的地方:

pfes = list(FilteredElementCollector(doc).OfClass(ParameterFilterElement).ToElements()) for pfe in pfes:
    rps = pfe.GetRuleParameters()
    for rp in rps:
        print rp.ToString()
        el = doc.GetElement(rp)
        print el

【问题讨论】:

    标签: revit-api revit revitpythonshell pyrevit


    【解决方案1】:

    您可以使用 RevitLookup 来探索通过元素 ID 列表或research in more depth using the interactive RPS console 返回的规则参数元素的属性和参数值。

    【讨论】:

    • 谢谢杰里米。我没有在 Revit 查找工具中找到规则,也不知道在 python 中使用哪些属性来获取更多信息。如果您有想法,很高兴尝试一些。
    【解决方案2】:

    作为起点,打印类的名称比将类转换为字符串更有帮助。但这不会让你得到一切。 GetRuleParameters 将返回规则中使用的参数的 elementID;但是,内置参数的元素 id 是负数。如果参数的元素 ID 为负,GetElement 函数似乎不会找到参数。我找不到从 id 获取内置参数的方法。

    for pfe in pfes:
        print(pfe.Name)
        rps = pfe.GetRuleParameters()
    
    
        for rp in rps:
    
            el = doc.GetElement(rp)
    
            # this will only work if the parameter used in the
            # filter is not built in
            try:
                print("\t" + el.Name)
            except:
                pass
    

    【讨论】:

    • 谢谢丹尼斯,这是正确的方向。嗯...我想知道我是否查找每个参数。好的...这行得通。伟大的! for pfe in pfes: print(pfe.Name) rps = pfe.GetRuleParameters() for rp in rps: el = doc.GetElement(rp) # this will only work if the parameter used in the # filter is not built in if el: for p in el.Parameters: print p.Definition.Name
    • 这里是一个输出示例:Callouts Elevations Sections_does not contain FF
    猜你喜欢
    • 2018-11-06
    • 2021-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-13
    • 2013-01-07
    • 2011-10-31
    相关资源
    最近更新 更多