Filter dimension by length and add text

Hey guys.

I am really fresh at dynamo.

I need to write something above or below my dimensions which goes through all over the facade.

After a while, i found some ready to use dynamo script and use it. Now it works but i need to filter dimensions for example 3/4’’ is joint but if its bigger then 3/4’’ i want to write Panel Width.

Or maybe if its possible, first i choose only dimensions which length value is equal 3/4’’ than for my pannel which is bigger than 3/4’’

So im really look forward for your answers. Thanks!

Have you tried using this?

Thank you Revit_Noob but i have no idea how to connect nodes that you advise me.

TextAddForDimensions.dyn (6.5 KB)

here is the script that im already use. could you show me how its connecting?

@barisbagis how are you i try the same idea you need and i get this result

my issues is this script didn’t work on continuous dimension i must separate the dimension to work

You could try this Python script to see if it works :slight_smile: Please note this has been written for the metric system, so if you’re in the US it will be a little different.

import clr 
clr.AddReference("RevitServices") 
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

dimensions = UnwrapElement(IN[0])
text = IN[1]
value = IN[2]

TransactionManager.Instance.EnsureInTransaction(doc)

results = []

for dim in dimensions:
    numOfSegs = dim.NumberOfSegments
    if numOfSegs > 0:
        for num in range(numOfSegs):
            seg = dim.Segments.Item[num]
            if seg.Value * 304.8 > value:
               dim.Segments[num].Above = str(text)
            results.append(dim)
else:
    if dim.Value * 304.8 > value: 
        dim.Above = str(text)
        results.append(dim)

TransactionManager.Instance.TransactionTaskDone()

OUT = results

It will set the chosen text above the dimension - but only if the dimension, or dimension segment, is greater than your chosen value :slight_smile:

2 Likes

thanks @solamour for your advice but i need to apply the text for a chosen value not to a value greater than another value :wink:

@solamour kindly can i ask you about the package where i can find (View.current)

View.Current and Collector.ElementsInViewByCategory both come from the Designtech package :upside_down_face:

You can achieve both with out-of-the-box nodes … it just takes a bit more!

image

Side note - Code has been amended to now only do text on top of dimension values that match:

import clr 
clr.AddReference("RevitServices") 
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

dimensions = UnwrapElement(IN[0])
text = IN[1]
value = IN[2]

TransactionManager.Instance.EnsureInTransaction(doc)

results = []

for dim in dimensions:
    numOfSegs = dim.NumberOfSegments
    if numOfSegs > 0:
        for num in range(numOfSegs):
            seg = dim.Segments.Item[num]
            if round(seg.Value * 304.8) == value:
                dim.Segments[num].Above = str(text)
            results.append(dim)
    else:
        if round(dim.Value * 304.8) == value: 
            dim.Above = str(text)
            results.append(dim)

TransactionManager.Instance.TransactionTaskDone()

OUT = results

@viktor_kuzev

@Mostafa_El_Ayoubi