Wednesday, April 6, 2011

List Parameters of Current Selection

This is another post about using the RevitPythonShell (RPS) for accessing the Revit API. I assume you are using a variation of the default InitScript, as that provides a handy selection variable.

The following session in the RPS shell assumes you have selected a wall in your Revit model. It then provides a list of the names of all parameters on the walls type:


<Autodesk.Revit.DB.Wall object at 0x000000000000002B [Autodesk.Revit.DB.Wall]>
>>>wt = doc.get_Element(w.GetTypeId())

>>>plist = list(wt.Parameters)

>>>pnames = [p.Definition.Name for p in plist]


['Description', 'DPV:DpvConstruction', 'Fire Rating', 'Structure', 'Assembly Description', 'Type Mark', 'Cost', 'Coarse Scale Fill Color', 'URL', 'Function', 'Width', 'Wrapping at Inserts', 'Assembly Code', 'Type Comments', 'Coarse Scale Fill Pattern', 'Keynote', 'Model', 'Wrapping at Ends', 'Manufacturer']

No comments:

Post a Comment