'Is there an function for writing all Elements and Characteristics from Revit in an .csv file?
I use Revit(PyRevit) and want to wirte all used Elements with their characteristics in an .csv file.
This is one example:
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")
But there I only get "Base Constraint" is it possible to get all Elements/Categories into that file?
Thanks a lot. Best regards
Solution 1:[1]
You can use rpw Collector to get all FamilySymbol elements. If you only want all instances in your project. Just use 'FamilyInstance' to get them.
from rpw import db
collector = db.Collector(of_class='FamilySymbol')
elements = collector.get_elements()
for e in elements:
print(e.name)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | StXh |
