Round Up Levels in to 0.0 decimal places

I have notices that the levels in a file I am using are to a strange decimal level. e.g. 5449.99999999974.
So I have tried to write some code to reset this, I can’t get it to work.
If I substitute the output of the round to the value with a code block as a value “0” it worked for Level 1 as you can see.

Any ideas at all everyone?

Looking forward to sorting this out and finding out where I am going wrong.

Cheers A

Not sure, but this may be a rounding issue which can’t be fixed(?).
There are numberous topics about precision in CAD programs.
This is one of them. And this one. Maybe this is the root of your problem?
I have the same ‘problem’ in some of my projects
(i am pretty sure my colleague(s) created the levels by typing in the exact height).
2021-09-14 19_01_51-Window

PS
Maybe String from Object after Math.Round solves it?

PPS
I guess i was wrong about ‘can’t be fixed’. Curious how Levels can get like this in a project.

can you try with this method. Please let me know its works or not?
because It work in my system, :joy: :joy:

I think we are try to move the level element by very small distance (assuming 0.0000001mm) so revit try to ignore our commands. thats why i try to move the level with significant value twice to get our level elevation value.
Level.dyn (15.0 KB)

1 Like

YES! but why?
Is it resting the value to 0 then resting it to the round value before Revit gets its hands on it?

I am not sure, I am assuming that we are trying to move the level element by a very small number (0.00000001 units)
when we try to move any element manually by a small number, Revit shows an error that the distance is too small to move. and it won’t move the element. I am assuming the same reason in this scenario.

Thanks for trying @bvs1982 to help and the linked posts are useful for reference and go some way to explaining the 0.000+ thing.
I think the levels were originally placed as imperial and therefore some discrepancy from mm is expected. it was the fact that I couldn’t get the rectified numbers to work but the “real” numbers did?
So the upshot “which I had stumbled across” is that you cant move a level (and possibly anything else) by a grey small amount, but you can move it by a big amount + that small amount and then put it back where you want it (another big amount) but you have to do that before Revit can get involved and shout at you for breaking things.