 # Thread: Revit Formulas for "everyday" usage

1.  IF ( AND(Foot_Length > 0', Foot_NS ), 1<2, 1>2)

Remove the =1 and you should be fine.  Reply With Quote

2. 1  Not in front of Revit right now, but is the "IF" even necessary?
I *think* you can just say:
AND(Foot_Length > 0', Foot_NS )
The AND returns a True of False to the If, so there's no reason it can't just return the same as the final value.
(Didn't check the logic, either)  Reply With Quote

3.  Absolutely correct  Reply With Quote

4.  can someone help me with this? I wanted to make a table for electrical load with wire sizes and all. This is my syntax.
if(CB = 20, 3.5, if(CB = 30, 5.5, if(CB = 40, 8, if(CB = 60, 14, if(CB = 70, 22, if(CB = 90, 30, if(CB = 100, 38, if(CB = 125, 50, if(CB = 150, 60, 100)))))))))   Reply With Quote

5.  cwasher made a pretty good post on calculations for roofing here: https://revitforum.org/showthread.ph...Ridge-Cap-TRIG!   Reply With Quote

6.   Originally Posted by ArkiTupas can someone help me with this? I wanted to make a table for electrical load with wire sizes and all. This is my syntax.
if(CB = 20, 3.5, if(CB = 30, 5.5, if(CB = 40, 8, if(CB = 60, 14, if(CB = 70, 22, if(CB = 90, 30, if(CB = 100, 38, if(CB = 125, 50, if(CB = 150, 60, 100)))))))))   Reply With Quote

7. 2  Even/odd number problem
In Revit, if you want to test if a number n is even or odd, you can use the following formula:

if(roundup(n/2) = rounddown(n/2), "even", "odd")

Using even/odd functions to find out if an number is even, odd, integer or exactly half

In Revit, for example, cosine function can do the trick of determining if a number is even or odd (since cosine is even function itself):
if (cos(n * pi (or 180°)) = 1, "even", "odd")

Both cosine and sine can be used to tell you if something is exactly half or an integer, for example:
if (cos(n * pi (or 180°)) = 0, "exactly half", "not half")
if (sin(n * pi (or 180°)) = 0, "whole number / integer", "not an integer")

// pi or 180° depends on your angle settings in Project Units dialog  Reply With Quote

8. 2  Nice tip, Mikrko!

Looking back at the posts above, I noticed how difficult Arki's formula is to read. Not to mention it's nearly impossible to match Parentheses
if(CB = 20, 3.5, if(CB = 30, 5.5, if(CB = 40, 8, if(CB = 60, 14, if(CB = 70, 22, if(CB = 90, 30, if(CB = 100, 38, if(CB = 125, 50, if(CB = 150, 60, 100)))))))))

Enter every programmer's favorite editor: Notepad++ Copy/Paste your formula into Notepad++, put your cursor over a parenthesis and it will show you it's match. (Notice the red highlight?) I also like to indent long formulae to make them even more readable.   Reply With Quote

9. 2  Odd or Even

To determine if an integer "n" is odd or even:

if(-1 ^ n = 1, "even", "odd") See attached Revit family.  Reply With Quote

10.   Originally Posted by DaveP Enter every programmer's favorite editor: Notepad++ Copy/Paste your formula into Notepad++, put your cursor over a parenthesis and it will show you it's match. (Notice the red highlight?) I also like to indent long formulae to make them even more readable. One of the greatest programs ever made.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•