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

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

Ooh yes you learn something new every day!

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

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

Thanks,

Mark

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

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

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

Thanks,

Mark

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

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

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?

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
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 &gt;= 0 :
i.Below = &quot;NEED HELP HERE&quot;
else :
for j in i.Segments :
j.Below = &quot;NEED HELP HERE&quot;

#no Output is needed``````

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

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

ill get back to review

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…

Cheers,

Mark

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)

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…

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

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

I believe it is also faster…

FYI: My graph works for me…

1 Like

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

Try if this works. I think this is what you want:
dimComment.dyn (7.4 KB)

Python:

``````# Enable Python support and load DesignScript library
import clr
from Autodesk.DesignScript.Geometry import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
# The inputs to this node will be stored as a list in the IN variables.
allDims = UnwrapElement(IN[0])
brick = IN[1]
sep = IN[2]
ftmm = 304.8

forms = []
TransactionManager.Instance.EnsureInTransaction(doc)
for dims in allDims:
for dim in dims.Segments:
val = round(dim.Value * ftmm)
x = str(int(round(val / brick)))
if val % brick == sep:
form = x + "X + Y"
elif val % brick == brick - sep:
form = x + "X - Y"
else:
form = "Invalid"
forms.append(form)
dim.Below = form

OUT = forms
``````

Edit: updated for rounding error

2 Likes

It says its corrupted… i ll try to duplicate it, will get back to you guys

I am using Dynamo 2.0. I will upload again: dimComment.dyn (7.4 KB)

Leaving office for the night, let me know if it works or you have any problems and I can try to help tomorrow.

1 Like

Still error opening it, i ll try and duplicate it and get back to you!
The picture ur showing atleast looks like what i m trying to achieve.

Thanks!

It works for me, awesome work @kennyb6!

dimMultiSegmentPy-v1.3.dyn (4.4 KB)

It seems i can open @Mark.Ackerley file which should be the same as @kennyb6 gave.

anyways, it seems to work for multi segmented dimensions, but skips the single dimensions for me.

PS: This looks awesome btw