Showing posts with label Families. Show all posts
Showing posts with label Families. Show all posts

Monday, August 29, 2016

Blunt Force Revit Formulas

I got asked by a friend to create a formula that will pass a value from 1-4 to a parameter called IP. The 1,2,3, or 4 will come from one of 4 Yes/No parameters (LB, LC,LF, and LO). As a given check-box is checked "on", the other check-boxes should turn off and the value set into the IP parameter.

Here is what I came up with...


Users can check as many boxes as they like under Constraints, but if they check more than one the formula that IP is set to  will return a zero, letting them know multiple are checked.

The formula for IP first checks for every bad situation of multiple checking that is possible. If any are true it sets IP to BADpick or zero. Once multiple picking is eliminated, it checks for the four appropriate single checks, and will return a 1,2,3, or 4 respectfully. If neither a good or bad pick is true it defaults to zero. The formula checks for bad outcomes first because as soon as it finds a true response, it stops checking.

The hard part might have been quantifying all the bad responses. I start by trying to come up with each combination of two checks.

LB and LC
LB and LF
LB and LO
LC and LF
LC and LO
LF and LO

With four possible choices, you know you have all the combinations when each shows up 3X in your list. I did the same for combinations of threes, again ensuring each parameter showed up 3X.

LB and LC and LF
LB and LC and LO
LB and Lf and LO
LC and LF and LO

Lastly, I check for all four parameters checked at once.

LB and LC and LF and LO.

This is the entire formula. I used if/and statements

if(and(LBTrue, LCTrue), BADpick, if(and(LBTrue, LFTrue), BADpick, if(and(LBTrue, LOTrue), BADpick, if(and(LCTrue, LFTrue), BADpick, if(and(LCTrue, LOTrue), BADpick, if(and(LFTrue, LOTrue), BADpick, if(and(LBTrue, LCTrue, LFTrue), BADpick, if(and(LBTrue, LCTrue, LOTrue), BADpick, if(and(LBTrue, LFTrue, LOTrue), BADpick, if(and(LBTrue, LCTrue, LOTrue, LFTrue), BADpick, if(LBTrue, LB, if(LCTrue, LC, if(LFTrue, LF, if(LOTrue, LO, 0))))))))))))))

It's definitely blunt force programming, but it does the trick to make sure only one in four is picked.

Monday, June 22, 2015

Aligned Duct Tags

Want your duct tags to align to duct at all sorts of angles?

Duplicate your duct tag family, go to the family categories button and set the tag to "rotate with component". Save with the suffix "-Aligned" and use it when needed. That was easy.

Saturday, March 07, 2015

Revit Family Basics, The Bookcase Example

This article comes from my Revit Basics Blog which I have decided to shut down. It will help the beginner learn about making families by starting with a simple concept and progressively making it harder. It's not a light fixture, air handling unit, or custom sink, but it will put you on the path. Good luck!

In this example a bookcase family is required that a user can define the HxWxD. The number of shelves should be determined by the height, there should also be a control for the thickness of the material and the option to have doors on the bottom 3 shelves.

To gain the type of control needed, the shelves will have to be nested into the bookcase family. Nesting means the shelves will be an independent family that will be loaded into the bookcase family.

Build the Shelf Family
1. Begin with the Generic Model.rft template.

2. Unpin the 2 references planes in the template and uncheck the Defines Origin check box.

3. Add 4 reference planes to define the length and width of the shelf in the reference view. Set the Right and Back reference planes to Define Origin and Pin them in place.


4. Name the new planes (Front, Back, Left, Right) and set the Is Reference parameter accordingly.

5. Use the Extrusion tool on the Home tab to create a form for the shelf, locking it to the 4 defining planes.

6. Use the dimension tool to dimension the Width and depth of the shelf form.

7. Select the width dimension and pick the Label: drop down on the Options Bar, and then select .


8. The Parameter Properties dialog appears. Fill it out as indicated below. Do the same for the Shelf Depth dimension.
9. Switch to the Front view and create a reference plane to define the top of shelf. Name the reference plane, set its reference to Top and lock the top surface of the shelf form to the plane.

10. Set the shelf’s thickness to ½”. Create a parameter for Shelf Thickness as was done with width and depth.

11. Save this family as A-Fn Bookcase-Shelf.rfa


Build the Bookcase Shell
1. Begin with the Generic Model.rft template.

2. Unpin the 2 references planes in the template and uncheck the Defines Origin check box.

3. Add 4 reference planes to define the length and width of the shelf in the reference view. Set the Right and Back reference planes to Define Origin and Pin them in place.

4. Name the new planes (Front, Back, Left, Right) and set the Is Reference parameter accordingly.


5. Add 3 more reference planes to define the thickness of the back and sides of the bookcase.

