Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how make field result ceil-roundup

8 REPLIES 8
Reply
Message 1 of 9
2299934
571 Views, 8 Replies

how make field result ceil-roundup

I want the result of the field to be rounded up, but I have tried using some functions but have not been successful. I cannot find any information on the format processing of the field results in AutoCAD. I hope that AutoCAD experts can help solve this problem. Sincere thanks!

Labels (1)
8 REPLIES 8
Message 2 of 9
dbroad
in reply to: 2299934

Ceil is not an available function in fields.  

Try round((10+6+13+8+2)/24+0.5)

Adding the 0.5 makes the round function ino a ceil function.

See also https://www.cadforum.cz/en/qaID.asp?tip=6381

Architect, Registered NC, VA, SC, & GA.
Message 3 of 9
ChicagoLooper
in reply to: 2299934

Hello @2299934 

You do not need to use CEIL.

 

You need to control PRECISION. Like this:

Image-1Image-1

 

 

Image-2Image-2

 

Chicagolooper

EESignature

Message 4 of 9
2299934
in reply to: ChicagoLooper

Your method is rounding, if it is greater than or equal to 1.5, the result will be calculated as 2, and if it is less than 1.5, the result will be 1. And my expectation is to round up. When the number of decimal places is less than 0.5, such as 1.4, my expected method will calculate the result as "2". For example, "1.3" will also be rounded up to "2", for example, "1.2" will also be rounded up to "2", for example, "1.1" will also be rounded up to "2", and for example, "1.01" will also be rounded up to "2". I hope you can understand my requirements. Thank you

Message 5 of 9
dmfrazier
in reply to: 2299934

I assume your formula is meant to determine something like how many 24 unit lengths are needed to make the individual lengths you're adding up.

I was thinking maybe Diesel would work with the "fix" function, which truncates a real number to an integer by removing the fractional (decimal) part, as long as we add 1 before doing so.

dmfrazier_0-1714153566016.png

Of course, you will have to test this with your numbers...

 

(I'm afraid it will result in a number that is +1 too high when the result of the division is a whole number - has no fraction to truncate.)

Message 6 of 9
ChicagoLooper
in reply to: 2299934

Hi @2299934 

 

Do you run AutoCAD Map3? Or Civil3D? Or Arc Pro?

You can use CEIL in an expression when connected to DATA such as shapefile or Gdb.

 

Plain vanilla AutoCAD does not recognize the term CEIL when you put it in a Field.

 

If you want to work with Fields while using plain vanilla Cad, then try using ROUND instead. You can use ROUND with 0.4999999999.

Like this:

001.png

 

Chicagolooper

EESignature

Message 7 of 9
2299934
in reply to: ChicagoLooper

Hello! Let me explain to every experts again why this calculation is necessary. Please refer to the left “System-Drawing”. There is a network facility called "24 port network distribution frame", which is used to connect the network. It only has 24 interfaces. If there are more than 24 network cables connected, such as 25, then two 24 port distribution frames need to be installed on the cabinet. If there are only 24 network cables, then only one 24 port network distribution frame needs to be installed on the cabinet. Therefore, in the process of network engineering construction, it is necessary to count how many network cables are connected from the front end to the Network Room. If there are 39 network cables, 39/24=1.625=2, then "Two" 24 port network distribution frames are required.

If there are exactly 48 network cables, then 48/24 = 2 = 2, then "Two" 24 port network distribution frames are required.

If there are 49 network cables, 49/24 ≈ 2.04 = 3, then "Three" 24 port network distribution frames are required.

The above methods, round (X/24)+0.5) or+(0.49), cannot achieve this calculation effect, Only operation methods like the "Ceil" function can achieve such effects. However, unfortunately you told me that the "Fields" in AutoCAD do not support the operation of the ceil function. I hope the next version of AutoCAD can support the operation of the "ceil" function to solution this calculate situation

Message 8 of 9
dbroad
in reply to: 2299934


@2299934 wrote:

Your method is rounding, if it is greater than or equal to 1.5, the result will be calculated as 2, and if it is less than 1.5, the result will be 1. And my expectation is to round up. When the number of decimal places is less than 0.5, such as 1.4, my expected method will calculate the result as "2". For example, "1.3" will also be rounded up to "2", for example, "1.2" will also be rounded up to "2", for example, "1.1" will also be rounded up to "2", and for example, "1.01" will also be rounded up to "2". I hope you can understand my requirements. Thank you


@2299934 :If you are replying to me instead to @ChicagoLooper, please read my reply more closely.  I am not suggesting just rounding.  The CEIL (X) function, which you are aware of  but which isn't available in fields IS THE SAME AS ROUND (X+0.5) if your intent is to get an integer result.

 

To ensure we know who you are replying to, please  use the browser interface , hit the reply button in the post you are replying to and identify who you are  replying to in the message itself.

Architect, Registered NC, VA, SC, & GA.
Message 9 of 9
ChicagoLooper
in reply to: 2299934

Hi @2299934 

The image you uploaded in Post#1 indicates you are using COUNT to determine the number of distribution frames. You should use FORMULA instead. 

From uploaded image in Post #1.From uploaded image in Post #1.

 

You can get the number you want but you need to create a Formula with the ROUND function. You'll also need to include the '+' sign and the decimal number 0.499999999 to this formula.

 

Using your uploaded image in Post #7, you provide three (3) examples. Each example describes a different Front End. The number of Distribution Frames needed in each example depends on the number of Front End cables. Correct?

a) If 39 cables from front end....then you need 2 Distribution Frames 

b) If 48 cables from front end....then you need 2 Distribution Frames

c) If 49 cables from front end....then you need 3 Distribution Frames

 

Based on uploaded image in Post #7Based on uploaded image in Post #7

 

The FORMULAS for each individual condition would look like this:

a) (ROUND (10.0000+6.0000+13.0000+8.0000+2.0000)/24)+ 0.499999999 

b) (ROUND (10.0000+6.0000+13.0000+8.0000+11)/24)+ 0.499999999 

c) (ROUND (10.0000+6.0000+13.0000+8.0000+12)/24)+ 0.499999999 

 

 

Notes:

  • The results: (a) will return 2 Frames, (b) will also return 2 Frames, and (c) will return 3 Frames. 
  • You may use Count to determine the number of cables.
  • You need to use a Formula to determine the number of distribution frames.
  • The parts highlighted BLUE need to be ADDED to your formula.
  • In your example, all 3 formulas are the same with the exception of the RED highlighted values.

 

 

Chicagolooper

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report