Hello Guest it is October 21, 2019, 06:44:24 AM

Author Topic: Rounding number in brains formula  (Read 4975 times)

0 Members and 1 Guest are viewing this topic.

Rounding number in brains formula
« on: December 20, 2010, 05:57:14 PM »
Can you round a number in a formula.  I need to round the output of a formula to zer decimal places.  IE 4.8973 needs to equal 5.  The VB script function Round() doesn't work.


Offline poppabear

  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Rounding number in brains formula
« Reply #1 on: December 22, 2010, 10:24:43 AM »
you would need to do a work around.
send the dec val to a UDRO, then in macropump, read in that udro, do a vb round on it, repost it to another udro
in brains read in that rounded udro val and do what ever.

Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
Re: Rounding number in brains formula
« Reply #2 on: March 12, 2016, 04:06:10 PM »
Just in case someone else in the future is looking for another solution to this.

I managed to round a value in brains using a formula someone had posted at stackoverflow.

The attached image is of an example rounding the spindle frequency in Hz.

I entered s500 in MDI in mach3, the formula I have then takes the spindle speed and divides by my motors RPM at 60Hz (1765), I then multiply by 60 to get the Hz number.