Need Example On System.Math.Round Usage

I'm trying to get the total length (at 3 decimal point) from start station to end station of a component (say road pavement). So I had the following expression:

System.Math.Round(this.GetElement().GetDisplayValue("MeshSurfaceEntity_EndStation")-this.GetElement().GetDisplayValue("MeshSurfaceEntity_StartStation"),3)

However it failed to give me any value.

Would appreciate any Samaritan out there to see what's wrong with the expression and advise on a solution.

Thank you in advance.

Parents
  • Hi,

    Does it work fine without the rounding function?

    Regards,

    Mark


    OpenRoads Designer 2023  |  Microstation 2023.2  |  ProjectWise 2023

  • hi,

    Tried the following expression scenarios.

    • With System.Math.Round. No value returned.

    System.Math.Round(this.GetElement().GetDisplayValue("MeshSurfaceEntity_EndStation") - this.GetElement().GetDisplayValue("MeshSurfaceEntity_StartStation"),3)

    • Without the System.math.round. No value returned.

    this.GetElement().GetDisplayValue("MeshSurfaceEntity_EndStation") - this.GetElement().GetDisplayValue("MeshSurfaceEntity_StartStation")

    However I managed to get it to work by having the returned values from the this.GetElement().GetDisplayedValue(...) into a temp holder of defined value type (number) and using normal arithmetic on the holder values.

    Not sure why that works but I suspect that it got something to the the type of value returned from the this.GetElement().GetDisplayedValue() function that don't with arithmetic or arithmetic functions (e.g. text)

    Any idea what happen do share... 

Reply
  • hi,

    Tried the following expression scenarios.

    • With System.Math.Round. No value returned.

    System.Math.Round(this.GetElement().GetDisplayValue("MeshSurfaceEntity_EndStation") - this.GetElement().GetDisplayValue("MeshSurfaceEntity_StartStation"),3)

    • Without the System.math.round. No value returned.

    this.GetElement().GetDisplayValue("MeshSurfaceEntity_EndStation") - this.GetElement().GetDisplayValue("MeshSurfaceEntity_StartStation")

    However I managed to get it to work by having the returned values from the this.GetElement().GetDisplayedValue(...) into a temp holder of defined value type (number) and using normal arithmetic on the holder values.

    Not sure why that works but I suspect that it got something to the the type of value returned from the this.GetElement().GetDisplayedValue() function that don't with arithmetic or arithmetic functions (e.g. text)

    Any idea what happen do share... 

Children