rounding numbers up or down

rounding numbers up or down

jsweatherbie
Advocate Advocate
610 Views
5 Replies
Message 1 of 6

rounding numbers up or down

jsweatherbie
Advocate
Advocate

im not sure how to round a decimal number to a whole...... 
i have this macro to make feed and speeds and to apply it but the problem im having is that itll have a decimal and when i post it... it will error due to a decimal number with the rpm.

 

in the end im trying to make both feed and speed a whole number after it goes thru the formula.

//CREATED BY: JAMES 

REAL $drillRpm = 250/$tool.Diameter
EDIT RPM $drillRpm
RESET TOOLPATH FEEDRATE

REAL $drillIpm = '$drillRpm * 0.005'
EDIT FRATE '$drillIpm'

RESET TOOLPATH FEEDRATE
0 Likes
Accepted solutions (1)
611 Views
5 Replies
Replies (5)
Message 2 of 6

nguyenthinhvt95
Advocate
Advocate
Accepted solution

 

 

 

Try this:

//CREATED BY: JAMES 

INT $drillRpm = 250/$tool.Diameter
EDIT RPM $drillRpm
RESET TOOLPATH FEEDRATE

REAL $drillIpm = $drillRpm * 0.005
EDIT FRATE $drillIpm

RESET TOOLPATH FEEDRATE

 

 

 

0 Likes
Message 3 of 6

jsweatherbie
Advocate
Advocate
Nothing was changed ...
0 Likes
Message 4 of 6

jsweatherbie
Advocate
Advocate
Worked good
0 Likes
Message 5 of 6

icse
Advisor
Advisor

you can use the round() function:

 

icse_0-1721714297055.png

 

 

 

//CREATED BY: JAMES 

REAL $drillRpm = 250/$tool.Diameter
$drillRpm = round($drillRpm,0)
EDIT RPM ${drillRpm}
RESET TOOLPATH FEEDRATE

REAL $drillIpm = $drillRpm * 0.005
$drillIpm = round($drillIpm,0)
EDIT FRATE ${drillIpm}

RESET TOOLPATH FEEDRATE

 

 

 

0 Likes
Message 6 of 6

hrh46
Advocate
Advocate

I think its better to change format of "Feed" in the post processor to "Integer". 

then you always get round numbers.

0 Likes