Monday, January 23, 2012

Revit Family Formula Examples and Tricks

When creating formulas in a family it is helpful to have a go to list of examples. Here is mine.

IF Statement
IF (Length < 30′, 2′ 6″, 4′)    
     If the Length parameter is less than 30' x = 1 , y = 22'-6"
     If the Length parameter is greater than 30' this parameter will have a value of 4'-0"


IF that Returns a String
IF (Height > 30′, “This thing is tall”, “This thing is short”)     
     If the Height parameter is greater than 30' this parameter will return  This thing is tall
     If the Height parameter is less than 30' this parameter will return  This thing is short
Nested IF Statements
IF (Length < 35’, 2′ 6″ , IF (Length < 45′, 3′ , IF (Length < 55′, 5′, 8′ ) ) )
     If Length is less than 35', this parameter will have a value of 2'-6"
     If Length is between 35' and 45', this parameter will have a value of 3'
     If Length is between 45' and 55', this parameter will have a value of 5'
     If Length is greater than 55', this parameter will have a value of 8'

IF applied to a Yes/No condition
Length > 40' 

     If Length is greater than 40' the the statement is true and the Yes/No check box is checked
     If Length is 40' or less the statement is false and the Yes/No check box is NOT checked


IF OR
IF (OR (A = 1 , B = 3 ) , 10 , 5) 

     If A = 1 or B = 3 this parameter will have a value of 10
     If A is not = 1 and B is not = 3 this parameter will have a value of 5


IF AND
IF (AND (x = 1 , y = 2), 8 , 3 )
     

     If x = 1 and y = 2 this parameter will have a value of 8

     If x is not = 1 or y is not = 2 this parameter will have a value of 3


Some Formula Tricks of the Trade

This or That only with a Yes/No parameters






By specifing that metal can not be true while Wood is true the user can only specify one of the two materials. They both can not be checked at the same time. This can be used for visibility where a left or right access panel may be required but never both.


Yes/No Drives Tag
In this example an exit sign needs to be tagged with the text "STAIR", "EXIT" or nothing. 


A Yes/No parameter is created called "STAIR".


A Shared text parameter is added with a formula to determine if the Exit sign is near a stairway.  if(STAIR, "STAIR","EXIT")


If the parameter of STAIR is true, return the text "STAIR", if false return the text "EXIT".


Create a tag that references the shared parameter to show "STAIR" or "EXiT" and don't tag exits signs that should have no text.


Pick One and Only One








Here the condtion number will allow only one paramter to be true in a list. Associated with a type, you could control a ton of things simply back picking the correct type.

"Don't Change Me Bro"



If you need some text to not change, put that text in the Formula column with quotes around it. It greys it out in the Value column. This should stop the majority of users from changing its value.


Swapping Nested Families
In a bookcase family with a nested shelf family, follow these steps to add a parameter that will allow the user to switch from one type of shelf to another.


1. Open the original shelf family and save it as the second shelf option. Add something to make it different. 

2. Load this new shelf into the bookcase family, but do not place it.


3. In the Family Types dialog create a new Type parameter named “Swappable Shelf”. Make its discipline Common, its Type of Parameter and group it under Constraints.


4. When you select the Type of Parameter Revit will open the Select Category dialog. Pick Generic Models.
5.  Select the original shelf in the bookcase family now. In the Properties dialog, look for the Label parameter and change it to “Swappable Shelf”.
6.  In the Family Types dialog Create 2 shelf types, Shelf Type 1 and Shelf Type 2. Associate the swappable shelf parameter with the appropriate type.
7. Flex the family. Change the family type and verify that the shelf changes.

Friday, January 20, 2012

New Year - New AUGI World

The January edition of AUGI World is available online now.  It's chalked full of great articles by good looking authors. Download or view it online today and stay ahead of the pack. Here are some of my favorites;


Joel Londenberg 
Plumbing Systems for Well-Documented Flow

Steve Bennett -
Ini or Outie? Advancing Your Customization of the Revit ini File


Louisa Holland 
AutoCAD System Variable Superstars
 

Sunday, January 01, 2012

Using Character Map in Text and Tags

If you were not aware that you can use special characters in Revit to add things like a diameter symbol to text, check out my previous post. In that post I showed how to figure out the key-in required to produce certain symbols just by typing them into the text string. in this post, I'll show how to leverage the many special characters that do not have a key in but existing in the font.


Revit MEP supports oval duct, but the symbol in tags my firm has used since hand drafting is the Greek letter PHI. Unfortunately there is no key in for the PHI character. I can however, use the "Select" and "Copy" buttons to copy the character to the clipboard and paste it directly into a text string.

In this case, the symbol legend.


It can also be pasted directly in a label for a tag as a suffix.


Happy New Year!