Thursday, 19 March 2015

Lookup Tables and a Little Chat - Getting the Type Name into a Text Parameter

I've very recently been looking at using Revit lookup tables for structural families. These are traditionally used in the MEP side of things, but I have been looking for a structural application for a while. In the course of this, one of the things I have been able to achieve is to pass the lookup table's first column 'Type Name' to a text parameter in the family. As my knowledge of lookup tables is relatively new, I assumed this was something widely used and known. At the last London Revit User Group meeting, I was chatting to Jose Fandos of Andekan and we got onto the subject of this. He assures me that it most certainly isn't and people would be interested in this little tip. So here goes:

I created a sample lookup table as follows:

In Revit, the parameters in the test family:
 


 
A text parameter is created in the family called 'Type Name'.  The formula is broken down as follows:
  • size_lookup                   
Tells Revit it's a lookup command
  • (Lookup Table,              
Refers to the lookup table name in the 'Lookup Table' parameter
  • "",                                 
Usually there is a value between the quotation marks. This refers to which column to reference in the lookup table, but in this case  we create a 'null' value. This is what allows this method to work
  • "NOT SPECIFIED",
The text value that is used if there is no matching value in the lookup parameter
  • Size)
the lookup parameter value for the lookup formula to reference.
 
I'm not sure why this actually works, but I suspect that even though the syntax for the formula is correct for a lookup, the omission of a search column reference means it returns the first value it comes across, which is the 'Type Name' in the first column.
Hope this is useful.
 

10 comments:

Domino said...

Great Post,

A few questions though...

When I place a family with an inconsistent unit I seem to get an error message.
I would like the Lookup table t provide the data for Weight, where it sources the information through the diameter.

the weight parameter is Structural, Force, Lbs
the Diameter parameter is HVAC, Duct size, mm

size_lookup(LookupTableName, "Weight", 0 lbs, Diameter1) - this formula creates the error message.

Is there a way around this?

Also this would create a solution to the duct work content creation with product codes; at the moment I append manufacturers product codes via a 6 digit numeric input but the parameter is read as a length parameter because of the error of inconsistent units.

Thanks

Darren Snook said...

Hi Domino
In both cases, the 'Diameter1' parameter must be divided by one to neutralise the units:

size_lookup(LookupTableName, "Weight", 0 lbs, Diameter1/1)

The six figure product code can be set up in the family as an integer parameter(assuming the code is only numeric).
For example, if it's called 'ProductCode':

size_lookup(LookupTableName, "ProductCode", 0 , Diameter1/1)

Hope that helps.

Unknown said...

Hi Darren,

Out of interest where could you see look up tables being used for Structural applications? I have seen look up tables used to great effect with drawing pipework runs and valves in the past.

Darren Snook said...

Hi Lee
Specifically I have used these to reference steelwork information. For example: In a cell beam family I can define the top and bottom sections by referencing lookup information.
Regards
Darren

Unknown said...

In your original post what type of parameter is the "Size"?
When I use Text or Integer the formula results with an error 'inconsistent units'?

Darren Snook said...

Hi Andrew.
The 'Size' parameter is an integer parameter.

ekkonap said...

Hi Darren,
Wonderful discovery! Mind if I incorporate it in the formula workshop at RTC Porto? Wish I had learned of it sooner!

Darren Snook said...

Hi
Glad to be of help and absolutely fine to include in your RTC workshop

Jan said...

Hi Darren, thanks for the post.
Do you (or anyone else on here) have another trick up your sleeve to go the other way? I'm looking to have a lookup table return a number value while checking against a text value. If param is "A" then return "1", etc. This would be a real breakthrough since conditional formulas in Revit don't take text input (if(param="A",1,0) etc is not supported). Thanks much!

AngryReviteer said...

Has anyone tried this after Revit 2018?