**Revit Family – Guided Tour**

Autodesk provide numerous sample families when Revit is installed. The purpose of these files is to demonstrate potential, inspire and educate. One file in particular is very informative, it provides an insight into how we can incorporate basic Maths, Trigonometry, Conditional Statements, Visibility control, and formulas into our own families. If you want to get more benefit while creating your own families, this blog will offer some insight.

The file in question can be found at this location: *<Drive>:/Program Files/Autodesk/Revit 2024/Samples/rac_advanced_sample_family.rfa*

*It’s a Brise Soleil (I’ll call it a sunshade) that provides shade and adapts based upon the size of the window it’s located above, the angle of the sun, the quantity of louvers and some additional controls, which will be described as we work our way through*.

*In use, the family is controlled via three main ‘Instance’ parameters*

- The
.*Sun_Angle* - The
.*Mounting_Height**(Top of the Window)* - The
.*Window_Sill_Height**(Bottom of the Window)**These three parameters (and others) are used in formulas to define the behaviour of the Sunshade.*

If we interrogate the families ‘Type’ properties, we’ll see how the formulas interact. Let’s jump right in. (Note, at first sight the following dialogue can be a bit intimidating, keep going, hopefully, you will think it was worth the effort required to learn.)

*The first thing this family calculates is the length of shadow required to shade the window, this is achieved by subtracting ‘Window_Sill_Height’ from ‘Mounting_Height’ to result in ‘Shadow_Length’. (In this case, 1400mm)*

**Stage 2.**

*To prepare for calculating the depth of the shade required to cast a shadow upon the length defined by ‘Shadow_Length’, some trig is required. (See Stage 3.) That will require the relative angle of the Sun.*

* ‘Rel_Angle’ is simply a constant 90 degrees minus ‘Sun_Angle’ (remember this is an instance parameter defined by the user while in the project, in this case, 25 degrees (see image above)*

**Stage 3.**

*This is where we calculate the depth of the shade.*

*Here we go with trigonometry, at first sight this formula may seem like gobbly goop, let’s break it down into its individual parts and explain the syntax.*

*‘Support_Length’**is a function of***‘Shadow_Length’**multiplied by the tangent of**‘Rel_Angle’.**

*Let’s create this formula in several small steps.*

*Shadow_Length** * tan(Rel_Angle) 1400 * 0.466 = 652.3mm this works ok, but what if we required a whole number (integer). If so, we need to use the ‘roundup’ function which rounds to the nearest mm.*

*So our formula would look like this , roundup(Shadow_Length * tan(Rel_Angle)) but this returns ’inconsistent units’ Why? Because we are multiplying a length by an angle. (Note, for roundup to work the number must be unit less)*

*Therefore let’s strip out the units, roundup(Shadow_Length/1) * tan(Rel_Angle) but this also returns ’inconsistent units’ Why? Because we are multiplying a unit less value by an angle.*

*Note, (Shadow_Length/1) removes the units! – A bit geekie but it works, this is a common technique within the Revit world.*

*So the final formula reads roundup((Shadow_Length /1) * tan(Rel_Angle)) * 1 1400 * 0.466= 653mm. This works because the number is rounded to the nearest mm, (without units) and then the units are added back to the number by multiplying by 1mm.*

**Stage 4.**

*Stage 3 defined ‘Support_Length’. Let’s investigate where it’s used.*

*Stage 4A.**Firstly, it controls the visibility of the diagonal supports.**Stage 4B.**Secondly, it helps define the louver quantity.**Stage 4C.**Thirdly, it helps define the spacing between the louvers.*

**Stage 4A.**

*‘Support_Hanger’** is a form of Conditional Statement, specifically a ‘Yes/No parameter’. It controls the visibility of the diagonal supports above the shade. If ‘ Support_Length’ is greater than 400mm make the diagonal supports visible, if not, don’t make them visible.*

*If the shade isn’t very deep it doesn’t need to be supported.*

**Stage 4B**

*‘Louver Number’** is an integer that specifies the quantity of an array, it does so based upon the depth of the shade ‘ Support_Length’ divided by the spacing between each louver ‘Max Louver Spacing’ plus an additional value of “1”. (653/163.3) + 1 = 5*

*Because this value is defined as an integer there is no need for a roundup.*

*Note. When an array is controlled via a formula, the formula must always ensure that the value is at least 2, hence the need to add the additional 1.*

**Stage 4C.**

*‘Max Louver Spacing’** defines the amount of the shade that needs to be covered with louvers based upon the depth of the shade and the intensity of the shade required. *

*This is achieved by converting the intensity of the shade quoted as a percentage ‘Desired_Shading_Percent’ into a number. (75* 0.01) = 0.75*

*(Remember, this is an instance parameter defined by the user while in the project, in this case, 75 percent)*

*This value is then multiplied by the ‘Support_Length’. (653 * 0.75) = 489.75 and then finally subtracted from ‘Support_Length’. (653-489.75) = 163.25.*

*So, putting it all together 653-(653*(0.75)) =163.25. (I know the value in the dialogue box above quotes 163.3, this is due the number of decimal places Autodesk have defined in the family)!*

**Stage 5.**

*Now we deal with ‘Shade_Factor’. This is simply a text string that varies based upon the status of ‘Desired_Shading_Percent’. This uses a nested ‘If’ statement and will provide 1 of 4 possible results, ‘Low’, ‘Med’, ‘High’ or ‘Max’ text values.*

*In plain English this Condition Statement says…. ‘If (Condition, do this if true, otherwise do this if false)’*

*Each condition is evaluated, i.e. is “Desired_Shading_Percent less than 65”, if true, “Low” is returned, if not, the next “If” statement is evaluated, and so on until a true result is found.*

**Stage 6.**

*Now were getting close to a completion. ‘Length’ surprisingly enough determines the overall length of the shade. This is an Instance parameter that is specified within the project.*

**Stage 7.**

*‘Max_Support_Spacing’** defines the distance between each support protruding out from the base of the shade. This is an Instance parameter that is specified within the project.*

**Stage 8.**

*‘Number of Supports’** controls the quantity of the supports via an array. ‘ Length’ is divided by ‘Max_Support_Spacing’ plus an additional value of “1”. (1800/600) + 1 = 4*

*Because this value is defined as an integer there is no need for a roundup.*

*Note. When an array is controlled via a formula, the formula must always ensure that the value is at least 2, hence the need to add the additional 1.*

*That’s it folks, each individual step combines to control the families behaviour. As you have seen, it is quite comprehensive although this is by no means exhaustive. Have a look at some of the other sample families particularly the Structural advanced family for different methods of control.*

*Note, details provided here are based upon the Autodesk help file. Search for “Revit Sample Family files” for the official explanation.*

*Lastly, have a look at our website for details of our Family Creation courses. The methods defined here (and others) could be explored further.*

**Written by Patrick Mullins – Software Technical Specialist**