Profile View Labels: (Station Elevation) with custom label text and stations from excel table

Hello,

I need to create a custom script to create Station Elevation Profile View lables, with stations and custom text (simple text strings) from an Excel table.

I don’t find any node that is able to write the custom text: is there any extension able to do it?

Anyone can help?
I am in a hurry for a Project to be delivered by the end of the year

Hi @guidobonin,

There are nodes to do this in the Camber package.

This thread is similar and might help.

1 Like

Thanks.

I will install the extension and check it

I managed to have it working for the alignment labels, while (applying the same approach), with the ProfileViewStationElevationLabel.ByStationElevation the label is created just for the first item in the list of stations.
Any suggestion?

It’s because the Alignment.ProfileViews node is outputting a list instead of a single item. So either get the first item in that list (List.FirstItem) or set the input levels for the downstream nodes to @L2.

Thanks @zachri.jensen

I am still just a beginner…now I still need some help: what do you mean/how to "set the input levels for the downstream nodes to @L2?

Take a look at the “List@Level” section here:

1 Like

Thanks again…I really appreciate.

Now I need a last touch:

Adding a Line Break in the label:

  • when I used the List.Create and typed one by one the strings, I was able to add a “line break” in the label using “\n”.

  • Now, when I used a new approach (parsing data from Excel), I have a list, which looks the same, but the “\n” character is not used as an escape Line Break in the label.
    I also tried to tweak the string in Excel adding string quote (") and the semicolon ( ; ) at the end, but all the text is passed without interpretation to the label

How to add a line break?

In a code block, the \n is interpreted as an escape character:

But when coming from Excel, the \n is treated literally as part of the string:

You could fix this by just adding line breaks directly to the Excel data with Alt + Enter. It’s a little more readable too.

3 Likes

@zachri.jensen Thanks.

It makes perfect sense, but I thought parsing the excel input disrupted the cell contents making it simple text.

Anyway, I am now finalizing my script and I will be able to finalize my job in time: Dynamo+Camber and your support really made my day!!

1 Like

Or you replace ‘\n’ with ‘\n’.

A literal backslash is escaped with another one. If you see one, there are actually two.

You need to be sure it has only ‘\n’ as new line character, and not ‘\r’ or ‘\r\n’ or other combinations.

5 Likes

Interesting.
As I said, it still looks strange to me that a list made from a text string (including the “/n” instance, unprocessed) is managed differently from a “set of items” (I don’t know the exact term…) made of strings (including the same “/n” which gets processed.

I read what you added here like “if I process the “/n” (substituting it with “himself” as string), it becomes what it is meant to be, a line break”
So, when one of the elements of the list is processed as “string item”, it behaves as it shoudl (and “\n” is a line break and not just text within an item in the list.