With RiR I can set values to all those loaded types easily. But can I instead of giving a value, associate that value to one of the values of the main family? Like I would do manually in the pick, going 1 by 1…
We do have that in as a feature request, no native components. I believe a user posted a similar scripted version at one point. I’ll see if i can find it.
Recently I’m also wondering wondering the possibility to associate parameters (both instance/type) in project and family environment via RiR as well.
Somehow, it feels like a missing piece to be able to construct a nested family with over 100 parameters that need to be associated with its parent. Although the idea is still just a mock-up in my head…
Each parameter association is a pretty particular process, which is not going to be very efficient in grasshopper in most cases. I would be interested on how you plan to manage these associations programmatically.
The good news is this wouldn’t impact file size immensely.
I’m thinking about creating an annotation family similar to the image below.
Each rectangular block is a child family associated with the parent’s parameter to display the output value, while the parent family performs the 100+ calculations.
(I admit it’s somewhat like an Excel thing.)
For example, the formula is a + b/T * (SaD/Fu), so it goes like this:
Since Revit formulas don’t accept list inputs, somehow the goal in my head is to make this family work without using Dynamo or GH Player, allowing it to be easily used by those without relevant software or technical background.
We don’t have any components for Associating parameters, i believe someone posted a script on the forum at one time in that regard. I’ll try and find it.
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
clr.AddReference('RhinoInside.Revit')
from RhinoInside.Revit import Revit
from Autodesk.Revit import DB
fam_manager = FamilyDoc.FamilyManager
results = []
if not Run:
results.append("Transaction not triggered")
Result = results
else:
# Step 1: Extract host parameter names
host_param_names = []
for p in HostFamilyParam:
host_param_names.append(p.Name)
# Step 2: Resolve to FamilyParameter objects
actual_host_params = []
for name in host_param_names:
fam_param = fam_manager.get_Parameter(name)
if fam_param:
actual_host_params.append(fam_param)
# Step 3: Transaction
t = DB.Transaction(FamilyDoc, "Associate Nested Parameters")
t.Start()
try:
for i in range(len(ChildFamilyParam)):
nested_param_name = ChildFamilyParam[i]
host_param = actual_host_params[i]
for nested in ChildFamily:
param = nested.LookupParameter(nested_param_name)
if param:
fam_manager.AssociateElementParameterToFamilyParameter(param, host_param)
results.append(f"Associated '{nested_param_name}' Linked to '{host_param.Definition.Name}'")
t.Commit()
except Exception as e:
if t.HasStarted(): t.RollBack()
results.append(f" Error during transaction: {e}")
# Output
Result = results