Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 02:09:12 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Mach Screens
| | |-+  Flash Screens
| | | |-+  How to round numbers
Pages: 1   Go Down
Print
Author Topic: How to round numbers  (Read 2781 times)
0 Members and 1 Guest are viewing this topic.
azambuja
Active Member

Offline Offline

Posts: 10


View Profile
« on: September 08, 2008, 12:44:07 PM »

Hello friends,

How can I make this transformation:

1.3333 to 1.33 Huh

I tried to use this code:

X=Round(GetDRO(0),2)
AB=Round(X*100)/100
Call SetOEMDRO(800,AB)

but the number I got  was 1.3300.
All that I wanted was 1.33.

Thanks for any support.
« Last Edit: September 08, 2008, 12:46:16 PM by azambuja » Logged
Chaoticone
South Carolina, US
Administrator
*
Offline Offline

Posts: 3,598


Precision Chaos



View Profile WWW
« Reply #1 on: September 08, 2008, 12:57:16 PM »

Can you format your dro/s to only display two decimal places and then when it pulls the value from that DRO will it only use what is seen?

Just thinking out loud.
Brett
Logged

Grin If you could see the things I have in my head, you would be laughing too. Grin
www.precisionchaos1.com
My guard dog is not what you need to worry about!
azambuja
Active Member

Offline Offline

Posts: 10


View Profile
« Reply #2 on: September 08, 2008, 01:01:29 PM »

How can I format my DRO's?
I do not know how to do it.
If you know how, hepl me.

thanks
Logged
Chaoticone
South Carolina, US
Administrator
*
Offline Offline

Posts: 3,598


Precision Chaos



View Profile WWW
« Reply #3 on: September 08, 2008, 01:03:26 PM »

If this is a flash screen your dealing with, I can't help you.

Brett
Logged

Grin If you could see the things I have in my head, you would be laughing too. Grin
www.precisionchaos1.com
My guard dog is not what you need to worry about!
azambuja
Active Member

Offline Offline

Posts: 10


View Profile
« Reply #4 on: September 08, 2008, 01:05:08 PM »

Yes, it is a flash screen.

And thanks again.
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #5 on: September 08, 2008, 01:54:02 PM »

Hi,
To format a DRO use:

Example will format DRO 104

Code:
fscommand( "DROFmt104", "%.0f")

To format to time based:

Example will format DRO 815 and 814

Code:
fscommand( "DROFmt815", "%D:%H:%M:%S")
fscommand( "DROFmt814", "%D:%H:%M:%S")

Thanks,
Jason Blake
« Last Edit: September 08, 2008, 02:01:34 PM by zealous » Logged

Regards, Jason Blake

www.Fusioncnc.com
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #6 on: September 08, 2008, 02:01:07 PM »

These are the formating parameters:

Days:Hours:Minutes:Seconds

Code:
"%D:%H:%M:%S"

(f)loating point number, (4) decimal points, (+) or -

Code:
"+%.4f"

integer, no decimals

Code:
"%i"

hex number

Code:
"%x"

Format to send the above:

fscommand( TYPE fmt DRO Number , ABOVE FORMAT )

Example:
fscommand ("DROFmt800" , "format" )
Logged

Regards, Jason Blake

www.Fusioncnc.com
azambuja
Active Member

Offline Offline

Posts: 10


View Profile
« Reply #7 on: September 08, 2008, 02:28:03 PM »

This was really helpfull.
Thanks a lot.

azambuja
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #8 on: September 11, 2008, 06:12:16 PM »

Great  Grin
Logged

Regards, Jason Blake

www.Fusioncnc.com
Chaoticone
South Carolina, US
Administrator
*
Offline Offline

Posts: 3,598


Precision Chaos



View Profile WWW
« Reply #9 on: September 11, 2008, 06:13:35 PM »

Thanks for helping Jason.  Smiley

Brett
Logged

Grin If you could see the things I have in my head, you would be laughing too. Grin
www.precisionchaos1.com
My guard dog is not what you need to worry about!
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!