We have lots of fun with conditional statements in our office. There's no "ifs, ands, or buts but there are plenty of IFs, ANDs, or NOTs.
We have done a lot of experimenting with using YES/NO parameters (Check Boxes) to drive length and visibility parameters. We use IF statements to change multiple aspects of display and size in several of our families.
In this case, the plan was to have a TEXT parameter report one of THREE conditions. Reporting TWO conditions is elementary. I have to hand it to Eric, three was a real challenge.
So yesterday I was trying to figure out how to get glazing in a door to be either “clear”, “wire” or, and here is the kicker “n/a” (or - - as I used). Before I explain how I finally accomplished this I will give you a little background on my existing conditions. First I have a door family which has a nested door panel family inside of it. This door panel has a void that is controlled by 4 yes/no parameters that describe how to cut the door panel and to what dimensions. These 4 yes/no parameters are as follows:
8" X 33" LITE
3" X 33" LITE
Then I had created another yes/no parameter that controlled the glazing type from “CLEAR” to “WIRE” named
DOOR WIRE GLASS
Now onto the fun stuff, my first pass at getting this equation to work only yielded two results which were “WIRE” and “CLEAR”. Now that would be fine and dandy if all my doors had some sort of glazing in them, but that isn’t the case. So at first I tried to wrestle with some conditional terms, which basically brought the BIM studio to a screeching halt trying to figure out how to do this. But after an evening to myself and 4 other people trying to take a walk around conditional statement park, our brains had been mugged of any more ideas. All we had ended up with was the following
if(and(DOOR WIRE GLASS, or(HALF LITE, or(FULL LITE, or(3" X 33" LITE, or(8" X 33" LITE))))), "WIRE", “CLEAR”)
As I was driving home trying to parse through this issue it dawned on me, why not just create another parameter driven by each of the glazing parameters, which would give me another yes/no value.
So the next morning I created a WIRE GLASS parameter (pardon the confusing names of some of these parameters) which reads as follows:
if(HALF LITE, "CLEAR", if(FULL LITE, "CLEAR", if(8" X 33" LITE, "CLEAR", if(3" X 33" LITE, "CLEAR", "--"))))
This is basically saying if I have any of the “LITE” parameters checked read “CLEAR” if not then give me “- -“ . Now I had to marry this with my earlier conditional statement that controlled “WIRE” or “CLEAR” which ended up changing to this:
if(and(DOOR WIRE GLASS, or(HALF LITE, or(FULL LITE, or(3" X 33" LITE, or(8" X 33" LITE))))), "WIRE", WIRE GLASS)
This states if both the “WIRE” and any one of the “LITE” parameters are satisfied give me “WIRE” if not then check with the other WIRE GLASS parameter which reads out CLEAR if we have glazing with no wire or “ - -“ which would be no glazing at all.
So in the end I have this: (both are text parameters)
DOOR GLAZING TYPE = if(and(DOOR WIRE GLASS, or(HALF LITE, or(FULL LITE, or(3" X 33" LITE, or(8" X 33" LITE))))), "WIRE", WIRE GLASS)
WIRE GLASS = if(HALF LITE, "CLEAR", if(FULL LITE, "CLEAR", if(8" X 33" LITE, "CLEAR", if(3" X 33" LITE, "CLEAR", "--"))))
Which gives me my 3 conditions WIRE, CLEAR and - -