Well in the last post I covered how to fix an error, but lets say you want to show more or less significant digits. To do this type VBALOAD and find the vba file for the HEC-RAS Tools. Do a search for Round in the entire project. You should find some lines of code that look similar to this:
ReachCoords(q) = Round(oStation.Easting, 2)
The Round() function takes a number, in this case the easting of an alignment PI point, and rounds it to the corresponding digits. For this line of code the number format would be 5.12, which is probably good enough. But lets say the boss wants to see it to four digits, well just change the 2 to a 4 and the output will now be four digits.
There is a problem using the Round() function in VBA. The problem is that it uses banker's rounding so instead of rounding in the normal manner you were probably taught in school, the number is rounded to the nearest even number if a 5 is the digit for rounding. So 1.235 and 1.245 will both give the result of 1.24 instead of 1.24 and 1.25 respectively.
To get normal rounding you can use the Format$() function that will round normally. It just converts the number to a string, but in this case it should be acceptable. The code could be revised to be:
ReachCoords(q) = VBA.Format$(oStation.Easting, "#.00"))
You could also look at the vba code reports and change the report to look at the drawing settings to get the rounding value or put the number of digits to round to in the form used to run the report so you can change it when you run the report.
No comments:
Post a Comment