Cancel
Showing results for 
Search instead for 
Did you mean: 

Limiting output string length in Post builder

PLM World Member Creator PLM World Member Creator
PLM World Member Creator

Hello Post Experts.

 

I'd like to limit the number of characters of an output literal statment.  In my post I am using the following:

 

global mom_group_name

 

MOM_output_literal "$mom_group_name"

 

I'd like to limit the number of charaters in the"$mom_group_name" to 5 alpha nummeric characters.  So even if my group name in NX is O2222-modified, I only want to output O2222

 

Any thoughts?

 

Using NX9 and PB 9.0.2.0

 

Thanks

 

Jerry

2 REPLIES

Re: Limiting output string length in Post builder

Esteemed Contributor
Esteemed Contributor
MOM_output_literal [format "%.5s" $mom_group_name]

The above should truncate the output to five characters from the left.

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: NX12.0

How to Get the Most from Your Signature in the Community

Re: Limiting output string length in Post builder

Esteemed Contributor
Esteemed Contributor

Maybe something like this:

 

global mom_group_name
set out_string [string range $mom_group_name 0 4]
MOM_output_literal "$out_string"

 

You could also be more intelligent about it (checking for spaces/underscores, make sure it starts with the letter O followed by digits, etc.) 

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


Learn online





Solution Information