Python Dimension.Below = calculated value based on actual Dimension value(Maths)

revit
dynamo
python
#1

Hi all,

I m trying to add calculated Dimension.Below values.
Like shown in the picture below (this is what im trying to automate, its done by hand here to show what im trying to achieve)

The problem is that the input for the calculation is variable.
See the picture below

I allready have a bit of python which can set a certain value for every dimension but the values for the dimensions vary now. (Got the code from here: Add Dimension Prefix for all similar type in the Project)
image

On top of that it seems that Dynamo takes dimension values imperial and i need metric.
Here is a part of the script to show what i got so far

Any help is greatly appriciated :slight_smile:

EDIT: I have shown values in excel, but i dont want to use excel. i want to keep it all in Revit / Dynamo / Python if possible

0 Likes

#2

Hey,

I’m not sure what exactly your X and Y numbers are? So my version lets you work those out and feed them in as a separate list…

Your code seems to just do one override for a whole dimension, even if it’s got lots of segments?
image

Hope that helps,

Mark

0 Likes

#3

Thanks for your reply! I think its a bit less simple then that :stuck_out_tongue:

It should look at every single sigment. Sorry if i suggested wrong. The python code might need to be adjusted

In my example X = 60 and Y = 12.
The amount of X needs to be calculated.

Output can either be:
Amount X (dimension devidable by X)
Amount X + Y (dimension -Y devidable by X)
Amount X - Y (dimension +Y devidable by X)
if not devidable by any of those:
invalid (if none of the above applies)

0 Likes

#4

It sounds like a version of a brick dimension checker…

Here’s mine, it’s based on a module of 112.5 and it adds a suffix and overrides colour in view according to the outcome… hopefully you’ll get the idea.

CheckBrickDimensionsInActiveView.dyn (77.3 KB)

I don’t believe this is possible for multi segment dimensions.

Hope that helps,

Mark

Edit: Here’s my WIP auto dimension graph which creates individual dimensions for use… The only snag is that it’s not picking up intermediate wall dimensions yet…

1 Like

#5

It is a brick checker.

its possible to write a value to multi segment dimensions, ► for example


I think it must be possible to write calculated values to, i just dont know how yet.
Im looking in to your graph right now, i dont understand it fully yet though.

Ill get back in a bit

0 Likes

#6

Hey,

I would really like to be able to be able to do it in Dynamo :slight_smile:

Could you show me a node that does that? Or a link to the API?

Being able to do it in Revit doesn’t necessarily mean that it is possible in Dynamo, that part of the API might not have been exposed…

Mark

0 Likes

#7

See the pictures below, this is what you mean right?

2018-12-12_18h08_38

0 Likes

#8

Ooh yes you learn something new every day!

Great :slight_smile: This sets multi values for a single dimension… hopefully you can extrapolate? Unfortunately I need to leave now.

image

and maybe the other graph will give some pointers on getting the rounded values…

Thanks,

Mark

0 Likes

#9

I dont need rounded values btw.
Just excact values, either:
Amount X
Amount X +Y
Amount X -Y
If not devidable like above then Value Below should be “Invalid”

Its hard to calculate i think because it needs to calculate all options per dimension

I dont realy understand the code blocks in your graph. Im kind of new to that

Thanks for your help so far! i ll try and get it solved, i m glad i could help you :slight_smile:

If anyone else got any idea’s how to solve this problem, any input is welcome!

0 Likes

#10

Hey,

So imagine you put a dimension on a plan… The dimension is 120.0003 which is Invalid.

But your dimension is to 2 decimal places 120.00

It would look incorrect to say it was Invalid

So my graph tries to determine Invalid according to decimal places.

Perhaps that’s not an issue for you :slight_smile:

Thanks,

Mark

0 Likes

#11

if its not a whole number in any of those 3 options, it should be invallid.
Its counting bricks. parts of bricks are not wanted.

So basicly X = brick, Y = seam
options are z bricks, z bricks - seam, z bricks + seam. if its none of those it should write invalid.
if the user notices the invalid, he is automaticly triggered the wall needs to change. because its actualy an invalid length.

Thx again :slight_smile:

EDIT: Maybe this could be done alot easyer, or better. If anyone knows how also let me know :slight_smile:

Something else… after i did all this, how do i keep the link with the actual dimension, to place the calculated value where it belongs?

0 Likes

#12

Search for a value in "column A" of Excel and read the corresponding value in "column B" inspired me to take a different approach.

new.append(‘Invalid’) ? how do i addapt this python in my graph?

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

dims = UnwrapElement(IN[0])
A = IN[1]
B = IN[2]

TransactionManager.Instance.EnsureInTransaction(doc)
for i in dims :
if i.Value >= 0 :
i.Below = "NEED HELP HERE"
else :
for j in i.Segments :
j.Below = "NEED HELP HERE"
TransactionManager.Instance.TransactionTaskDone()

#no Output is needed
0 Likes

#13

Hey,

I try to keep stuff in dynamo nodes, i find it easier to work out, even if I end up with loads of nodes…

This should work for you, it’s hard for me to test completely without a full Rvt with loads of dims… I’m sure there are much more efficient ways of doing it, but it should get you going.

If you want the python to work with a list of dimensions, one way is to make it a custom node. Otherwise perhaps someone will have some time to edit the Python for you…

Hope that helps,

Mark
dimMultiSegment.dyn (58.1 KB)

1 Like

#14

Thanks, ill try this
Graph would look alot easyer if it was possible with python though :smiley:

ill get back to review :slight_smile:

0 Likes

#15

Hey

You can ‘node to code’ to compress it and speed it up?

Most likely @Nick_Boyts will show it’s done in 3 lines of design script… :smiley:

Cheers,

Mark

0 Likes

#16

Thx again Mark, the script doesnt run out of the box yet. ill look in to it in about 3 hrs or so.
i m not known with code to node.

ill upload what i got here. maybe thats easyer
0DYN.dyn (17.8 KB)

0 Likes

#17

Edit:

I agree with you that this is something that Python would do very efficiently, if you can run each value against if, elif, elif, else you would avoid the difficulty i’m having keeping the ‘keys’ from the initial order to the end to allow the original list order to be restored.

If I have some more time I’ll try to look at it.

Node to Code can be done like this…

Right click in the workspace when you’ve got a few nodes selected…

It becomes this…

0 Likes

#18

Wow, does it still work like it did before?
it makes my current graph:

alot compacter but to me its also harder to understand this way:

Basicly i got everything i need right now, only need a method to compare > fill in below value now

0 Likes

#19

Yeah, exactly, but probably a bit easier than Python?

That’s the trade off.

I believe it is also faster…

FYI: My graph works for me…
:stuck_out_tongue:image

1 Like

#20

wow, that was the graph u send earlyer?
Ill try and make it work then, it looks indeed like what i intended.

0 Likes