How to get and set multiple title block instance custom parameters

All my titleblock instances have these parameters.

Here is some code, the commented stuff below wasn’t helpful, specifically using lookup for ‘Key Plan’. This parameter is a boolean, custom for ttb. If false, then key plan turns off, and if on, it turns on.

import clr

clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')

from Autodesk.Revit.DB import *

from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

element_id_value = 377319
#uses an imported variable
element_id = ElementId(element_id_value)

#needs the doc's methods
element = doc.GetElement(element_id)

#In Snoop, we found that this parameter's storage type is string, so we strung it at end.
pe2 = element.get_Parameter(BuiltInParameter.SHEET_APPROVED_BY).AsString()


# OUT = element.LookupParameter('KeyPlan')

# OUT = doc.GetElement(element.GetTypeId())

What I want to do with this python Node code is the following to test that I can do this in Python, proof of concept.

  1. List of titleblocks
  2. search each titleblock instance for a parameter called ‘Key Plan’
  3. Set it to false.

I’ve done it with Dynamo’s nodes

Why I turned to Python is because I couldn’t figure out how to do the following:
Instead of feeding one parameter to set, want to set multiple parameters per element.

Any help is appreciated.

Lacing and list levels.

Not at my PC, but try this (list levels may be slightly off):

  • Element input is set to @L1, and receives a flat list of elements.
  • Parameter name input is set to @L2, and receives a flat list of strings.
  • Parameter value input is set to @L2 and receives a nested list of lists of values.
  • Lacing is set to longest.

It often helps me to try a similar structure for points where you provide a flat list of 3 X values, a flat list of 3 Y values, and a set of 3 nested lists of 3 Z values. That often makes things easier to visualize.

1 Like

I see what you are saying. I fed into elements and parameter values the same list structure and it worked.

The two green circles have the same data structure; however, for my parameterName, the structure was different and it worked. List of items versus a list lists.

1 Like