1. Foundation Wall Corner

One task in estimating concrete foundations is to count wall corners.  In Revit, we could model those walls using the foundation wall type. But Revit does not give us that number directly, because Revit has no concept of “Wall Corner”. At Perimeter9, we solve this problem by creating a plugin using Autodesk Revit APIs. By running the plugin on a Revit model, wall corners are counted automatically.


foundation wall corner example

  1. Revit APIs

Autodesk Revit provides a rich and powerful .NET API which can be used to automate repetitive tasks, extend the core functionality of Revit in simulation, conceptual design, construction and building management, and much more. Revit .NET API allows you to program with any .NET compliant language including VB.NET, C#, and managed C++.

  1. Method

Let’s just consider two walls which are connected at their ends (I will talk about how to identify “T” section wall corner in my next blog). How do we know if there is a corner? It is simple. We just need to check if those two walls are parallel. If yes, there is no corner. Otherwise, they form a corner.

wall corner example

wall corner example

The next question is how to tell two walls are parallel. We know each wall has a direction. If their directions are the same, then they are parallel. The direction of a wall is signified by its normal vector. In geometry, a normal vector of a wall is a vector that is perpendicular to the wall exterior face. So, we just need to check if those two normal vectors are parallel.


Before we go any further, let me introduce a math concept – Cross Product (I just grab its definition from Wiki). The cross product a × b is defined as a vector c that is perpendicular to both a and b, with a direction given by the right-hand rule and a magnitude equal to the area of the parallelogram that the vectors span.cross-product

If the vectors a and b are parallel, the cross product of a and b is the zero vector.  So, we could calculate the cross product of two wall normal vectors. If the result is zero vector, then those two walls are parallel (no corner!).

  1. Coding

Here are the C# codes for implementing the method mentioned above.

code to calculate foundation wall corner

All the function calls in this code snippet are from Revit APIs. If you want to know more about Revit developments, the Revit SDK contains useful resources to help you understand the Revit API.

We are implementing BIM based on Autodesk Revit at Perimeter 9. We are developing more features using Revit APIs and math algorithms to solve the problems of building and construction industry.

By Huijun Song