I’m pretty new to Dynamo and feel like I have a pretty basic script in mind. When we import details from acad, all the mtext gets broken into single line text notes in Revit. (Incidentally, if anyone knows how not to make that happen, I’d appreciate a hint!) We have a file with a ton of details that an intern imported a summer or two ago, but now we want someone to combine lines of text back into one multiline text note. I’d think a Dynamo script would make that less painful but I’m having trouble getting it going.
I did find this thread in my searches, but aside from alerting me to Clockwork and getting that installed, I’m not much further.
I’d love some help. Thanks!
Dynamo now has TextNote.Text (I’m assuming it wasn’t always an OOTB node if a Clockwork one was made). You’ll still want Clockwork though to get the Text Note location points with Clockwork’s Element.Location (the OOTB GetLocation node will not work with text notes). Download the package Springs as well; I think the node Springs.Geometry.GroupByDistance might work with the points you pull from Element.Location
1 Like
First up: I really dislike importing content like this. 90% of the time you are spending more hours than you are saving long term.
I’ll piggy back on that looking into the various codes which were written to check the text shift when upgrading from 2016 to 2017 can be utilized to help your text box size (I believe these have no end by default).
Also, please check your line styles to purge unused imported styles, and remap the imported ones to the ones in use. Those are FAR more annoying IMO, as I can always move all 3 text boxes.
I dislike it as well, but this decision was made long before I was here to have any input. I’ll check out your suggestions. Thanks!
Is there no way to just pull the info from one text box, add the info from another text box, and then put them together in a new text box?
I downloaded Springs and that has some helpful nodes. Thanks!
@slipstream no that is certainly doable, using TextNote.Text, String.Join and then TextNote.ByLocation.
4 Likes
OK, I got a working script which does what I was hoping. Thank you for your help!
As it works now, instead of each subsequent text following the previous, each text box gets a new line. Is there a way to combine them together more like a sentence? And is there a way to delete the obsolete text boxes?
1 Like
@slipstream Yes and yes - can you upload a screen capture (use the little camera icon in top right of Dynamo) of how your graph is set up so I could better advise on how you can combine them?
I actually figured out the deletey part.
1 Like
Hmm I’d throw a String.TrimTrailingWhitespace node after your string outputs and see if that does it. You can use List.Create to connect your strings, and then String.TrimTrailingWhitespace after the list, and then connect that to String.Join
I would suggest trying out something like this though, so the graph could easily work with different amounts of text boxes:
(Just set “refresh” to false so you don’t have to repick the same text notes each run as you get the graph in fully working order)
5 Likes
That worked beautifully, thank you! And dang, yours is so much cleaner than mine!
Also, how would you delete the obsolete text now in your example?
No problem! Generally, its better to process things in lists if they’re all going to undergo the same function at the same time Here is how I would delete. The Transaction.End and Passthrough node are so that the new text value is set before the remaining ones get deleted, otherwise things would happen simultaneously and the text would not get set properly
6 Likes
Ah, thank you. I was basically going to set up the delete elements node on the other end with another instance of the select elements node and re-select the ones I wanted out. Yours is much more elegant and less likely to cause unintended deletions.
1 Like
@slipstream When I first saw your post I had imagined something like this (collect text notes and group by their location points)
It works, but unfortunately it would probably fail in most conditions depending on how the text is broken up and how far apart separate sentences are. I only ran on this set up:
and it failed if text 1 and 2 or 4 and 5 were any closer together than they are now, haha.
Maybe rather than collecting all text notes in view, what I did above can be used with a “Select Model Elements” so you could quickly marquee select the sentence text notes that you’re processing that run, rather than having to pick them in order each time
1 Like
Hello all,
I am having a very basic problem in that I cannot select elements using the Spring Select Elements node. Is there something I need to do beforehand? As in I cannot create a list of text elements to combine .
Thank you very much for everything!
Update: I realized I was using an incompatible version of dynamo for the Springs package, I am now using the correct one and everything is working wonderfully. Thank you for your help!
1 Like
@Callie.W - best to start a new topic for this, mentioning what version of Revit, Dynamo and Spring Nodes you’re using.
1 Like
is there a way to may it cycle back to the beginning? Now I leave it on automatic then by toggling the first Boolean, it let’s me pick another pair. Since I am picking the text (room name/room numbers) two at a time, a goto beginning and do again function would be handy and eliminate one of four clicks.
When passing the ‘rest’ list from list.deconstruct to passthrough it only gets the first item in the ‘rest’ list. How can I make it do the delete element function on All the elements in the ‘rest’ list?