6. Use the Extrusion and trace the footprint of the bookcase sides and back. Lock the faces of the extrusion to the reference planes.


7. Switch to the Front view and create a reference plane to define the top of bookcase. Name the reference plane, set its reference to Top and lock the top surface of the shelf form to the plane.

8. Create parameters for Bookshelf Height, Bookshelf Width, Bookshelf Depth, and Bookshelf Thickness the same way parameters were added to the shelf family.

9. Add “half” parameters for the bookcase width and depth. These will be used to keep the center planes in the center.

10.  Click the family types button to open its dialog.
11.  Group the “half” parameters under constraints and insert the formulas below to ensure they are always half of their parent lengths.

12.  This is a good time to flex the family by trying different dimensions in the parameters and checking that the geometry follows suit.

Add the Bottom Bookcase Shelf
The intent here is to add one shelf near the bottom of the shell and array it to the top of the shell. We can then create a parameter to determine the number of shelves in the array. That parameter can be driven by an equation that adds more shelves the taller the bookcase gets.

1. Begin loading the shelf family into the bookcase family and place it off to the side in the reference level view of the bookcase family.


2. Use the Align tool to lock the sides of the shelf to the inside planes of the bookcase shell and the front plane.


3. Select the shelf to access its properties. Here we want to create links between the parameters in the shelf to new parameters in the bookcase to control the shelf’s width, depth and thickness.

4. Select the grey box to the right of the Shelf Thickness to add a new parameter. Name it “Shelf Thickness (in case)”, make it an Instance parameter and group it under Constraints.


5. Do the same for Shelf Width and Shelf Depth.


6. In the Family Type dialog we can now create formulas to keep the shelves the correct size as the case changes. Create the formulas shown in the image below.




Creating a Swappable Shelf

To add another level functionality (or complexity) we can 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. The shelf below has extrusions added to the bottom.



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.




Array the Shelf
1. Switch to the front view. And move the shelf up 3”. Add a reference plane to the underside of the shelf. Dimension this plane from the reference level and create a parameter named “Bookshelf Toe-Kick”.
2.  Use the Array tool with Group and Associate on and Move To set to “Last”. The array should go from the top of the placed shelf to the top of bookcase reference plane.

3. Select the group and associate line with the current number in the array. On the Options bar select from the label drop down and add a new parameter.


4.  Make it an instance parameter and group it under Constraints.


5. In the Family Types dialog add the equation below to place a shelf at about one shelf per linear foot.

6. Flex the family by changing the height of the bookcase, verifying that the number of shelves changes. Also flex the width, depth, and shelf type.

7. If the shelves lean out of plumb, use the Align tool to lock the upper most shelf in place.




Control the Thickness
For this family the user can input the thickness of the bookshelf, this will in turn drive the thickness of the shelves. Let’s create a formula that allows the user to input any thickness they want, however, if the thickness is less than ½” Revit should use ½” anyway. Conversely if the user specifies any thickness greater than 1”, Revit will use 1” only. If the user specifies any thickness in-between, Revit should consider this a fair value and use it directly.

This requires creating an Actual Thickness parameter and a couple of nested IF statements.


1. Create a new instance parameter and name it Bookshelf Thickness Actual. Group it under Constraints.


2. Apply the following equation to the new parameter.


There are essentially two parts to this nested IF statement.


