Monday, 28 March 2011

Setting a +/- Offset in a Revit Family

Have you ever run into an issue where you needed to enter a negative offset value within a family and got an error? If you haven't... you will.

Here's a nice tip from Bruce Madsen in the San Francisco office that was used to allow for a quick positive or negative distance value to adjust curtain panel offsets:

The problem is that Revit does not allow negative distances:
When a negative distance is entered, Revit will report, “Parameter <name> has an invalid value.”

Create the Offset parameter as a number and use an IF statement to control the length – and to convert the number to a distance.

Steps to Follow:
  1. Create a “Number” type parameter for the offset dimension
    • “MyOffset_Inches”, in this case
    • The formula will assume inches, so we added “Inches” to the name
  2. Add a formula to control the Variable Length parameter
    • In words, to calculate the Variable Length;
      • If the Offset is negative, subtract the absolute value of the Offset from the Base Dimension
      • If the Offset is zero or positive, add the value of the offset to the Base Dimension
    • In the formula, note the multiplication by 1”.  This is to convert the Offset (Number) parameter to a distance.