Combine multiple text: start typing in a new line

Hello everybody!
My first post in Dynamo forum, so exciting :slight_smile:!
In this post @awilliams created a nice script that would combine multiple text notes into one. The resulting text notes gets placed in one line.
What if I want to place new text note in a new line? There is an idea that it is possible to somehow use ASCII - 11, but in this post @jacob.small does not recommend to use any ASCII tables.

Does anyone have any ideas about it?

Thank you all in advance!

Oh that post is a blast from the past! I still don’t recommend ASCI character usage as it rarely scales outside of your current application. All it takes is one person to not have that font.

For your problem, I am not 100% sure what you are after. I think you want to split a multi-line text element into multiple elements. Not sure how far down the rabbit hole you want to go (new lines when the word wrap runs long? Just split at the existing new line marker in the multi line text element? Something else?), but this process description should help you work out what needs to happen.

You can split the string from existing multi line text at new line markers by a String.Split node, using a string with just a new line marker (return or enter in your keyboard).

To calculate new lines due to intermediate line wraps you could use an assumed character width (measure it as it will be based on your font configuration), find the index of all spaces in the sublists if strings, multiply that by the assumed width value to get a ‘length at string’ and set up a means of setting additional line breaks by splitting the string at the space before the division having a new line value. Flatten that list completely so it’s 2D.

Then sum your text height and spacing between lines to get a point offset distance, and count the number of strings in your string list. Build a range from 0..#StringCount..-PointOffsetDistance;, and use that as a Y value for a Vector.ByCoordinates with an X and Z value of 0.

Next find your initial insertion point of the text, and translate that by your vector.

You can now use a TextNote.ByPoint node to place a new text note, in the view (assuming you can gather this on your own), at the points in the point list, with the values in the strings list, and the other miscellaneous adjustments you desire.

Hello Jacob,
Thank you for your response! I think I wasn’t clear about an issue I encountered.
What I am trying to figure out is the opposite of what you suggest: I want to take multiple lements and join them into a single multitext element.


First png file is a script I found by @awilliams. That script allows to go from 1 to 2 (see second image).
In order to get from 2 to 3, I need to know how to jump into new line.

image

Do you have any ideas?

Thank you in advance!

Gotcha.

In the graph, change the node I circled for an actual string node.

Set the value in the string node to an new line character (return or enter on your keyboard).

4 Likes

HI what package is the SelectElementsInOrder node came from?

If I am not mistaken that is from Springs. Update th package and check carefully. :slight_smile:

thanks @jacob.small, I’ll go check…
EDIT:
updated my package but still cannot find that node…

Jacob,
Thank you very much!
Solution is so simple:)

1 Like

Hello!
Revit 2019.2
image
image

2 Likes

Not sure if the node is not compatible with Dynamo v1.3.4, i downloaded the latest version but its not appearing in my packages panel, but its there in the package manager.

I tried to open the dyf file but says it’s corrupted.

I see two options for you:

  1. install Dynamo 2.0
  2. install previous version of springs (image from GitHub)
1 Like

Thanks, found it. I will try to recreate the graph and see if it will work for me.

how you make selectelementinorder node block?

It’s from the spring nodes package.