how to Set Instance-Based Height Parameter for Wall Panel Family via pyRevit Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I’ve created a Revit wall panel family (.rfa) that includes an instance parameter named Height. The panel geometry is designed to flex based on the value of this parameter.
Now, I want to use a pyRevit script that performs the following:
Asks the user to input a custom height in millimeters.
Places an instance of the wall panel family at a picked point.
Sets the Height parameter of the instance dynamically to the user’s input.
I have confirmed that:
The family is properly parameterized with an instance Height (Length) parameter.
The panel flexes as expected when manually editing Height in the properties panel.
The script should prompt for height (e.g., via forms.ask_for_string()).
Convert the input to feet (Revit internal units).
Place a family instance at a picked point.
Set the Height instance parameter to the provided value.
I’ve written some basic script using FilteredElementCollector and NewFamilyInstance, but I’m unsure how to:
Properly access and set the Height instance parameter
Handle unit conversion
Ensure family is activated if not already