Auto Dim Walls


This code dimensions a wall in a plan.

It works with internal and external, it works with pointy walls, it works with families and intersecting walls.

(upload://g2GPICFWu7YpijDhaPhpN1YGaCq.dyn) (16.9 KB)

Hope that’s useful,


Edit: I’d made it to create individual dims, but it’s very easy to make it output a single dim, so i’ve added that option
1 Click Dimension Wall.dyn (18.5 KB)


Will it work for the walls in the linked model?

Looks great @Mark.Ackerley!

1 Like

Hey, @Revit_Noob,

The code runs off a pick… I’d need a node to isolate a wall in a linked file? But if you can get that, it’s really easy to replace

ref = uidoc.Selection.PickObject(ObjectType.Element)
targetWall = doc.GetElement(ref)

with targetWall = UnwrapElement(IN[3])

Impressive work !
Thank you for sharing.

1 Like

Thanks guys (for all the help :smiley:) it’s really basic code… if anyone would like to give it a tidy and put it in a package, that would be great :slight_smile:

1 Like

Maybe have the IN port for selected walls be optional, if no walls are given (input is null or empty or is not of category Wall) then do the pick wall code, else use the given walls? Best of both! :slight_smile:

1 Like

Thanks Dan,

At the minute, my code is taking a single wall… that’s ended up being complex enough!

When I’ve got more time, I’ll go back and rewrite to work with a list which may contain 1 or more walls. If someone fancies doing that for me, I wouldn’t complain!

It also needs a bunch of error catching, tidying to make more defs and some more commenting. Probably a section/elevation version would also be good.

For the minute I’m just glad to have something working acceptably :slight_smile:



Ha, fair enough Mark… We can put that in the feature requests section! Ha! Great work though mate! :slight_smile:

1 Like

Hah, yeah I’ll need to get a github :stuck_out_tongue:

Thanks for your help, that bit for getting the height of the intersection line is awesome!

1 Like

What about column grids in a linked model? And column grids in host model?


Apologies I’m away from my PC… Yes I expect so, there are quite a few nodes in the genius loci package for getting ‘references’, you can then feed those into a dimension by references node… Perhaps do a few forum searches?

I used Python because everything got very knotty and particular… The references are tied to geometry but, for example, the edges of a face do not return a reference, only the edges of the original solid. I would rather have used someone else’s nodes :slight_smile:

Hope that’s useful,


1 Like

Works Awesome @Mark.Ackerley . Thanks for sharing :slightly_smiling_face:

I got some dimensions value as 0mm. So i had to filter and delete it like this

Is it possible to do in your python script ? :thinking:

1 Like

Hi Nissal,

Sorry I’m away from my PC…

I was trying to remove duplicates using the combined X + Y value, I had to change the rounding to catch them… If you are getting 0s then something is going wrong with that… Could you post a sample file? Thanks

Yes I believe it would be simple to test for a 0 (or nearly 0) value for single dimensions and delete them… But I’m not sure if you could do it for a multi dim, and presume the code would run a bit slower, so I would prefer to catch them prior…

In the transaction, something like…

For d in dims:
    If isAlmostEqualTo(d.Value, 0):

Let me know how it goes :slight_smile: Thanks for the feedback…


Great work @Mark.Ackerley. A possible improvement would be to put it all in a while loop so you can keep picking walls instead of having to rerun the program each time. Then, when you press esc or cancel out of the PickObject method, it returns a OperationCanceledException and you can use that as a way to exit the while loop.

So I tried this, only had to do 3 things:
1 Add from Autodesk.Revit.Exceptions import OperationCanceledException under the from ...DB import *
2. Put everything below multiDim = IN[2] under its own main() function.
3. Then at the bottom, I wrote:

while True:
	except OperationCanceledException:

And now the graph lets you keep picking until you press Esc and it finishes. Once again, great work. I had some issues with my company’s standard template (ref array returned empty list) so I will try to investigate it on my own and let you know.

After more testing, this brings up another issue but should be easily solved. All of the dimension creations done in the while loop are considered a single ‘action’ in Revit, so one undo removes all. I think if you set up the transaction using the Transaction class under Revit.DB, you can make each one their own transaction. So let’s say you are 10 walls deep into the dimensioning and you dimension the wrong wall, you can press undo a single time to get rid of just the one.

1 Like

test file with zero dim.rvt (3.2 MB)


Thanks Mark :slightly_smiling_face:

1 Like

Hey @kennyb6 ,

Nice to hear from you, thanks for your suggestions… I took a slightly different route…

First I rewrote the whole thing to take lists…!

Then I added something to see if stuff was already selected? If not, I added a selection rectangle option. The great thing about that, is you can use an iselect filter, so you don’t get the horrible lag you usually get when dragging a box across a floor plate, because it’s automatically ignoring everything except walls :smiley:

It’s still a bit buggy, I’m such a newbie at this… All thoughts greatly appreciated.

Hey @Nissal ,

That’s a bit disapointing :frowning: could you try with this version? Obviously there are 2 fails going on… The inner wall references being included & the duplicate references. I will be busy for the next couple of weeks, but will try and have another look at it.



P.S. the end term goal is to rewrite as a C# add-in… man that will be fun!

1 Click Dimension Wall.dyn (22.5 KB)


Hi Mark,

Looks impressive… but when I run the script no dimensionlines appear.
Also under the “Undo” button no Dynamo history is added, so it looks like the script has not functioned.

Any idea ?

Best regards, Fred

R19_Walls.rvt (1.2 MB)


It’s working for me?

I updated the code to deal with lists, stacked walls & shared coordinates!

FYI… The built in dimension tool would work fine for your file…

Hope that helps,


1 Click Dimension Wall.dyn (29.6 KB)

1 Like