How to associate Family parameters

I have a tempered Beam composed by 4 profiles, which are profile families loaded on the beam family.

I want to control the dimensions of the profiles in this beam changing the family parameters.

Can I link with gh the parameters?

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…

Thanks,

Hi Adriamarco7,

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.

1 Like

Hi @Japhy

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.

Hi @Japhy

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:

(SaD/Fu) @ 0.020 = 0.3724 < Block 1
(SaD/Fu) @ 0.040 = 0.3780 < Block 2
(SaD/Fu) @ 0.060 = 0.3822 < Block 3

...

(SaD/Fu) @ 0.060 = 0.3822 < Block 101

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.

Can you post a single family with the formula in it? not quite following the workflow as presented. Thanks

So the above is still just a concept in my mind and not clear yet…
I think it’s better to start with something simple.

Attached is a simple file. In PARENT, there’s a nested file called CHILD.
Is there a way to link the instance parameters of CHILD to PARENT?

PARENT.rfa (384 KB)

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.

1 Like

I believe the following method will work

1 Like

You can use the following code:

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

1 Like