Use Roundup function in code block

Hi everyone!
I want to divide a beam into 3 segments to arrange the stirrup by use the roundup function in the “Code Bock” but the error file expects to get the help of everyone
Thanks for help!

Hi,

Call up the round up node in Dynamo and hover over the top section of the node. The node will show you the syntax you need to perform the round up function within a code block.

I think that Math.Ceiling(value) is the function you are after.

thank you for an early reply!
I did this but did not get the round function from the code block! Please try help me!

Thanks JacobSmall for anser!
Can you explain in detail how to use Math.Ceiling(value)! Sorry I do not really know anything about it

Place a math.ceiling node and see how that works.l that way. After you like the result use the node to code function to see how it works in a code block.

It like like this image! and it is 1 or 2
This is dynamo file can you see if you free time can you fix help me!

Rebar beam stirrup.dyn (34.9 KB)

this is how the round up function works inside a code block.

MathRoundUp

Hope it helps!

Also, you can look up nodes here Dynamo dictionary

good luck!

1 Like

That is just the round function - round up would take a value of 5.3 and return 6.

1 Like

It is 1 not 2.

Input a value of 5.1 and it should return 6.

1 Like

yes, but it depends on the accuracy of the result in question.

1 Like

Yes it is a question of desired accuracy. However there are many times you wouldn’t want the number below or above to be used. So knowing the uses and methods for using the Math.Round node, the Math.Ceiling node, or the Math.Floor node is very valuable.

Math.Round works as usual rounding you learned in school. 5.4 returns 5. 5.5 returns 6.

Math.Ceiling always goes up to the next integer above. 5.4 returns 6. 5.5 returns 6.

Math.Floor always goes down to the previous integer below. 5.4 returns 5. 5.5 returns 5.

Math.Round is useful when you just want a whole number for basic math stuff. Generally speaking I avoid it as I either want the number above or the number below consistently, and if I’m working with real numbers I might as well use al those decimal points as the CPU can deal with it (usually).

Math.Ceiling is useful when doing stuff like occupancy counts (5.4 people means you have to get 6 people out of that space), or number of plywood panels needed (you can’t buy 5.4 panels after all - you need to buy 6), or any time when you need to work with whole parts to include the fraction.

Math.Floor is useful when doing bin packaging counts (if you have 5.4 units on this floor they can only sell 5), or figuring out how many parking spots can fit in that length of garage (5.4 means you can only fit 5 cars), or any other time when you can’t count the remainder.

3 Likes

Thanks so much Jacob
I have really understood about Math.Ceiling through the detailed explanation of the board!And I already know a good rounding node in the dynamo

Thank Renzoj14 for the help!
I have learned how to use Math.ceiling through your image!

1 Like

Please mark your post as solved if you have found the answer to your question :slight_smile:

Yes! i will mark now!