wall chamfers of equal length

image by archi-lab

This came by my desk the other day from one of my colleagues in San Francisco office. He was wondering how to automate or semi-automate creation of wall chamfers of equal distance between two walls. I took a look at that and even though it seemed pretty straight forward at first it actually wasn’t. Here’s the definition that I came up with as well as some Python code that I had to type up to get it to work.

So basically the idea was to select two walls, and then have a third one be created that connected the first two at an equal distance from each wall end. There was a node in Springs Nodes package for Dynamo, that could create chamfers but unfortunately it seemed to be trimming both ends of the wall curves, and that was not really working for me. So I decided to quickly type up my own distance based definition that would chamfer two curves by a distance:

As you can see in the code above it’s nothing special. We are basically taking two input curves and a distance, figure out at which end each curve intersects the other to find the chamfer corner, and then simply offset curve ends from there. Finally we create a chamfer curve, and the output is three curves. We can next use these curves for two purposes. First we want to take the two new shorter curves, from the existing walls, and use them to adjust wall lengths. Then we want to take the middle curve, to create a new wall, that way we will have three new curves/walls that are chamfered. Simple enough:

Since Revit Wall doesn’t have a method for changing it’s length in order for us to adjust it, we have to simply replace it’s Location Curve with a new one. That’s exactly what we are doing here. One thing worth noticing here is that I used a method called WallUtils.DisallowWallJoinAtEnd() in order to basically disconnect the two walls. We do that, because otherwise the two walls are connected and one will get dragged with the other when we adjust their location curves. Once we are done changing the curves, we can enable wall joins and all will be good.

Finally we use the middle curve to create a new wall, and pull the properties (type, level , height) from one of the input walls to make sure that our chamfer matches.
That’s it. It was pretty quick and hacky, but it did the job that I was asked to do so hopefully it will help others.

Cheers!