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:
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.
But what happens if you create a Group, add a door to it, and then place several instances of the group? Can you still change all the parameter values independently?
That depends on this setting.
If you chose the first option ‘Values are aligned per group type’, then the doors will have the same parameter value in all the group instances – and you can only edit the value in Group Edit mode.
On the other hand, if you chose the second option, you can still freely edit the parameter values on each of the doors – you’re not restricted when they are part of a group.
How does this affect your PropertyWizard formulas?
This matters because PropertyWizard cannot enter Group Edit mode to edit parameter values. So if you choose the first option for your parameter, add some of the relevant elements to groups, and then try to drive the parameter with PropertyWizard, you will get a ‘editing while not in group edit mode’ error:
This error dialog cannot be bypassed or ignored – it only has a Cancel button. So it will stop and undo whatever you are doing. Which can be awkward.
So you have to use the second option ‘Values can vary by group instance’ for all parameters that you want to control with PropertyWizard.
A Few Awkward Types of Parameter
You will notice that the setting is sometimes greyed out, even for some Instance parameters. Why is this?
Well, for some reason Autodesk have chosen to lock the setting to the first option for these values of ‘Type of Parameter’:
It is only locked for these few types of parameter in the ‘Common’ discipline, and not for any of the types in the ‘Structural’, ‘HVAC’, ‘Electrical’, etc. disciplines. It is unfortunate that the affected types include some of the most-used types of parameter in PropertyWizard.
Coordinates are vital, but Revit does not give you many ways to access them. To show them on sheets, you have the Spot Coordinates tool, but if you want to schedule them you are out of luck.
Fortunately, PropertyWizard makes it easy to access coordinates. This is a quick walkthrough.
Elements in Revit have a Location property in the Revit API. For a normal family that’s placed using a single point, this Location property will contain a LocationPoint object (shown here in Revit Lookup):
The LocationPoint object has a Point property that contains an XYZ, which actually contains the X, Y and Z coordinate values:
So this simple formula will push a text representation of the whole XYZ into the Comments parameter of my elements. In this case, I’m using Structural Foundations, but this would apply to any Category where you have point-placed elements:
And here is a coordinate showing up in the Comments parameter:
Now, these coordinates are in Revit’s Internal coordinate system, not in Shared coordinates. So you need to use PropertyWizard’s internaltoshared() function:
To access the X-component, we just add .X:
Finally, these values are in Revit’s internal units, which are feet, but they are just stored as a number not as a proper length value. You can multiply by 1 ft to convert from a ‘number of feet’ to a proper ‘length’, so that PropertyWizard can format the value using your current Revit Units setting:
Just set up three formulas, one each for X, Y and Z, and you can then schedule the coordinates of all your elements:
And of course, being PropertyWizard, these values are kept up-to-date all the time as you edit your model. There’s no need to remember to run a script to update anything:
The third tutorial in PropertyWizard Help shows you how to join text values together using the ‘+’ operator:
As an alternative, you can use the strcat() function to join text values. This formula will have the same results as the one above:
To use strcat(), you put the text values you want to join inside the parentheses, separated by commas.
Why would you use one rather than the other? You might find strcat() more readable for large or complex formulas?
Why are there two ways of joining texts? I implemented strcat() very early in the development of PropertyWizard, and it was simpler at that time to create a dedicated ‘string concatenation’ function than to parse out two different meanings for the ‘+’ operator. I added text joining to the ‘+’ operator later, and didn’t remove strcat() in case people were using it. I always try to avoid making changes to PropertyWizard that will break your existing formulas.
The third tutorial in PropertyWizard Help shows you how to join text values together using the ‘+’ operator:
The ‘+’ operator works differently depending on whether the values either side of it are numeric (numbers, lengths, areas, etc.) or text.
If the values are both numeric
The ‘+’ acts as a plus sign and adds the numbers together.
Of course, the numbers have to have the same units, e.g. both can be Areas, or both can be simple numbers. You cannot add 2 feet to the number 4, for example. Just as with Revit family formulas, if you try to add incompatible values, you will get a ‘Type Mismatch’ error like this:
If the values are both text, the ‘+’ joins the texts together.
Note that ‘+’ doesn’t introduce any ‘joining character’ in between the texts, so if you need to introduce spaces or commas you need to type them in the formula.
You can see how in this formula, I’ve included a space after ‘is’ and a space before ‘long’, so that I get a space before and after my wall’s Length value.
"This wall is " + Length + " long."
The old post ‘How to use PropertyWizard for Sheet Numbers‘ has another example of using the ‘+’ operator to join text values together. The BS 1192 numbering it shows is somewhat outdated, but the principle is sound.
If one value is text and the other is numeric
PropertyWizard converts the numeric value to text and then joins the two texts together. I covered how Revit does this numeric-to-text conversion in yesterday’s post.
The previous post explains how to use the ‘+’ operator to join text values together in PropertyWizard. But it doesn’t explain how PropertyWizard generates text values from the Revit properties that you use in your formulas.
For example, in this formula what determines how the Length value is formatted?
"This wall is " + Length + " long."
The answer depends on whether the Revit property is a parameter or an API property.
Formatting Revit parameter values
Revit parameters know what type of data they represent, which enables PropertyWizard to format the value correctly to match your current Units settings.
So, if you are using Millimetres for length, a six metre long wall will generate this result:
While if you are using Feet and Fractional Inches (to the nearest 1/2″), you will get this result:
Note that if you change your Units setting, you need to run PropertyWizard’s Update All command. The Revit API does not have any facility to notify an add-in that the Units settings have changed.
Formatting Revit API values
Revit API values do not know what kind of value they represent, so it isn’t possible for PropertyWizard to format them for you. For example, if you use the Location.Point.X property on the Columns category, you will get results like this:
Which is showing the raw data from the Revit API, the same as is shown by Revit Lookup:
You will need to use formula expressions to format this raw data to match your current Units settings. I will cover some techniques in a future post, but please comment below if you have specific questions.
The second tutorial in PropertyWizard Help introduces the idea of using element properties in your formulas:
You can refer to:
Properties of the target element – Use the name shown in the Revit Properties window, as in this example. If the name includes spaces or special characters, then you need to wrap it in square brackets like this: [Sheet Name].
Nested properties – Use ‘dot notation’ like Dynamo. For example, the name of a Door’s Level would be Level.Name. There is no limit to the depth of nesting, but all the properties except the last must be Elements or ElementIDs.
API properties of the target element or nested elements – These are the ‘behind the scenes’ properties exposed in the Revit API, which you can find using the Revit Lookup add-in or the Revit API Help. Use the property name, e.g. Location for an element’s Location property.
Project Information properties – Use ProjectInfo.parametername.
Global Parameters – Use GlobalParameter.parametername.
This is a quick exploration based on the first ‘Getting Started’ tutorial from the PropertyWizard Help.
The tutorials are meant to give you a good introduction to PropertyWizard and what it can do for you.
The first tutorial’s formula is straightforward: It collects all the walls in the project and sets their Comments parameter to say ‘Hello Wall’:
This is a very simple formula, and you’d never use it in a real Revit project. But we can use it to explore what PropertyWizard brings to Revit.
So, just for comparison, if you needed to set the walls’ Comments to ‘Hello World’ manually, how would you do it?
I’d probably just try selecting all the walls manually and then typing ‘Hello Wall’ into the parameter in the properties window.
But selecting all the walls in a Revit project can be a bit fiddly. You might ‘Isolate Category’ in a 3D view and then window-select all the walls. Or you could select all the rows in a walls schedule. Or maybe you have another add-in that makes selection easier.
But then if you add any more walls in the future you need to remember to set that parameter value. Or regularly select-all-the-walls again to set any that have been missed.
In contrast, PropertyWizard just sits in the background updating any new walls for you as and when they are created.
You might worry that this background work will put a heavy load on Revit and slow your model down. But the Revit API has a very useful facility where an add-in can ask to be notified only when the model is changed in specific ways. So PropertyWizard asks Revit to wake it up when changes are made that affect your formulas, and it spends the rest of the time asleep and having no impact on model speed.
Similarly, if you set a parameter manually it’s very easy for someone to change it. To be sure that all the walls have the right value, you’d have to check them individually, or just select-all-the-walls-again.
In contrast, if you have a PropertyWizard formula it controls the parameter value. If someone tries to change the value, PropertyWizard changes it back. That can be a surprise if people aren’t aware that PropertyWizard is working in their model – you need to keep your team informed – but no-one can accidentally or misguidedly change a value that you’re controlling with a formula.
And finally, if you want to change the value in the future, with the manual method you have to select-all-the-walls again, while with PropertyWizard you can just change the formula and let PropertyWizard update all the walls.
So those are a few differences between setting property values manually and setting them with PropertyWizard. And they start to illustrate the kinds of problems that PropertyWizard is designed to help with:
You want to control a parameter value on a particular category of elements.
You want to be sure the value is set correctly.
You might want to change the value in the future.
In future posts, I’ll explore other formulas in a similar way.
This version includes the top user-requested feature: Import and Export formulas. So you can now transfer your carefully-curated formulas from one Revit project to another!
You simply click the new ‘Export’ button in PropertyWizard’s main window, and choose where to save the formula file. Then click the ‘Import’ button to select the formula file and import the formulas when you’re in the other Revit model.
I’ve also added a new function: round(a, b), which rounds the value ‘a’ to ‘b’ decimal places. So this formula calculates the length of walls in metres, rounded to the nearest millimetre:
Bugfixes include improving the accuracy of midpoint rounding in the round(a) and round(a, b) functions. Previously, midpoint values like 1234.5 would occasionally be rounded to 1234 rather than 1235. Now, you should always get 1235.
I’ve also changed the trig functions to use radians not degrees so that they interface properly with the Revit API. Sin, cos and tan now expect their input values to be in radians. The inverse functions asin, acos and atan now return radians.
New in PropertyWizard 1-5-0, you can control parameters on Title Blocks. This means you can automate your Key Plans to have the highlights match your sheets automatically:
In this example, my building is divided into three zones. Each of my plan sheets shows one of the zones, and I want to highlight the relevant zone in the key plan. I’m using ISO 19650 sheet numbers (updated to the 2021 UK National Annex), so the sheet number contains the spatial zone reference. But without PropertyWizard there’s no way to automatically update the key plan highlights when I set the sheet’s zone. And having two sources of truth (a setting on the sheet and a separate setting on the title block/key plan) is a recipe for having some sheets showing the wrong highlight.
With PropertyWizard 1-5-0, you can connect a parameter on the title block to a parameter on the sheet, so the key plan will automatically update when you set the sheet parameter.
How do you make this happen? In this post, I’ll show you step-by-step how to set-up your title block and key plan, then how to use RevitLookup to find the right parameter to use, and finally how to write a PropertyWizard formula to connect the two parameters.
I’m starting with a standard Architectural project template and using the standard Title Block. You will have your own template and title block. If you have any problems adapting this step-by-step to your own situation, please leave a comment below and I’ll help you work through it.
I’m assuming that you have a single parameter on the sheet that holds your zone value. You may have your zone value embedded in the middle of a parameter value. If so, you’ll need to use PropertyWizard’s text-manipulation functions to extract the zone value. If you’d like to see how to do that, leave a comment below and I’ll explain in a separate post.
For this example, I’ve created a shared parameter called Zone and added it to my drawing number label in the title block family. Then I’ve added the same shared parameter to the Sheets category in the project so I can set each sheet’s zone.
For the key plan, I’ve made a quick Generic Annotation Family. This includes the building outline, a north point, and the red zone outlines:
I’ve set up visibility parameters for each of the zone outlines, and a parameter called ‘ZoneKey’ to control them. Here are the simple formulas that drive the visibility parameters from the ZoneKey:
You’ll notice that my ZoneKey parameter is an Integer parameter, not a Text parameter. That’s because you can’t use text parameters in native Revit formulas (you can in PropertyWizard of course). So you can’t just use the text value from the sheet’s Zone parameter – you have to translate it into an integer so that you can actually use it in these formulas to drive the visibility parameters. In this case, I’m using ZoneKey value 1 for Zone A, 2 for Zone B, and 3 for Zone C.
This is a fairly simple example of course – you may want to switch all the highlights on for ‘all zones’, and off for ‘not applicable’, or have section line highlights as well as plan highlights, for example. The great thing about PropertyWizard is that you have complete flexibility to achieve the exact effects you need.
Now, after loading the key plan into the titleblock I’ve used ‘Associate Family Parameter’ to create a parameter on the Title Block that will drive the Key Plan’s ZoneKey:
So, that’s my set-up. There are other ways of setting-up key plans in Revit, but I think this is a pretty common pattern. And now I can use PropertyWizard to drive the Title Block’s ZoneKey parameter from the Sheet’s Zone parameter.
But how do you access the Sheet parameter from the Title Block? Let’s have a look at Revit Lookup…
Revit Lookup – how to access the Sheet parameters from the Title Block?
Revit Lookup lets you explore the Revit database, and in particular it lets you examine Revit element properties. You can refer to my previous posts on Revit Lookup: How to Install (recently updated) and Getting Started.
In a PropertyWizard formula, you can access the current element’s properties, and also the properties of ‘nested’ elements. We need to get a property from the Sheet, but how do you reference the Sheet from the Title Block?
First, we need a test title block that we can examine, so I’ve made a new sheet with my new title block. Then I select the title block and choose Revit Lookup’s ‘Snoop Current Selection’, which opens a window showing the title block’s properties:
The key here is the OwnerViewId property. You can see it points to my Sheet, so I can use OwnerViewId to access the sheet’s parameters from PropertyWizard.
The reason OwnerViewId points to the sheet is that title blocks are view-specific – they’re a special kind of tag. And all view-specific elements have an OwnerViewId property that points to the parent view.
If I click on the OwnerViewId property, Revit Lookup will open a window that shows the sheet:
And then I can click on the Parameters property on the sheet to see the list of sheet parameters, including the Zone parameter that I need to control from PropertyWizard:
So in PropertyWizard, to access the sheet’s Zone parameter from the title block I can use the expression ‘OwnerViewId.Zone’.
PropertyWizard – what is the formula?
So now we’re ready to set up the PropertyWizard formula. We need to set the Title Block’s ZoneKey parameter based on the value of the OwnerViewId.Zone parameter, like this:
In more detail:
I’ve chosen Title Blocks in the Category drop-down so the formula will apply to title blocks.
Under Target Property, I’ve typed in ‘ZoneKey’, the name of the title block parameter that controls my key plan.
In the Formula box, I’ve typed the formula. Referring back to my ZoneKey, I needed to set ZoneKey to 1 for Zone A, to 2 for Zone B, and to 3 for Zone C.
To do this three-way split, I’m using an if() function with another if() nested inside it. The outer if() tests whether the zone is “A”. If it is, the result is 1. If not, we move to the inner if(), which tests whether the zone is “B”. If it is, the result is 2, and if not the result is 3.
If your zone set-up is more complex, you need to will build up a more complex formula – but the principles remain the same. And if you need help setting-up your formulas, please leave a comment below – I am always happy to help.
And that is how to set up a PropertyWizard formula to control the zone highlights on your key plans. Once set up, the key plan will remain synchronised with the sheet’s Zone parameter, meaning that you never have to update it manually – and you never issue a drawing with an incorrect key plan.