Label.TextComponents

Hello,
After the Dynamo update in Civil3D, some libraries lost several nodes. The most popular one is Civil3DToolkit. I used some of its nodes a lot, especially “GetParameters”. Since this node no longer exists, I’m trying to rebuild some routines I had using newer versions.

The routine I’m working on now is for extracting “Alignment Station Offset Labels”. We use this label in all BIM files in my company and export the data to Excel spreadsheets.

With the new Dynamo update, many new nodes were added that make the process easier, like Label.InsertionPoint, Label.Style, Label.ObjectAttachedTo, etc.

But I’m having trouble with the label text. There is a new node called “Label.TextComponents”, but either I don’t understand how it works or it doesn’t return the actual text. It only gives me the name of the item that holds the text inside the label style, but the value itself is null.

To be specific, my label contains some text, most of it as MText. I want to extract the second line of this MText. Is there a way to do this? Thanks!!

Hi @Infra.eduardo.goncal,

Correct. Labels are comprised of components, some of which can be text. The components are defined in the label style, and the Label.TextComponents node gives you the names of each text component. For example:

Once you have the component names, then you can do other things with them. For example, working with text overrides:

I understand, thank you for the information. I explored some functions related to the images you shared, the OverrideTextByComponent module was the closest to what I needed, but it only returns the raw extracted text, not the final rendered result.

Since it doesn’t fully meet my needs, I’ll continue using the old-fashioned method of copying all objects and exploding them 2~3 times to extract the text and then deleting everything.

Still, it would be nice to have a function that simplifies this process. We already have TextComponent, reading the result text from this component shouldn’t be that far off

Understood. I’ll add it to the list :slight_smile:

1 Like