Reformate string for chainage

Hi,

What would be the best way to reformat a list of strings such as:
10.12345
100.12345
1000.12345

Into Station or Chainage typical format
0+10.12
1+00.12
10+00.12

Basically I need to insert a “+” two digits to the left of the decimal point.

Any help is appreciated, thanks

Python

3 Likes

Civil 3D Toolkit

2 Likes

Thank you Paulo for the quick response. I am not finding the Civil Toolkit package to download. Is this something you are working on, or is it available already and I am missing a step to install it?

Will be available after AU, for now happy Python :slight_smile:

Hi @marshmallow ,

Alternative approach using basic nodes.
StnFormat.dyn (24.2 KB)

Hi @Paolo_Emilio_Serra1 ,
Nice python and package (Civil 3D Toolkit)

Cheers,
Jowenn

2 Likes

@Paolo_Emilio_Serra1 ,
thanks for the python code, looks a little intermediating to me but time to learn something new. It seems like you’re holding on to some great new functionality in the Toolkit for a big reveal in AU.

Thanks @JowennLua, your graph is very similar to how I addressed it, but it seemed like a very long operation for me!

That’s the spirit!

Hi @marshmallow ,

Can be converted to code to make it not that long. Just want to show the long method. Here’s the converted method. I’m not sure how to code the number to string so I left it as is. StnFormat_Code.dyn (9.8 KB)

Cheers,
Jowenn

2 Likes

I installed the Civil 3D toolkit and used the MText.StationFormatting and it was exactly what I needed. Nice Work and thank you, thank you, thank you!

2 Likes