OSArch Community

Function for stationing (chainage)

  1. R

    Is there a function somewhere in the IfcOpenShell or Bonsai ecosystem that can create a stationing string for labels and such?

    Example: station_value = 1234.56

    String (US): 12+34.56

    String (SI): 1+234.56

  2. M

    Im not aware of any. How does it work? We've got code that uses Lark for a variety of input parsing and unit conversion that this might be similar to.

  3. R

    Let’s say Pset_Stationing has a Station property of 1234.56. It’s meaningful for IfcReferent.Name/Description to include the station. Stations are represented as (full chains)+(links).(link fraction)

    A surveyor chain is 100ft long made up of 100-1ft links.

    The example station is 12 chains + 34.56 links, or 12+34.56

    IfcReferent.Name=“PC 12+34.56”

    I have some C++ code I can port to python and add it to IfcOpenShell.api.alignment

  4. R
  5. S

    @Rick_Brice

    Here is an example using stationing format in Excel

    https://excelevangelist.blogspot.com/2012/10/engineering-stationing-custom-format.html

    If I understand your request:

    we use the same prodedure to convert m to chainage (24,452.89 > 24+452.89) in Excel without affecting the value

    in python should be something like

    
    meters = 123498
    
    km = meters//1000
    
    m = meters % 1000
    
    print( f"{km}+{m}")
    

    123+498

    I think REGEX can be used too

  6. R

    In recently add this in ifcopenshell.util.stationing. The function is station_as_string. Input a value, and optionally the number of digits between the + and the ., as well as number of decimal points, and it returns a stringized version of the station value.

    s = ifcopenshell.util.stationing.station_as_string(123456.789,2,2)
    
    print(s)
    
    ‘1234+56.79’

Login or Register to reply.