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)
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!
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
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
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):
doc.Delete(d.Id)
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:
try:
main()
except OperationCanceledException:
break
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.
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
It’s still a bit buggy, I’m such a newbie at this… All thoughts greatly appreciated.
That’s a bit disapointing 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.
Cheers,
Mark
P.S. the end term goal is to rewrite as a C# add-in… man that will be fun!
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.