Wednesday, October 06, 2010

Calculating Pi in Revit 2011

Now I’m not going to take credit for this, but some bright spark over at the AUGI forums worked out that you can get Revit to use Pi in formulas..the credit goes to Alfredo Medina for finding this. I am currently working on a panel with a circular aperture.


I wanted to calculate the percentage of the hole, compared to the size of the overall Panel, so as part of this exercise I needed to work out the area of the aperture. So Alfredo says that if you put the following formula in

pi() this will give you 3.14159265 automatically.

He wasn’t wrong….


In knowing this I could then use the following formula to work out the area of the circular aperture.

pi() * Radius ^ 2


So I am not sure when this one sneaked in through the back door, but it sure isn’t documented in the help file. : – )


seandburke said...

That has to be one of the coolest things I've seen all day! Boy do I need a life. ;-)

Alfredo Medina said...


What a nice surprise to find that you have posted a note about pi in Revit and a reference to my post in Augi about this undocumented feature.

Somebody at Augi asked me how I found out that. Well, I am going to answer that question here. When I read the question in Augi, I immediately started to try to find pi, and after trying different combinations of formulas, I got an error message saying something like "incorrect number of parameters in function", so I said "ah, so pi IS a function!", so I tried pi with one, two, and three values within parenthesis, and I got the same error message in each case. So I thought that it could not be more than three, so I said "how about zero parameters?" , so I tried pi(), and immediately Revit gave me the famous number: 3.14159... !

I am going to be a speaker this year in Las Vegas, and of course I am going to include this tip about pi in my virtual lecture, which is about threads where I have participated in the Revit forums during this year, 2010.


Alfredo Medina

Unknown said...

On asking Martin Schmidt this summer about a list of undocumented functions (since pi() is/was undocumented) he mentioned this one to be the only one. He also mentioned that he requested it to be added because he had to make so much use of pi earlier this year, iirc.

I asked for floor() and ceil() or ceiling() functions to be added. I can't remember if I submitted a good example to make a business case of their need, but it woulndn't hurt if others would chip in with their suggestions of needed functions and business cases for them.