Set Instance Parameters from Values in a List

Hello,
I am trying to make a script that updates the total page numbers for a project and adds the correct page number to each sheet based on it position relative to the other sheets in this project (Example: Sheet 1 of 100).

The total page count I figured out but so far I can’t seem to find a way to get the instance parameter of each sheet to take on the valule of the sequence list I made. I think it is because the Element.SetParameterByName block does not accept list as in input for the “Value” parameter. Is there a way to create a loop to iterate through the list of elements and the sequence list somehow?

Hi @emoran6CG9J ,

Your inputs are correct, at least if the parameter is of the number type.
Could you show the error message of the Element.SetParameterValueByName node?
I’m assuming it’s because you are feeding a wrong object type.

This is the error I get

image

Change your numbers to strings, the Revit parameter-type is not a number.

Okay that fixed it but now I realzied I made a mistake. I need to create a list of sorted elements based off of the sorted list I made.

I can’t seem to find an easy way to use the sheet number to get the element ID for the sheets. Is there any easy way to do this?

Hi @emoran6CG9J ,

For something like this I recommend using a Dictionary. Dictionaries are great for mapping and retrieving matching objects. For example: a sheet and its sheetnumber:

Keep ofcourse in mind that this is an example and can be used for other values as keys and/ or values :slight_smile:

thanks that helps a lot!