Associate family parameter in a family

I actually came across the need for this today for linking a Generic Annotation to a Titleblock for a complicated Key Plan. We’ll need to use Python to do it, and I’m thinking this is the API method: I’m not sure, though, if this method only works for element parameters in the family i.e. an extrusion’s “Visible” parameter

In any case, I have hit a wall with my test case and get the warnings “TypeError: expected Parameter, got Parameter” when feeding my Python script an Autodesk.Revit.DB.FamilyParameter element, and “TypeError: expected Parameter, got UnknownElement” when feeding it a ParameterElement :thinking:

I know the first error I’m getting is because I’m giving it the wrong type of “Parameter” (either Dynamo type or Revit type), and the second error makes me think Dynamo doesn’t recognize Family Parameter elements because thats typically what “UnknownElement” means, but I’m not sure how to get it sorted.

Here is the Python script I started:

import clr
from Autodesk.Revit.DB import *


import Revit

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

elemParam = IN[0]
famParam = IN[1]


doc.FamilyManager.AssociateElementParameterToFamilyParameter(elemParam, famParam)

OUT = elemParam

Hopefully someone else might know more to completing this (perhaps @erfajo if he is not too busy :slight_smile: )