是否有将Revit中的所有元素和特征写入.csv文件的功能?

2024-10-02 12:22:30 发布

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

我使用Revit(PyRevit)并希望在.csv文件中创建所有使用的元素及其特征

这是一个例子:

Get Parameter Value by Name 
Get value of one of element's parameters.

TESTED REVIT API: 2016,2017

Author: Francisco Possetto | github.com/franpossetto

Shared on www.revitapidocs.com
For more information visit http://github.com/gtalarico/revitapidocs
License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
"""

#Imports.
from Autodesk.Revit.DB import Element

doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument

def get_parameter_value_by_name(element, parameterName):
    return element.LookupParameter(parameterName).AsValueString()

#Select elements from revit.
selection = [doc.GetElement(x) for x in uidoc.Selection.GetElementIds()]

#Example with Walls.
for wall in selection:
    print get_parameter_value_by_name(wall, "Base Constraint")

但我只得到了“基本约束”,是否有可能将所有元素/类别都放到该文件中

非常感谢。致意


Tags: 文件offromgithubcomhttp元素get
1条回答
网友
1楼 · 发布于 2024-10-02 12:22:30

可以使用rpwCollector获取所有FamilySymbol元素。如果您只希望项目中的所有实例。只需使用“FamilyInstance”即可获得它们

from rpw import db

collector = db.Collector(of_class='FamilySymbol')
elements = collector.get_elements()

for e in elements:
    print(e.name)

相关问题 更多 >

    热门问题