Yes/no parameters and if statements
Video: Yes/no parameters and if statementsIn this lesson, we're going to add an If statement, and a Yes, No statement to our family. There's a lot of what ifs to consider when creating a family. What if, we want to give the user a choice to add a quarter inch panel to the back of the Wayne's Coat. But if we give this choice, we need to make our styles magically go from three quarters of an inch, to a half inch. While keeping our rails at a consistent three quarter of an inch. We can do just that. The objective of this exercise is to create a yes, no Parameter. And then use an if statement to control the dimension of our styles. To get started, Open your family called Styles and Rails, and follow along. So essentially, if you see here under Graphics.
Viewers: in countries Watching now:
If you have used Revit Architecture 2013, you've probably noticed that the entire model is based on the families you have in place. If you don't know how to make families, then this course from veteran trainer Eric Wing is for you. It demonstrates the process of creating a family and adding parameters, 3D elements, symbolic lines, and materials. Along the way, Eric covers template selection, reference planes, solid forms, void forms, line-based families, arrays in families, nested families, Yes/No functions, mathematical expressions, if statements, and in-place families.
- Creating a basic profile family
- Creating a door family
- In-place massing
- Working with complex families
- Using yes/no parameters and if statements
Yes/no parameters and if statements
In this lesson, we're going to add an If statement, and a Yes, No statement to our family. There's a lot of what ifs to consider when creating a family. What if, we want to give the user a choice to add a quarter inch panel to the back of the Wayne's Coat. But if we give this choice, we need to make our styles magically go from three quarters of an inch, to a half inch. While keeping our rails at a consistent three quarter of an inch. We can do just that. The objective of this exercise is to create a yes, no Parameter. And then use an if statement to control the dimension of our styles. To get started, Open your family called Styles and Rails, and follow along. So essentially, if you see here under Graphics.
I have a new parameter called Style Thickness and I move my back panel graphic up. So essentially, we start an end statement if, back panel, meaning if back panel's yes, then a half inch, with a comma. If not, three quarters of an inch. It's a pretty simple expression. So let's get started on it. In the Properties panel, I'm going to click my Family Types button. Under Parameters, I'm going to click Add. The parameter I'm going to add can be called Back panel.
(audio playing) It's going to be an instance parameter. The type of parameter is going to be yes, no. Let's group to parameter, under Graphics, and hit OK. Notice it's just a button. Let's find Style Thickness under Dimensions, and for parameters, click Modify. Let's group that under Graphics as well just to keep the two together. Click OK. Now it's time for our if statement.
So to start and if statement we start with the word if, and immediately we need to follow it with an Open Parenthesis. The next thing we type is the actual parameter that we're trying to control. That parameter is Back panel. So if back panel, is yes, meaning if back panel is checked, we need to throw in a comma, and give it a value, one half inch. If we have a back panel in there. Our style thickness is going to be a half inch.
If it's unchecked, we need to throw in a comma, and type in what we want if it's unchecked. And it's going to be three quarters of an inch. We need to close our parenthesis. So let's read it again. If, Back panel is checked, then I want my style thickness to be a half inch. If it's unchecked, I want it to be three-quarters of an inch. Hit Enter, uncheck Back panel, and it works. Let's turn Back panel on, or check it on and click Apply.
Let's click OK. Now let's add a back panel. We'll do that by going to the left elevation. Let's add a quarter inch reference plane. And Create, let's click Reference Plane. Let's offset one quarter inch. Use our Pick Lines button and let's offset up one quarter inch. Let's dimension it and this time, let's lock the dimension. I don't want a variable, that's fine.
Now what we're going to do is extrude a panel straight down. Go to the Create tab, go to Extrusion. On the Draw panel, let's use Pick Lines. Make sure your Lock button is checked on. So we're going to grab this guy, this guy, this guy and this girl. Hit Escape a couple of times. On the Modify panel, let's click, Trim Extend to Corner.
We're just happily drafting. (audio playing) Nice, hit Escape a couple of times. On the mode panel, click Finish Edit mode. Let's go to ref level floor plan. Let's click the Align button on the Modify panel. Let's click this Reference Plane.
Let's select our panel, make sure you lock it. Hit Escape a couple of times. Let's go to a 3D view. Let's swing around and look at our panel. It's in there. So, let's add two material variables. Go ahead and select this extrusion here. Now let's scroll down to Materials. Instead of by category, we're going to add a parameter. So click on Add Parameter here, let's call it Frame Material. Might as well keep it in Instance Parameter.
Everything else looks good, hit OK. Hit OK. Click the Style and hit a Type. For Material, click on this button here and grab Frame Material and hit OK. Because it's a Type parameter, all of our styles are going to have that material. Click Apply, click OK. Select your panel. There's a couple things I want to do with this. For Visible, click this little button here and put it on Back panel.
So that has two functions. If that thing's clicked off, that Back panel disappears. And this style becomes three quarters of an inch to fill that void. Click OK. Let's scroll down the Material, click this button. Let's Add a Parameter. Type in panel Material, Instance parameter, let's hit OK, OK. Not bad, if you still have your project open with the wall in it, great. If not go to the Purple R, go to New Project, use the Architectural template. And draw another wall in there like we did before. If you have the project open, let's just click Load Into Project. And if you do have it open, you're going to get this dialog. Overwrite the existing version.
Let's scroll in on this guy, let's go a head and check our panel, change some stuff up. For the panel material, let's click the Builder button. Let's find my favorite Cherry, Select that. For shading let's use Render Appearance. For the surface pattern, I don't know, let's use wood three. Hit OK. For the cut pattern, we use wood one, click OK.
Hit OK. For the frame material, let's find a Walnut. (audio playing) Double-click on Walnut down here, select Walnut up here, use Render Appearance for shading, Surface Pattern. Let's make that Wood one, hit OK? Cut pattern, let's make that Wood one, hit OK. Hit OK.
So, now we take a look at some of these items. Let's keep our back panels turned on. Click Apply, click off of it. Let's set our visual style to Realistic. Well not too shabby, not too shabby at all. Let's test out one thing on the end here. Our panels are half inch, with the backer on it. If I select this and I uncheck Back panel, hit Apply. Yeah, that's pretty cool huh.
Now we're at the far end of creating families. Think about the possibilities of how we can automate our processes. In Revit, if you think it up it can be accomplished.
There are currently no FAQs about Revit Families Workshop.