Edit Parameter fomula

Can Dynamo edit the formula for a parameter?
I’m working on a family that might use anywhere from 2 to 20 visibility parameters, and then one big “OR” statement that contains all of them.
If I only need 2 options, I’d rather not trash up the family with 18 I don’t need. But that would mess up the OR.
Unless I can edit/build that formula in Dynamo

Hi @DaveP,

Yes, you can get and set the Parameter Formula with the API…

http://www.revitapidocs.com/2017.1/cdc3156c-0334-0bba-70af-1df78fb18b50.htm

So in theory, you could create a string by concatenating the param names and OR/IF/AND strings to create a formula.

I’m not near a PC so can’t code it up right now, maybe there is a node in one of the packages already but I’m guessing you’ve looked quite a bit?

Could you elaborate a little more about what you are after though? If you have examples of what you are trying to create, post them here. Pictures work well! :blush:

Cheers,
Dan

Hi @DaveP,

Given a computer and 5 mins I quickly made this script that allows you to Set the parameters formulas. Here is a quick example from my testing…

The Script:


SetParameterFormula.dyn (11.7 KB)

Before:

After:

You can use your own logic to get what you are after. Let me know if you have any problems.

Cheers,
Dan

2 Likes

Hi Dan,
How to set the formulas for Text parameters?
2019-05-13_09-47-30