cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress trailing Zero when value is "0.0"?

Genius
Genius

Hello,

 

Since upgrading a post from NX7.5 to NX10.0.2 and NX10.0.3 when posting and we have a coordinate that is for example "Z0.0" in NX7.5 it would output "Z0. but now outputs "Z0.0"? Also if a value is "Z.5" I would like it to output "Z0.5" this has come about because when we take the program out of the machine it shows massive differences (although it isn't just adds trailing and leading Zero!)

 

I have tried multiple things and options with word formats?


Any help would be greatly appreciated.

Regards

Dave
NX10.0.3MP13
NX11.0.1
Production
TC10
Vericut 7.3,7.4.1,8.0.2
6 REPLIES

Re: Suppress trailing Zero when value is "0.0"?

Genius
Genius

if i understand :

set z .5
set z [format %.3f $z]
z => 0.500

set z 0.0
set z [format %.3g $z]
z => 0

 or

set z 0.0
set z [string trimright $z 0]
z => 0.
@mkn

Re: Suppress trailing Zero when value is "0.0"?

Esteemed Contributor
Esteemed Contributor

The definition of the zero format used by the coordinates is specifying the way a coordinate with value zero is output.

The leading zeros are also specified by the format of the coordinate.

Remember that formats are used by many different values, so if you need separate formats, you need to add custom formats.

First check the current definition in the DEF file of the word in question:00_PB_used_definitions.PNG

 

 

 

Then check the words definition in PB:01_PB_Word_Format.PNG

 

 

 

Change the settings for values other than zero:02_PB_Format_Coordinate.PNG

 

 

 

Change the format of the value zero:03_PB_Format_Zero.PNG

 

 

 

Now check if the output is what you need.

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: Suppress trailing Zero when value is "0.0"?

Genius
Genius

Hello @Stefan_Pendl

 

That worked perfectly for the Zero values which is perfect!

 

I just have the one question about outputting "0.5" instead of ".5" for values less than 1?

 

 

Regards

Dave
NX10.0.3MP13
NX11.0.1
Production
TC10
Vericut 7.3,7.4.1,8.0.2

Re: Suppress trailing Zero when value is "0.0"?

Esteemed Contributor
Esteemed Contributor

Enable "leading zeros" in the coordinate format and you will get leading zeros.

A bit of experimenting doesn't hurt, there is nothing you can damage.

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: Suppress trailing Zero when value is "0.0"?

Legend
Legend

This is how I have set my coordinates format.

It keeps 0 there even if the value is 0.5

And dont damage vlaues like 123.45

Snímka.JPG

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: Suppress trailing Zero when value is "0.0"?

Genius
Genius
Many thanks as always for taking the time to help out!

All sorted now!
Regards

Dave
NX10.0.3MP13
NX11.0.1
Production
TC10
Vericut 7.3,7.4.1,8.0.2

Learn online





Solution Information