# How get i the correct "rounding"?

**URL:** https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317
**Category:** Uncategorized
**Created:** [March 14, 2022, 12:38pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317 "2022-03-14T12:38:54Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 12:38pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/1 "2022-03-14T12:38:55Z")

</div>

hello dynos,

I want the numbers shown as in Revit.  
Dynamo does hide ceros and not representing the numbers as shown.  
How can i deal with that?

KR

Andreas

 ![2022-03-14_13h37_03](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/6/f649678d72891625fdde5c856261af2aade42cbe.png)  
 ![2022-03-14_13h37_11](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/a/5ac07d7eafab71c07313004098e8356462edbf72.png)

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [March 14, 2022, 12:41pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/2 "2022-03-14T12:41:41Z")

</div>

`Math.Round(number, 3);`

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 12:44pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/3 "2022-03-14T12:44:19Z")

</div>

> [@jacob.small](#):
>
> Math.Round(number, 3)

 ![2022-03-14_13h43_40](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/2/22b27c3ae0ac8e06debe04b0253552aeabe60f94.png)

still it ignores ceros

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [March 14, 2022, 12:45pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/4 "2022-03-14T12:45:53Z")

</div>

I’m lost… which number isn’t displaying as you want, and where are you looking to display it?

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 12:46pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/5 "2022-03-14T12:46:29Z")

</div>

![2022-03-14_13h46_09](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/9/5905570bc968f5c536fc60f1b87f153801cca71a.png)  
thats from Revit schedule

it has 3 digits! 0.000 becomes 0

Final aim is to convert them to strings an at it to the name  
 ![2022-03-14_13h47_58](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/6/66333f8b222fdc703ea3787c9d6bd03579279be9.png)  
thats the units in Revit… Dynamo is doing it own stuff

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [March 14, 2022, 1:00pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/6 "2022-03-14T13:00:37Z")

</div>

String.FromObject after the three digit rounding should do the trick. You can then either add zeros via pad left, or take the Substring to stop at 3 digits last the decimal as needed.

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 1:21pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/7 "2022-03-14T13:21:14Z")

</div>

how to deal with +/- values i think i have to do some clever sorting if “-” do it in a other way

 ![2022-03-14_14h19_27](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/e/9e7931834171277c9998ad8743b78d15e9e0f540.png)  
 ![2022-03-14_14h20_13](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/d/3d41ec885a28d0891840c2df31b054c733585fa0.png)  
and length if it is \> 9

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [March 14, 2022, 1:36pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/8 "2022-03-14T13:36:41Z")

</div>

I would recommend getting the index of the “.”, and counting 3 digits after that.

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 1:42pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/9 "2022-03-14T13:42:54Z")

</div>

🙂 i got confused … i am in the list rollercoster

 ![2022-03-14_14h42_19](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/8/181899f6cf14ae446c0457713451799b2cebac5d.png)

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [March 14, 2022, 1:44pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/10 "2022-03-14T13:44:02Z")

</div>

This may help:

```auto
str;
indx = String.IndexOf(str,”.”);
frmtdStr = String.SubString(str, 0, indx+3);

```

Untested as I am not at my computer. If you’re still stuck when I get to it in ~30 minutes I’ll post a confirmed fix.

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 1:45pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/11 "2022-03-14T13:45:45Z")

</div>

That sounds good… minwhile i continue

---

<div class="post-metadata">

### Author: ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)
#### Post date: [March 14, 2022, 1:51pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/13 "2022-03-14T13:51:16Z")

</div>

Python would probably be quicker at this point. You can round and then set the number of trailing zeros with [this](https://stackoverflow.com/a/15238226) method.

```auto
nums = IN[0]
out = []

for num in nums:
    n = '{:.3f}'.format(round(num,2))
    out.append(n)
OUT = out

```

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 1:54pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/14 "2022-03-14T13:54:20Z")

</div>

![2022-03-14_14h53_06](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/3/c37a23de689f9896f2649435c6274b1c33a52330.png)

That would be almost the solution, but for any reson dynamo writes 3- insteat of -3,  
i think multiply strings is not the way

---

<div class="post-metadata">

### Author: ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)
#### Post date: [March 14, 2022, 1:57pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/15 "2022-03-14T13:57:25Z")

</div>

You’re multiplying by a negative so you’re getting the strings backwards. You would just get the first `x` substrings instead, starting at index 0.

---

<div class="post-metadata">

### Author: ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)
#### Post date: [March 14, 2022, 1:58pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/16 "2022-03-14T13:58:33Z")

</div>

![2022-03-14_14h58_07](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/f/5fa06e0c54a2581e963d6bf0182923c6b5189da0.png)  
thats it looks like Revit Schedule view

---

<div class="post-metadata">

### Author: ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)
#### Post date: [March 14, 2022, 2:45pm UTC](https://forum.dynamobim.com/t/how-get-i-the-correct-rounding/74317/17 "2022-03-14T14:45:41Z")

</div>

I sense a speed race!
