Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Post builder coordinate format

How to format coordinates address without decimal point if there is no value after the decimal point-number is integer, for ex. X25 instead X25.

16 REPLIES

Re: Post builder coordinate format

Are you saying that you want to get rid of the decimal only certain times, or all the time?

 

if all the time you can use:

format %.8g 25.

 

to only get an integer.  However, the number after the "g" is the total number of digits though, not the decimal precision.

 

 

if you want to round to 4 places and then remove the decimal if it's still there you can use :

 

format %.8g [expr round(25.*10000)*.0001]

 

Jake Hardwick
CNC Programmer
Senior Aerospace AMT
Production NX8.5.3.3 Beta testing NX10.0.1.4

Re: Post builder coordinate format

I want to get rid of the decimal point if there is no value after it, not all the time.

 

For ex. Instead

 

N10 G94 G90 G20
N20 G50 X0.0 Z0.0
N30 T01 H01 M06
N40 G97 S500 M03
N50 G94 G00 X2.467 Z.567

 

I want

 

N10 G94 G90 G20
N20 G50 X0 Z0
N30 T01 H01 M06
N40 G97 S500 M03
N50 G94 G00 X2.467 Z.567

 

 

Since I'm newbie,where should I insert format  code.

Re: Post builder coordinate format

For the coordinates, you will have to change the ZERO_FORMAT entry in the DEF file from Zero_real to Zero_int to remove the trailing zero and the period.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Post builder coordinate format

I think you must insert format code in Motion commands, e.g. Linear Move, Rapid Move, Circular Move. Or anywhere you have coordinates output. You can create two different outputs depending on cases if there is fractional parts or not. At start you must create two different formats for all coordinate variables. One with decimal delimiter and other without it.  Later you must create "Output condition" by pressing right mouse button on blue frame of the commands and select "New". And in this condition you must program the if{} function block to check if decimal point is needed or not.

Re: Post builder coordinate format

 

@Stefan_Pendl 

For the coordinates, you will have to change the ZERO_FORMAT entry in the DEF file from Zero_real to Zero_int to remove the trailing zero and the period.

 

 

If I do this then all the values are integers,and that is not exactly what I want.

 

 

@alexanderBBB

You can create two different outputs depending on cases if there is fractional parts or not. At start you must create two different formats for all coordinate variables. One with decimal delimiter and other without it. 

 

 

How can I do that?

 

Thank you guys!

 

 

Re: Post builder coordinate format

I didn't tell you to change the entire format of the coordinate to integer, I told you to just change the format of the zero output.

 

Read my reply once more, more carefully.

 

You only need to change the DEF file in a text editor.

 

From

  ADDRESS Y 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         99999.999 Truncate
      MIN         -99999.999 Truncate
      LEADER      [$mom_sys_leader(Y)]
      ZERO_FORMAT Zero_real
  }

 

To

  ADDRESS Y 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         99999.999 Truncate
      MIN         -99999.999 Truncate
      LEADER      [$mom_sys_leader(Y)]
      ZERO_FORMAT Zero_int
  }

 

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Post builder coordinate format

You can also change the "zero_real" format (for all words) directly in PB:

NC Data definitions -> Format -> Scroll to the bottom -> Select "Zero_real" -> uncheck "output trailing zeros" and "output decimal point" (maybe also set the ".1" digits to ".0")

 

But this won't effect the "Z25.0" as that's not zero

 

You can also over-ride the proc "MOM_before_output", and parse/rebuild the variable mom_o_buffer. This would concentrate all the code into one place, at the expense (time/compute cycles) of having to parse EVERY line.

 

Probably easier if you use a word separator (e.g. space character) so you could use "split" to split theline up into individual words.

 

But however you do it, you will be having lots of "fun".

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Post builder coordinate format

I think we should check what the real problem is.

 

Is the control not understanding the position, if the period is present?

 

If this is just a cosmetic issue, because the machine operators are not used to have it this way, it is not a problem and there should be nothing changed to avoid bigger trouble.

 

The more parsing you do, the slower post processing will get.

 

Have you tried turning off the decimal point and the trailing zeros in the Coordinate format definition?

Does turning both off have a negative effect on values with decimal places?

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Post builder coordinate format

I was thinking you could just change the expression in the motion window.  Instead of using the default X-Coordinate, you can change it to X-User Defined.

 

Jake Hardwick
CNC Programmer
Senior Aerospace AMT
Production NX8.5.3.3 Beta testing NX10.0.1.4

Learn online





Solution Information