Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Post builder coordinate format

Genius
Genius

First of allI want to thank you all for your time and effort.

 

@Stefan_Pendl

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

 

I did exactly as you said, and here are the results (generic template).

 

N0010 G94 G90 G71

N0020 G92 X0 Z0

N0030 T01 H00 M06

N0040 G97 S2901 M03

N0050 G94 G00 X62.667 Z14.405

N0060 X54.866 Z.95

N0070 G96 S1000 M03

N0080 G95 G01 X53.666 F.7

N0090 X-1.2 F.5

N0100 X-2.4 F1.

N0110 G94 G00 Z3.95

N0120 X54.866

N0130 Z-1.267

N0140 G95 G01 X53.666 F.7

N0150 X-1.2

N0160 X-2.4 F1.

N0170 G94 G00 X62.667 Z14.405

N0180 G92 X0 Z0

N0190 T02 H02 M06

N0200 G94 X62.667 Z14.405

N0210 X0 Z1.733

N0220 G97 S0 M04

N0230 G95 G01 Z-4.267 F.3

N0240 G04 X1

N0250 Z1.733 F.5

N0260 G94 G00 X62.667 Z14.405

N0270 G92 X0 Z0

 

As you can see it works exactly as I would prefer when it comes about coordinates, but in feed address it doesn’t change anything regardless of my change. But there’s more, if I uncheck output leading zeros in N address, here’s what happens.

 

N10 G94 G90 G71

N20 G92 X0.0 Z0.0

N30 T01 H00 M06

N40 G97 S2901 M03

N50 G94 G00 X62.667 Z14.405

N60 X54.866 Z.95

N70 G96 S1000 M03

N80 G95 G01 X53.666 F.7

N90 X-1.2 F.5

N100 X-2.4 F1.

N110 G94 G00 Z3.95

N120 X54.866

N130 Z-1.267

N140 G95 G01 X53.666 F.7

N150 X-1.2

N160 X-2.4 F1.

N170 G94 G00 X62.667 Z14.405

N180 G92 X0.0 Z0.0

N190 T02 H02 M06

N200 G94 X62.667 Z14.405

N210 X0.0 Z1.733

N220 G97 S0 M04

N230 G95 G01 Z-4.267 F.3

N240 G04 X1

N250 Z1.733 F.5

N260 G94 G00 X62.667 Z14.405

N270 G92 X0.0 Z0.0

 

I'm back at the beginning again.

 

 

@Ken_A

 

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")

 

I can’t uncheck " output decimal point ", it gives me an error, if I check "output decimal point" and set  .1 too .0, here’s what I get (same program).

 

N0010 G94 G90 G71

N0020 G92 X. Z.

N0030 T01 H00 M06

N0040 G97 S2901 M03

 

 

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.

 

 

Please can you give little more detail insight for the procedure,also i can’t find in uttilities> browse MOM variables  "MOM_before_output", and parse/rebuild the variable mom_o_buffer.

 

 

@CAM_God_Rambo

 

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.

 

 

Have you tried, maybe it’s me because I can’t save that change.

Re: Post builder coordinate format

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

The problem is that the zero format is hard-coded in PB for coordinates, so you will have to apply this change on every save of the PP through PB.

 

Sorry that PB doesn't allow access to the zero format, so that the change is remembered.

 

You may succeed if you create a format of your own, by copying the regular Coordinate format.

I never had the need to change the coordinate format through PB, so I have no experience here.

I started with UGpost when there was no PB available.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide

Re: Post builder coordinate format

Siemens Legend Siemens Legend
Siemens Legend

If you are still wondering... Here's how you can do it with a little code in the PB_CMD_before_output. This custom command, when present in a post, gets executed automatically during posting. PB does not supply this command with the OOTB posts, since it would degrade the NX/Post performance. You can add this custom command as shown below:

 

#===============================================================================
proc PB_CMD_before_output { } {
#===============================================================================
# This command allows users to massage the NC code (mom_o_buffer) before
# it gets output.  If present in the post, this command is executed
# automatically by MOM_before_output.
#
# - DO NOT overload "MOM_before_output", all customization must be done here!
# - DO NOT call any MOM output commands here, it will become cyclical!
# - DO NOT attach this command to any event marker!
#
# ==> This command may be removed or renamed, if nothing to be processed here,
#     to improve post performance.

   global mom_o_buffer
   global mom_sys_leader
   global mom_sys_control_out mom_sys_control_in

# Remove "." without trailing "0".
regsub -all {\. } $mom_o_buffer { } mom_o_buffer

# Remove ".0"
regsub -all {\.0 } $mom_o_buffer { } mom_o_buffer
}

 

Notes:

  • You should have the Formats involved with Leading "0" turned on, or you may get Address output with nothing.
  • If you output comments (operator messages) in-line with real NC code, occurrences of ". " & ".0 " within comments will be replaced too, unless you add more elaborated logic in this command to take care of such situations.
  • (Critical) Example above only works when the NC code uses blank " " as the word separators. You would substitute the blank with any other symbol (or symbols) that has been used as the word separator.  More complex code will be needed to handle the case when no word separator has been used.

 

Re: Post builder coordinate format

Genius
Genius

Thank you very much Postino!

Re: Post builder coordinate format

Pioneer
Pioneer

How to write to the procedure turned example. From X.123 TO X0.123

Re: Post builder coordinate format

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Open the X word

