Set param A, based on param B, only if B is false (no)

Set param A, based on param B, only if B is false (no)

Anonymous
Not applicable
501 Views
6 Replies
Message 1 of 7

Set param A, based on param B, only if B is false (no)

Anonymous
Not applicable

Just getting into formulas in families.

I'm building a rather simple convention table set up that has a table and two chairs.

I want one parameter to be Show Chairs. Hide the chairs if false (no).

Another parameter is Two Chairs. Whether the table has two chairs or not, it will hide one of the two.

Obviously, these two params are linked. If Show Chairs is false, it shouldn't matter what Two Chairs is set to. It should be set to false.

I have Chair A controlled by Show Chairs and Chair B controlled by Two Chairs.

 

How do I make Two chairs set to false only when Show Chairs is false? Otherwise it should default to whatever its own check box is set to.

 

Thanks!

0 Likes
Accepted solutions (2)
502 Views
6 Replies
Replies (6)
Message 2 of 7

barthbradley
Consultant
Consultant

So you only have two conditions; One Chair Visible or Two Chairs Visible?  Associate Chair 2's Visibility Parameter to Host Parameter (e.g. "Chair 2") and then create another Yes/No Parameter like this:

 

Two Chairs.png

 

 

...or are you saying that the 2 conditions are: Chairs and no Chairs.  If so, you can associate all the Chairs Visibility Parameter to just one Yes/No Parameter in the Host.  

 

 

...if you are getting into Formulas, here is a great reference you want to keep handy:

 

https://www.revitforum.org/tutorials-tips-tricks/1046-revit-formulas-everyday-usage.html

 

 

 

 

 

0 Likes
Message 3 of 7

TheMattatonAP
Advocate
Advocate
Accepted solution

Thanks, Bradley. I ran across that link you shared a few times while googling for clues. I'll definitely circle back and look at it closer.

It's a little more complicated than your example. The trick is that Two Chairs controls the visibility of one of the chairs, while Show Chairs controls BOTH chairs and should override whatever Two Chairs is set to.

 

So, I set up a param for each chair, Chair A and Chair B.

I then set Chair A to be equal to whatever Show Chairs says.(Although I could have just set Chair A's visibility dependent on Show Chairs directly instead)

I set Chair B to be "Yes" only if both Two Chairs and Show Chairs was "Yes." if(and(Show Chairs, Two Chairs))

 

I think the most confusing thing as a noob to formulas in Revit params (but also having some knowledge of coding languages) is that there doesn't seem to be a way to explicitly set a Yes/No param to 0/1, true/false, yes/no within a formula. I kept trying things like:

if(Show Chairs, 0, 1) or if(Show Chairs = false, false, true)

Took me a bit to realize I just needed to set a condition and not explicitly set it to true/false.

 

Long story short, it's a matter of setting one visibility param per object, then using those params to relate to other params. Once that "clicked," it was fairly easy to set up. 🙂

 

Thanks!

0 Likes
Message 4 of 7

ToanDN
Consultant
Consultant
Accepted solution

Like this?

 

Annotation 2019-03-18 170245.jpg

Message 5 of 7

TheMattatonAP
Advocate
Advocate

Yep. That looks like what I did. Do the square brackets around the "2 chairs" allow you to mix letters and numbers in a param name? If so, does that also work if you have a dash "-" in a param name. I had some difficulty with that when Revit read it as a minus and choked on it. 🙂

0 Likes
Message 6 of 7

ToanDN
Consultant
Consultant
The [] were automatically added by Revit after the formula was entered. Don't use any math symbols in a parameter name, e.g. use _ instead of -.
Message 7 of 7

Anonymous
Not applicable

Yep. Found that out the hard way. 🙂

Made sure everyone in the office knew about it when I figured it out.

0 Likes