i have tried but i didn’t get any node for this.
if you have so many text notes when you need to drag each and every text notes one by one.
i wonder we can drag multiple text notes with help of dynamo.
is this possible with dynamo ?
Thanks in Advance.
Sure, you can adjust the text width through the width property in the API. Here is an example Python script, where it doubles the width of the textnotes. You can change it to a specific number if you know it or just increase the multiplication.
# Import RevitAPI
# Import DocumentManager and TransactionManager
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
if isinstance(IN, list):
txts = UnwrapElement(IN)
txts = [UnwrapElement(IN)]
# Place your code below this line
output = 
for txt in txts:
width = txt.Width
txt.Width = width * 2 #change this to whatever width needed
# Assign your output to the OUT variable.
OUT = output
Keep in mind that every time you run the script (careful for automatic mode) it will double whatever textnotes you put in the IN
Yes lol. Please read what was written carefully, instead of just trying to copy and paste everything without understanding. First off, it requires an input. That input should be a textnotes list. If you want to do every text note in the document, you can use categories (text notes) -> all elements of category -> IN of the python.
Second, please pay attention when you copy and paste things. Clearly the “Keep in mind…” portion is not inside the code, so you should not have it added inside the python (your line 34). That is a warning for you to read.
lol. i was totally lost. sorry for that
see below image i have select text notes with “select model elements” node.
but still not change text width.
i have removed line 34. but still getting this error.
Ahh I see the problem, when I copy and pasted the code, two indents were lost. Line 16 and line 18 should have an indent before them. Press tab before the txts = … for both of those lines. I have edited the original post to fix it.
No problem! Glad you can find it useful. But keep in mind that I wrote in the script to only double the width. Depending on your text note contents, that might not be enough for all of them. You can always increase it by adjusting the line 26 of the python script to another number.
Width of a single character is tricky because that requires you to know the font and the width of charaacters in the font, which I don’t think is possible.
For the number of characters, that is easier. You can take the textnote’s .Text property (this returns the string inside the textnote), get the length of that string, and multiply it by some number (what you think the average width of a single character is) to get an approximation.