See what format it uses (probably "Coordinate")

go to that format

"check" the box for output leading zeros

 

Note you might also want to look at the format "Zero_real" (so you get "0.0" and not ".0")

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


Re: Post builder coordinate format

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Good morning,

I know that this topic was already solved but I have to refresh this solution - about post coordinate output.

 

We have one old machine in workshop, heidenhain driver.

This machine need to have XYZ coordinates in code as below:

* cant be X.   It must be X0

* cant be X.5    It must be X0.5

* cant be X15.    it must be X15

 

X was an example axis , this rule applies to all axes (XYZ)

 

So i tried to make it as Postino shows with custom command , 

 

#=============================================================
proc PB_CMD_before_output { } {
#=============================================================

global mom_o_buffer
global mom_sys_leader
global mom_sys_control_out mom_sys_control_in

 

set buff $mom_o_buffer

 

# Remove trailing in-line comment
if 0 {
set i_at [string first "$mom_sys_control_out" $buff]
if { $i_at > -1 } {
set buff [string trimright [string range $buff 0 [expr $i_at - 1]]]
}
}

# Process to avoid output of block buffer without any useful address
regsub -all {[0-9]+} $buff "" buff
regsub -all {L} $buff "" buff
regsub -all {F} $buff "" buff
regsub -all {MAX} $buff "" buff

regsub -all { } $buff "" buff

 

# Zero and DOT coordinate format
regsub -all {\.0 } $mom_o_buffer { } mom_o_buffer
regsub -all {\. } $mom_o_buffer { } mom_o_buffer

 

set buff [join $buff ""]
set l [string length $buff]
if { $l == 0 } {
set mom_o_buffer ""
}
}

 

After generating i receives output   (I underline in code correct BUFFED values) :

 

 L M126
22 L X4 Y-22.392 Z42.5 FMAX
23 L Z31.5 FMAX
24 L Y+0 Z25.5 F250.
25 L Y61.006
26 CC X+0 Y61.
27 C X-4 Y61.006 DR+
28 L Y-61.006
29 CC X+0 Y-61.
30 C X4 Y-61.006 DR+
31 L Y-6.14
32 CC X8 Y-6.141
33 C X5.78 Y-2.813 DR-
34 L X14.22 Y2.813
35 CC X12 Y6.141
36 C X16 Y6.139 DR+
37 L Y69.008
38 CC X8 Y69.
39 C X8.008 Y77 DR+
40 L X-8.008
41 CC X-8 Y69.
42 C X-16 Y69.008 DR+
43 L Y-69.008
44 CC X-8 Y-69.
45 C X-8.008 Y-77 DR+
46 L X8.008
47 CC X8 Y-69.
48 C X16 Y-69.008 DR+
49 L Y8.
50 L X27.
51 L Z28.5
52 L Z42.5 FMAX

 

I am wondering why this works randomly , X format looks ok in 80%  , but many Y have not BUFFED format and still i gets for example  Y-69. (with dot) as You can see in output code. How can I get around it ? Trying to set my own formats in PB still same result...

 

Many times I used REGSUB command in my postprocessor (cmd_before) - it always worked .

 

Best regards, Jacob

 

========================================
Engineering >> NX10.0 Performance in the making

Re: Post builder coordinate format

Siemens Legend Siemens Legend
Siemens Legend

Jacob,

 

Just stumble back into this; not sure if this thing still alive... There's a flaw in the code fragment below:

 

# Zero and DOT coordinate format
regsub -all {\.0 } $mom_o_buffer { } mom_o_buffer
regsub -all {\. } $mom_o_buffer { } mom_o_buffer

 

The code would not see the words at the end of a block that need to be replaced, since they are not followed by a blank " ".  I will improve the logic as below:

 

# Split up the block by the blank into a list of separate tokens

set w_list [split $mom_o_buffer " "]

 

# Replace the condition for each token

set idx 0

foreach w $w_list {

   regsub -all {\.0} $w {} w
   regsub -all {\.} $w {} w

   set w_list [lreplace $w_list $idx $idx $w]

   incr idx

}

 

# Join tokens back together with a blank

set mom_o_buffer [join $w_list " "]

 

 

Re: Post builder coordinate format

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi,

 

thank you all for your support. I've tried the last solution but it doesn't work adequate, because all "." and ".0" were deleted. I appended blanks and deleted them later in the "foreach"-loop as follows:

 

# Replace the condition for each token
    set idx 0
    foreach w $w_list {
        append w { }
        regsub -all {\.0 } $w {} w
        regsub -all {\. } $w {} w
        regsub -all { } $w {} w
        set w_list [lreplace $w_list $idx $idx $w]
        incr idx
        }

 

I tested it currently for TNC G-Code. It seems to be fine. Blanks in operator messages were written correctly, only "." and ".0" at the end were deleted. Now I'm surching for a solution for "CYCL DEF xx.0".

 

Thanks for help,

JoeP

 

Re: Post builder coordinate format

Phenom
Phenom

you have misinterpreted these lines.In the example there is not spaces, you have write {\.0 }  {\. } and you should write {\.0} {\.} .it's better to write in square brackets like this : {[.0]} this can avoid mistakes like this

 

Production: NX11.0.2.7,VERICUT 8.1.2
Development: Tcl/Tk, Gnuplot
www.adgroupe.com

Learn online





Solution Information