If (Bookshelf Thickness < 0' 0 1/2", 0' 0 1/2", 


This first part states that if the Bookshelf thickness is less than ½” use ½” for the Actual thickness. If it is not, refer to the rest of the statement.


if (Bookshelf Thickness > 0' 1", 0' 1", Bookshelf Thickness))


The last part states that if the Bookshelf thickness is greater than 1” use 1”. If it is not, use the Bookshelf thickness.


3. To finish apply the Actual thickness parameter to the constraining dimension instead of the nominal one.


if(BCS Thickness <; 0' 0 1/2", 0' 0 1/2", if(BCS Thickness > 0' 1 3/4", 0' 1 3/4", BCS Thickness))




Using Model Text to Provide User Feedback
Since the user can specify any thickness they want, even if they are wrong, it may be a good idea to provide feedback to the user if the thickness they provide is out of bounds. Model Text will be used for this.

• Place some Model Text on top off the bookshelf and make the text read "XXX".


• Select the Model Text and pick the little square to the right of the Text Parameter in Properties.


• Add a parameter and name it "Thick Condition"


• In the Family Type dialog and a formula as shown below.




• This formula will test to see if the parameters of Bookcase Thickness and Bookcase Thickness Actual are equal. If so the user supplied good data and the model text should read "GOOD". If they are not equal the users supplied bad data and the model text should read "BAD".

Lastly, we only want the model text to display if the condition is "BAD". To do this, create another parameter Called Thick Condition Visible as shown below.




In the Type Parameters dialog, add this formula to the Thick Condition Visible parameter.


Not (Bookcase Thickness = Bookcase Thickness Actual)


This formula returns a true when model text is in a "BAD" condition. When this yes/no parameter is true, it is visible.


The opposite is when the model text is in a "GOOD" condition, the yes/no parameter is false and the Model text will not display.


Important: You must load this family into a project for this to work. The Good and the BAD are visible in the family, but Only Bad is visible once loaded into a project.

Friday, February 06, 2015

Radius v. Diameter for MEP Connectors

When placing round connectors in families, Revit allows you drive the dimension of the connector with either the diameter or the radius, but there is a catch.


All of the round connectors must be driven the same way. 

When editing an existing HVAC family to add some hydronic connections, I couldn't change from diameter to radius. A quick test revealed that the round duct connector already set to diameter was locking all round connections to diameter. I deleted the duct connector and the radius choice reappeared.

In this case "all or nothing" set to radius was not a problem, it actually cleaned up the family. It just just a quirk that good to know about. 

Friday, January 30, 2015

Receptacle Family Example

This article comes from my Revit Basics Blog which I have decided to shut down. 

Electrical construction documents depend upon the use of symbolic representations of devices in plan view. The symbolic representation on a receptacle, for example is larger than the actual 3 dimensional modeled receptacle used for elevations and interference detection. It has to be to effectively convey the receptacle type and still be readable at an 1/8th scale. Because it is oversized placing receptacles close together in the model causes the plan symbols to overlap. That is unless the symbolic part of the family can be independently moved from the modeled component. Using a receptacle family as an example, this article will demonstrate how to do just that.


Begin by creating the symbolic annotation family of the plan symbol. Use the generic annotation family template provided with Revit. Name it “Family_A”. Using detail lines draw the plan symbol at the size it would be on a plotted sheet.

Controlling Up and Down Movement

Create another generic family. Use the generic annotation family template again. Name it “Family_AA”. Load “Family_A” into “Family_AA” to create a nested family. Place the nested symbology above the horizontal reference plane in Family_AA, but centered on the vertical plane. Draw a horizontal reference line under the symbology, and make it a weak reference.

Using an aligned dimension or the Align tool, lock the nested receptacle family to the reference line. Add a dimension from the reference line to the horizontal reference plane in “Family_AA”. Add an instance parameter to the dimension and name it “Offset From Wall”. This will add the ability to move the plan symbol away from the hosting wall or entity.


Create a third family using the Generic Face Based or the Generic Model template. Wall based or other options can be used here, so pick what works for to maintain company standards. In any case, the family will be built the same, but “push/pull” options are slightly different once the family is placed into the model. Name the new family “Receptacle”.


Create the following instance Parameters in the new family.

• Offset From Wall

• Offset From Wall2

• Offset L R

Create the following type Parameters in the new family.

• Plan Symbol

• Plan Scale

Load “Family _AA” into the “Receptacle” family and place it on the intersection of the two main reference planes. Assign the “Offset From Wall” in your nested family to the “Offset From Wall2” parameter in the host family by selecting “Family_AA” and selecting the box to the right of the “Offset From Wall” parameter in the Properties palette and then selecting the “Offset From Wall2” parameter in the dialog that pops up. This will allow the user to add a dimension to move the receptacle symbology off the wall without moving the model portion of the family.



Since the receptacle family scale is based on the plan scale, and it is unknown what that scale will be until it is placed in a view, a way push that information to the family is needed. Otherwise, an entered 6” offset may move the receptacle symbol radically more or less than 6” on the plan.  The Plan Scale parameter will be used as a mechanism for the user to convey the view scale to the family. At this time, Revit families do not have a parameter for the scale of the view they are placed in. Click on the Family Types button on the ribbon and as a default, set the “Plan Scale” parameter to 0’-0 1/8”.  To get the proper offset for any scale, add the following formula to the “Offset From Wall2” parameter “Offset From Wall / 1' * Plan Scale”.  The “Plan Scale” parameter must be manually entered by the user.

Controlling Left and Right Movement


To control the side to side movement of the receptacle symbol a vertical reference plane must be dimensioned and labeled. Revit will not allow negative values in dimensions, so the base plane can not be placed in the center of the symbol. To allow the offset to go both left and right of the center reference plane, add a reference plane to the 4’ left of the center reference plane. This sets the maximum offset, so adjust if required. Set the “L R” default to 4’, to align the plan symbol and the elevation symbol when families are placed. This plane should be pinned and set to “Not a Reference”. Create another reference plane and name it “L R”. Lock “Family_AA” to this reference plane, and make it a weak reference. Add a dimension from “L R” to the left reference plane, and set it to “Offset L R”.

If using a face based family, the “push/pull” grips to control the Left and Right location of the symbolic annotation now exist, but the offset from the wall distance must be manually typed in the properties dialog.

If using a generic family, the “push/pull” grips exist for control left and right as well as the offset distance from the wall.



Saturday, January 03, 2015

The Family Man's Family Template

I created my own set of family templates to reduce the steps I always seem to take when making Revit families often on the fly. The process is straight forward and quite helpful.

First start a new family with one of the out of the box templates. I like Generic Model.rft. Now, make tweaks that apply to most every family of this type you like. I typically do the following.


  • Create additional reference planes.
    • I always need them.
    • I name them here to ensure consistent naming convention.
    • I apply the correct "Is Reference" parameter.
    • Reference planes have positive and negative sides. I have OCD, by modeling them in the company template I ensure they are all drawn left to right and bottom to top providing consistent results.


  • Constrain Reference Planes.

    • Again, I always do this. Most every family I make has three basic dimensions. For families placed on ceilings I use Width, Length, and Depth.  For families placed on floors and walls I use Width, Length, and Height.
    • Pre-constraining builds in consistency you will get no other way.

  • Add Solids
    • At this point you might as well add a default solid and lock it to the planes you created.
    • You can also apply default materials if needed.
After completing all the tweaks desired, save the new family as a *.RFA, then in Windows explorer, change the file type to *.RFT. You will get a warning from Windows, just go by it. You now have a Revit family template of your own. Encourage the use your templates by defaulting users to a folder with your standards templates in Options.


Saturday, July 12, 2014

Delete Revit Backup Files - Everywhere!

If you know me, you know I am the opposite of a hoarder when it comes to electronic files. I love deleting things. It just brings me joy to delete data. So, Revit's need to create backups, just bugs me. It does not feel like good file maintenance to have all kinds of backups everywhere, and a bit dangerous when newbies open these files by mistake.

So once again, DOS to the rescue. Place this text in a batch file and save it in the root directory that you want to clean up.
del /s /F *.0*.rvt
del /s /F *.0*.rfa

del /s /F *.0*.rte
This will delete all the backups of projects, families, and templates in the root and every sub-folder that follows. Double click the BAT file and your work is done.  the /s tells DOS to delete files that meet the criteria in sub-folders, and the /F tells DOS to go ahead and delete locked files. 

To see what you just deleted and the word "pause" to the last line like this:
del /s /F *.0*.rvt
del /s /F *.0*.rfa

del /s /F *.0*.rte
pause               

If you want to know what you are deleting before you delete it. this this.
dir /s *.0*.rvt
dir /s *.0*.rfa

dir /s *.0*.rte

pause          

All of this works for me because a great IT department means I can restore old files at any time. If you don't have the same confidence, act accordingly.

Monday, July 07, 2014

Tags That show Imperial and Metric Units

I got question from long time friend last week asking if it were possible to tag a duct with imperial and metric units. He needed the tag to show  as
 12x12 (300x300)

On the surface it might seem impossible. The units for a Revit project are one or the other, but you can beat this by creating a special Tag family. For this tag start with the Generic Tag.rft template and categorize it as a Duct Tag. Add three labels in a row; SizeHeight, and Width. Use the Prefix and Suffix columns to add the open and closed parenthesis. Now select the Height parameter in the Edit Label dialog. Use the icon at the bottom with the image of the hand over the pound sign to change the format by un-checking "Use project settings" and then setting the units to Millimeters. Do the same for Width, and you have a mighty fine duct tag that will show imperial and metric units at the same time.


Friday, May 30, 2014

Valves Inherit Pipe Line Types

It is nice when you add a valve to a pipe in single line and it inherits the color of the pipe. It's not so great when it also inherits the line type of the pipe when that line type is hidden. You get something that looks like this.



You can override the graphics in view of each of the valves to force the line type to continuous, but you are probably better off just creating a filter.


This one looks for all the pipe accessories in a view, then applies a solid override to the lines.

Done and Done.

Wednesday, December 11, 2013

Change the Number of Lines in Room Tags

This comes from Club Revit's Linked In page. A user asked how to change the number of lines in a room tag and Kerry Ward had an interesting take on things. She provided this trick...

"Name the room (single line text) then select the room (not the tag). Go to properties and under Identity Date / Name place your cursor in location where you want the text to split into 2nd line. Then hold down ctrl key and press enter, then apply. The room tag is then split into 2 lines."

I added quite a few breaks in the example image below to demonstrate how far you can take it. You can see that it comes with the side effect of reflecting in schedules. On the MEP side of things it may not matter at all. 

If you are curious, changes the room names in linked files will propagate into the space tags that call the room names.


Tuesday, August 27, 2013

Search the Project Browser

With the enormous amount of MEP families needed to complete projects, it can be hard to find to the family you want when you need it.

Did you know you can right click on just about anything in the Project Browser and ask for the Search tool?


Then just type in some key word(s) and let Revit find it for you.


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.