Calculating Window Areas using RevitPythonShell

Calculating Window Areas using RevitPythonShell

Anonymous
Not applicable
930 Views
4 Replies
Message 1 of 5

Calculating Window Areas using RevitPythonShell

Anonymous
Not applicable

Hi Everyone,

 

I have run into something I thought was quite interesting, but I also have no idea what to make of it.

 

If I calculate the area of a window in Revit, using a simple formula to multiply the Width by the Height in a schedule, it works fine;

 

Schedule Area Calculation.PNG

 

 

However, If I try and get the area of the same window using the RevitPythonShell, I get a completely different result;

 

 

RevitPythonShell Area.PNG

(The multiplication is just to convert ft² to M²)

 

Can anyone explain this to me? I am very new to programming in general, so am I writing the code incorrectly?

If it is correct, where is Revit retrieving the "Area" Value from? As a window in Revit does not have area as a standard parameter.

 

I would really appreciate any feedback.

Thanks so much

Mitch.

0 Likes
Accepted solutions (1)
931 Views
4 Replies
Replies (4)
Message 2 of 5

aignatovich
Advisor
Advisor
Accepted solution

Hi!

 

Try this:

import clr
clr.AddReference ("RevitAPIIFC")
from Autodesk.Revit.DB.IFC import *
from System.Collections.Generic import *


wall = doc.GetElement(ElementId(199301))

window = doc.GetElement(ElementId(207029))

windowCurveLoop = ExporterIFCUtils.GetInstanceCutoutFromWall(doc, wall, window)[0]

loops = List[CurveLoop]()
loops.Add(windowCurveLoop)

print UnitUtils.ConvertFromInternalUnits(ExporterIFCUtils.ComputeAreaOfCurveLoops(loops), DisplayUnitType.DUT_SQUARE_METERS)
Message 3 of 5

Anonymous
Not applicable

Hi,

 

Thanks very much for the response, it did work.

 

Do you have any idea why my method does not work? In this case, I am more interested in understanding what the problem is than I am in getting the result.

 

Thanks again!

0 Likes
Message 4 of 5

aignatovich
Advisor
Advisor

I think there are two reasons for it:

 

1) potential user family complexity

 

2) legacy families

 

If you create standard window family instance M_Fixed (shipped with Revit) of 0406 x 0610 mm family type, you'll see that its area is one square meter. Why? I don't know...

 

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

Very strange..

 

Anyway, thank you for your input, really appreciated!

 

0 Likes