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



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


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.


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.



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 :stuck_out_tongue:


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


Super awesome <3 thx


Try this…

dimMultiSegmentPy-v1.3-2.dyn (7.0 KB)





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.


Like this?

dimMultiSegmentPy-v1.3-3.dyn (7.1 KB)



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.


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” ?



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,



here is a wetransfer link to my rvt:

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


this workaround seems to work.

Thanks alot, for all your time and patience haha :slight_smile:


It looks good to me :slight_smile:

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!


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


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"
        formula = "Invalid"


OUT = values


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)


# 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

# 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
		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 = []
for dims in allDims:
	if dims.Value == None:
		form = []
		for dim in dims.Segments:
			form.append(getForm(dim, brick, brickN, seam, seamN))
		form = []
		form.append(getForm(dims, brick, brickN, seam, seamN))

OUT = forms

Dimension override value for Above and Below
Python wrong outcome because it rounds my float value

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

Thx for the update