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

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

**kennyb6**#23

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.

**Schasfoortyoeri**#24

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!

**Schasfoortyoeri**#26

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

**kennyb6**#27

Ah I made it only with multi in mind as it uses the dimensionsegment class instead of dimension. I can fix it tomorrow.

**Schasfoortyoeri**#30

Nice!

It should have one more option: amount of bricks

this case brick = 100 > 1000 should be 10 X

Bonus round: would it be possible to write the invalid dims as follows:

5161 = 51 bricks of 100 + Rest ? like i did manual with the red dimension in the picture above.

**Schasfoortyoeri**#33

the red value seems to make a mistake in rounding.

i put brick value at 100 and brickjoist at 10.

It should be 51X + R if calculated by hand

( 51*100 + rest) rest = 61 in this case.

The 10X is good though… i really need to learn python, this really helps alot finnishing graphs

EDIT: I took away the Round in calculating the x value in python. this fixed it

Works like a charm now.

**Schasfoortyoeri**#34

My solution messed up the K-V value now …

so basicly it wasnt the solution … i m confused which round i should have left untouched

The 690 value should be 7K - V in this example

@Mark.Ackerley It should only round the convertion from ft to mm

perhaps something like this:

elif val % brick == brick - sep:

form = int(ceiling(x)) + “K - V” ?

**Mark.Ackerley**#35

Hey,

It’s quite difficult for me when you don’t upload an Rvt?

Perhaps this helps? You always want to round down i guess?

Hope that helps,

Mark

**Schasfoortyoeri**#36

here is a wetransfer link to my rvt: https://wetransfer.com/downloads/db16e72fea8480891f64dc2e28fd0e2620181213132537/36ff7c52782235a469dd7a4b4859b95120181213132537/6594c7

The graph you send at post #30 works best, except it rounds up somehow.

in the picture i had set brick to 100 and brickjoist to 10

X = 100, Y = 10

Here the graph:dimMultiSegmentPy-v1.3-3.dyn (7.1 KB)

Only the X + R values seem to go wrong if they are above half a brick

half a brick is 50 in this case.

dimensions under 5140 is good now, the dimension 5161 seems to be rounding up somehow

**Mark.Ackerley**#38

It looks good to me

I’m sure the code could be tidied… We could use a Function, as we are essentially doing the same thing twice…

But then, it’s still pretty readable and a lot more simple than the node method.

Great to have a working solution!

**Schasfoortyoeri**#39

Yes, i agree.

Also this is better then the first solution i suggested.

where i let dynamo calculate 100 options and then compare with dimensions. this basicly calculates per dimension which always works also if its option 101.

Thanks again @Mark.Ackerley and @kennyb6

**Nick_Boyts**#40

It’s more than 3 lines… and it’s python. But still fun!

```
dataEnteringNode = IN
dimensions = IN[0]
x = IN[1]
y = IN[2]
values = []
for d in dimensions:
r1 = (d + y)%x
r2 = (d - y)%x
if r1 == 0:
formula = str((d + y)//x) + "X - Y"
elif r2 == 0:
formula = str((d - y)//x) + "X + Y"
else:
formula = "Invalid"
values.append(formula)
OUT = values
```

**kennyb6**#41

I saw you guys updated it already but here is my version of it. I set it up to be fully customizable in Dynamo Player as well.

dimComment.dyn (13.4 KB)

Python:

```
# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# Functions
def getForm(dim, brick, brickN, seam, seamN):
val = round(dim.Value * ftmm)
x = str(int(round(val / brick)))
if val % brick == seam:
form = x + brickN + " + " + seamN
elif val % brick == brick - seam:
form = x + brickN + " - " + seamN
elif val % brick == 0:
form = x + brickN
else:
form = str(int(val // brick)) + brickN + " + R"
dim.Below = form
return form
# The inputs to this node will be stored as a list in the IN variables.
allDims = UnwrapElement(IN[0])
brick = IN[1]
seam = IN[2]
brickN = IN[3]
seamN = IN[4]
ftmm = 304.8
forms = []
TransactionManager.Instance.EnsureInTransaction(doc)
for dims in allDims:
if dims.Value == None:
form = []
for dim in dims.Segments:
form.append(getForm(dim, brick, brickN, seam, seamN))
forms.append(form)
else:
form = []
form.append(getForm(dims, brick, brickN, seam, seamN))
forms.append(form)
TransactionManager.Instance.TransactionTaskDone()
OUT = forms
```

Dimension override value for Above and Below

Python wrong outcome because it rounds my float value

**Schasfoortyoeri**#42

Thanks! we use datashapes and actual buttons on the Revit tab. kind of the same idea though

Thx for the update