View Full Version : Formula Tricks
Scott Hopkins
2004-07-26, 05:17 PM
I've noticed a quite a few posts giving out formula tricks. It would be great if all of them where in one place. I'll start it off:
Convert angle to __in 12 roof slope....
lcamara
2009-03-28, 12:19 AM
I only discovered recently that there's an IF capability (I was looking at "Revit Structure 2009 User's Guide > Creating Your Own Components (Families) > Family Types > Using Formulas for Numerical Parameters > Valid Formula Syntax and Abbreviations" but didn't see "Revit Structure 2009 User's Guide > Creating Your Own Components (Families) > Family Types > Using Formulas for Numerical Parameters > Conditional Statements in Formulas"), but still no MIN and MAX functions:
minAB =IF(A<B,A,B)
maxAB =IF(A<B,B,A)
I also don't see TRUE or FALSE constants, so:
TRUE =1=1
FALSE = 1<1
there are of course many other ways of doing all 4 of these...
Anyone know of a formula to convert a Slope (unit) into an Angle? (http://forums.augi.com/showthread.php?p=957826#post957826)
Jmickledesign
2009-03-30, 06:31 PM
yeah, by using sin, cos, and tan you can have a formula that will set this up for you. i don't have the time to get into it now but if you go to Revitcity.com and check out some of the trusses that have been created those can be a great starting point for what your looking for.
Hope this helps.
brian104662
2009-04-01, 03:59 PM
Anyone know of a formula to convert a Slope (unit) into an Angle? (http://forums.augi.com/showthread.php?p=957826#post957826)
Make a parameter to input the rise in inches we'll call it "R"
then add a parameter to your adjustable angle, call it "A"
control it via a formula =atan(R/12")
EDIT:
I guess I should read all the previous posts before replying. Whoops.
NKramer
2009-04-07, 07:14 PM
I only discovered recently that there's an IF capability (I was looking at "Revit Structure 2009 User's Guide > Creating Your Own Components (Families) > Family Types > Using Formulas for Numerical Parameters > Valid Formula Syntax and Abbreviations" but didn't see "Revit Structure 2009 User's Guide > Creating Your Own Components (Families) > Family Types > Using Formulas for Numerical Parameters > Conditional Statements in Formulas"), but still no MIN and MAX functions:
minAB =IF(A<B,A,B)
maxAB =IF(A<B,B,A)
I also don't see TRUE or FALSE constants, so:
TRUE =1=1
FALSE = 1<1
there are of course many other ways of doing all 4 of these...
Anyone know of a formula to convert a Slope (unit) into an Angle? (http://forums.augi.com/showthread.php?p=957826#post957826)
There are a few other possibilities which may work for you. You can use NOT statements for >/= "if(not(A>B,x)" will yield the same answers as an excel formula of "ifA</=B,x"
Also you can use Yes/ No parameters for true false statements. Yes/ no parameters imply the if already so the syntax is somewhat different.
A= yes/ no parameter
B and C= length parameters
A=B>C if B is greater than C then A will turn on
C=A,4'-0",2'-0" If A is turned on then C=4' if A is off then 2'
Nick
afastudios
2009-04-10, 03:26 PM
So I had some problems with "C=A, 4'-0", 2'-0"". The error is unexpected comma.
My situation is as follows:
I have a length parameter that is called Top Hole True.
I have a yes/no parameter that is called Top Hole.
I want Top Hole True change its value based on the yes/no parameter Top Hole's value.
Top Hole True = Top Hole, .875", .5"
Any ideas?
Thanks
jw
afastudios
2009-04-10, 03:41 PM
The problem has been solved...
The correct syntax I needed:
Top Hole True = If(Top Hole, .875", .5")
not
Top Hole True = Top Hole, .875", .5"
thanks...
dlampley.41310
2009-10-15, 01:36 PM
I'm working on a Wall Opening family that will have the potential of (2) symbolic lines:
one for the Wall Lintel
one for the Veneer Lintel (as required)I'm using shared parameters in hopes of being able to setup a helpful schedule.
And furthermore, I want to be able to TAG these openings, using only ONE tag family to accomplish a couple of different things: If the wall has NO VENEER, then the tag would simply report the value for the Wall Lintel. If the wall DOES HAVE A VENEER, then the tag would report the Wall Lintel type AND "LL" for the Veneer Lintel. Make sense?
The Veneer Lintel is the only one giving me trouble.
In my Wall Opening family, I've created 2 shared parameters related to the Veneer Lintel:
Veneer Lintel (Yes/No, Instance parameter)
Veneer Lintel Tag (Text, Instance parameter) the Tag is pointed to this parameter
So, I'm trying to set the Veneer Lintel Tag to read "LL" if the Veneer Lintel parameter is checked (True). I want it to be blank (empty) if Veneer Lintel parameter is unchecked (False).
Am I going about this the right way?
I've read lots of forum threads and I've searched Revit Help, and still can't get it right.
I'm guessing that the formula for Veneer Lintel Tag would look something like:
IF (Veneer Lintel, LL, <empty>)
Thanks for your help!
NKramer
2009-10-15, 03:06 PM
You will need to link the tag to a text parameter. The text parameter formula would read
If(Veneer Lintel,"LL","")
HTH
Nick
dlampley.41310
2009-10-15, 03:09 PM
THANKS!
Someone on the RevitCity forum replied with the exact same advice and of course it works GREAT!
clog boy
2009-10-20, 07:56 AM
I learned a very neat trick yesterday. You ever get 'inconsistent units' as result from a formula? For instance if you wanted to multiply moolah with area with integer with bingzoombang? There's one real obvious way to make everything unitless.
Example: =(Cost/1$)*(Area/1m²)*(bingzoombang/1bzb)
Or in other words, just divide the parameter with one instance of it's own unit. The order in which you process everything will make a difference too, but if you really hit this one snag and don't have time or a superbly overflowing know-how to solve it 'the right way', make it unitless and you'll get the right result every darn time.
1320mm/1mm = 1320. 8ft/1ft = 8. 1320 sq.ft/1sq.ft = 1320. $1,836,249/$1 = 1,836,249. Easy like that. It's not even a workaround, it's the right mathematical way to go around with processing numbers.
Now suppose you have a formula and only want one parameter to be interactive. Height = Length / 2 will make both interactive.
You can add a dummy parameter, but that's just clutter. My way: Height = if(Length>0, Length/2, 0)
truevis
2009-10-21, 01:27 PM
This does what a lookup table does (without requiring RME):
Tap Thickness = if(Tap Diameter < 0' 1 1/4", 0' 1 1/16", if(Tap Diameter < 0' 2", 0' 1 5/16", if(Tap Diameter < 0' 2 1/2", 0' 1 5/8", if(Tap Diameter < 0' 3", 0' 1 5/8", if(Tap Diameter < 0' 3 1/2", 0' 1 3/4", if(Tap Diameter < 0' 5", 0' 2 1/4", 0' 3 11/16"))))))
WYSIWYG-BIM
2013-08-28, 09:10 PM
Please help me de-bug my formula. IF ( H_LEFT > H_RIGHT ) H_LEFT , H_RIGHT ) and I am getting a "VERIaBLE NOT EXPECTED" error. I have two fields with lengths in them and i want to do a calculated formula in my scedule that says whichever of the two is the higher value than put it in this new cell. I can write it in excel but it's now working right in Revit.
Thanks!
CADastrophe
2013-08-28, 09:14 PM
The only issue with this is that the IF statement is closed after the conditional statement, which would produce an error. That first closed parenthesis should simply be a comma, instead.
IF ( H_LEFT > H_RIGHT , H_LEFT , H_RIGHT )
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.