# 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
# 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
TransactionManager.Instance.TransactionTaskDone()
OUT = forms
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” ?
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
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.
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