A milling tool has been defined as a 5-parameter 0.375" diameter end mill with
a 0.090" corner radius. This looks good in NX, but when the
mom_tool_corner1_radius variable is output through the post, it returns a
value of 0.089999999999999997" and not the 0.090" as entered.
Solution
This discrepancy is due to the way floating point values are
stored/represented in a computer processor. Correctly formatting the variable
value in the post before output will restore it to the original number.
In a sample custom command placed as the last thing in the auto tool change
event, it would look like this:
===============================================================
global mom_tool_corner1_radius
set formatted_cr [format %.3f $mom_tool_corner1_radius]
MOM_output_literal " TOOL CORNER RAD: $mom_tool_corner1_radius"
MOM_output_literal " FORMATTED TOOL CORNER RAD: $formatted_cr"
===============================================================
The above post command returns these results in the output file:
%
N0010 G40 G17 G90 G70
N0020 G91 G28 Z0.0
N0030 T00 M06
N0040 TOOL CORNER RAD: 0.089999999999999997
N0050 FORMATTED TOOL CORNER RAD: 0.090
etc.
Notes