How to work with Revit’s Yes/No parameters in PropertyWizard formulas

PropertyWizard treats Revit’s Yes/No parameters as True/False boolean values. So it is easy to use Yes/No parameter values in formulas, and it’s easy to set Yes/No parameters from formulas.

Using Yes/No parameter values

You can use a Yes/No parameter value anywhere that is expecting a True/False data value. So you can use them:

  • As the <condition> in an if() function
  • In the logical functions and() and or()
  • In the logical operator expressions And, Or and Not
Continue reading “How to work with Revit’s Yes/No parameters in PropertyWizard formulas”

Expressions in PropertyWizard for Revit

Expressions are the building blocks of PropertyWizard formulas. They are like phrases in a language.

It’s useful to understand the different kinds of expressions in PropertyWizard, so you can put them together in different ways to write better formulas.

There are four main kinds of expression in PropertyWizard:

  1. Literal expressions
  2. Identifier expressions
  3. Operator expressions
  4. Function expressions
Continue reading “Expressions in PropertyWizard for Revit”

How to filter Revit elements using an if() function

A PropertyWizard formula usually affects all the elements in the category you’ve selected. But what if you only want to affect a subset of the elements?

You can do this with an if() function in this form:

if(<filter criteria>, <your formula>, <target parameter>)

The <filter criteria> is where you choose which elements to affect, and the <target parameter> is the name of the formula’s target parameter. The <your formula> is where you put the formula that you want to apply to the selected elements.

For example, to affect only elements on Level 1, your filter criteria would be something like this:

if(Level.Name == "Level 1", <your formula>, <target parameter>) 
PropertyWizard Formula window showing a formula for the category 'Doors', Target Property is 'DWD-Test' and the Formula text is 'if(Level.Name == "Level 1", "This door is on Level1", [DWD-Test])'
Continue reading “How to filter Revit elements using an if() function”

How to use the if() function in PropertyWizard for Revit

PropertyWizard’s if() function works in the same way as the native Revit one, which is described in the online Help here:

http://help.autodesk.com/view/RVT/2022/ENU/?guid=GUID-A0FA7A2C-9C1D-40F3-A808-73CD0A4A3F20

The syntax is:

if(<condition>, <result-if-true>, <result-if-false>)

When PropertyWizard evaluates an if() function, it starts with the <condition>. For example in this formula:

if(Level.Name == "Level 0", "It's Level 0!", "It's some other Level!")

It will start by evaluating this expression:

Level.Name == "Level 0"

In PropertyWizard, the double-equals-sign ‘==’ means ‘is equal to’. So the value of the expression will be ‘true’ if the element’s Level’s Name is equal to “Level 0” and ‘false’ otherwise.

Continue reading “How to use the if() function in PropertyWizard for Revit”

How to fix Revit’s Filters with PropertyWizard

Revit’s ‘Filters’ feature is great for highlighting elements based on their parameters, but you are restricted in which parameters you can use.

For Walls, for example, you cannot use any of these ‘Constraints’ parameters in a filter:

Revit's Instance Properties panel for a wall

PropertyWizard lets you overcome this restriction – because you can set up a formula to copy the values of these ‘forbidden’ parameters into another parameter of your choice, and then you can set up a filter using that new, unrestricted parameter. PropertyWizard keeps the new parameter value updated, so your filter will ‘just work’.

Continue reading “How to fix Revit’s Filters with PropertyWizard”

How to find text with PropertyWizard

You can use the instr() function to find text in a PropertyWizard function. It finds the position of one piece of text inside another, and returns the character position of the first character of the found text, or -1 if the text isn’t found.

So, say we want to find all the rooms where the room’s Name contains “Bedroom”, such as “Main Bedroom”, ” Bedroom 2″, etc. The formula for that would be:

instr(Name, "Bedroom")

To turn that into a true/false value, you could use:

instr(Name, "Bedroom") != -1

This checks whether the instr result is not equal to (!=) minus 1. It will return true if the Name contains “Bedroom” and false otherwise – you can put this true/false result directly into a Yes/No parameter.

Continue reading “How to find text with PropertyWizard”

How to generate Level Codes in Revit with PropertyWizard

It’s useful if your Revit Levels have a Level Code as well as a Level Name. That way, you can use the Level Code in your formulas for door numbers, room numbers, etc:

Level NameLevel Code
Level 000
Level 101
Level 202
etc.etc.
Level Names and Level Codes

You could type the level codes in, level by level. But if you have PropertyWizard, you can just generate them. This post walks through a couple of different ways of generating the level codes from the level names. And on the way, it explains two of the text functions in PropertyWizard: substr() and strlen().

Continue reading “How to generate Level Codes in Revit with PropertyWizard”

Creating Revit Parameters to use with Groups and PropertyWizard

If you are creating parameters in projects that have Groups, and you are using PropertyWizard, you should be aware of this setting in the Parameter Properties dialog:

Revit Parameter Properties dialog, highlighting the group settings

What does the setting do? Well, it only has an effect if you’re using groups, and it’s only active for instance parameters. For example, imagine you add a new instance parameter to the Doors category. Each door in your project now has the new parameter, and since it’s an instance parameter you can set the value differently on every door.

Continue reading “Creating Revit Parameters to use with Groups and PropertyWizard”