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

Postbuilder - coordinates format (Zero and dots)

Good morning,

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


https://community.plm.automation.siemens.com/t5/forums/v3_1/forumtopicpage/board-id/open_forum/threa...


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

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
10 REPLIES
Solution
Solution
Accepted by topic author CamExplorer
‎03-09-2017 07:53 AM

Re: Postbuilder - coordinates format (Zero and dots)

[ Edited ]

"Y-8."

add to buffer on start some sign , for example  " ABCD"

set mom_o_buffer "$mom_o_buffer ABCD"

 

so every buffer is like " Y-8. ABCD"

and replace  ". ABCD" with  space " "

 

 

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

Re: Postbuilder - coordinates format (Zero and dots)

[ Edited ]

Thanks Juraj !! 

Now it works Smiley Happy  Code is perfect now . Thank You very much again .

 

21 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

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

Re: Postbuilder - coordinates format (Zero and dots)

heidenhain reads format like X0. etc

there is no need to remove dots

 

your proc also do:

 

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

- and this removes ".0" from cycles too and there will be problem....

cycle def 7.0 , cycle def 32.0 , cycle def 19.0 , etc...

 

If you want to be sure dont use such procedures

 

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

Re: Postbuilder - coordinates format (Zero and dots)

[ Edited ]

I know that , This post is not finished yet - It will be designed to only one specific machine in our workshop.

This CNC machine is an old one - driver is very specific - requires values with X0 , not X0. because our machine puts error and she wont run - so thats why I need to remove dots. This machine is the exception , very old TNC production , 3 axis mill.

 

cycle def 19.0 its no needed for her because this is 3 axis machine, same like plane spatial - no supported

cycle def 7.0 as a base point - its not supported in this model (we got error)

We define local base into preset board.

 

We have more machines - REST of our CNC is pretty new (equiped with iTNC530 , 5 axis mill) and for them we use different post-processors which were made long time ago with NORMAL format code.

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

Re: Postbuilder - coordinates format (Zero and dots)

It appears the "." at the end of the lines didn't get removed, due to a little shortcoming with the code provided early on.  Just add another statement as following:

 

 

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

 

   set mom_o_buffer [string trimright $mom_o_buffer .]

Re: Postbuilder - coordinates format (Zero and dots)

Just check if the block contains "cycle def", bail out:

global mom_o_buffer
if { [string match -nocase "*cycle def*" $mom_o_buffer] } { return }

Re: Postbuilder - coordinates format (Zero and dots)

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

 regsub -all {\. } $mom_o_buffer { } mom_o_buffer

Have a trailing "space" character

Line "G0 Y6.0" has no trailing space.

But as it is at the "end of line", you could change to something like this (not I have NOT tested these regular expressions, you might have to play a bit)

 regsub -all {\.0[ |$]} $mom_o_buffer { } mom_o_buffer

 regsub -all {\.[ |$]} $mom_o_buffer { } mom_o_buffer

i.e. test for a "space" or an "end of string"

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: Postbuilder - coordinates format (Zero and dots)

Today I had a discussion with another guy who told me that the TNC355 can be set to need this special format, which is different from the regular setup of the number format Heidenhain is shipping the controller.

I think this has been done to reduce the number of characters to type manually.

There should be a machine parameter that controls the numerical format, so may be it is easier to get rid of the restrictions inside of the controller instead of forcing the NC-code to be different from the rest of the Heidenhain controllers.

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: Postbuilder - coordinates format (Zero and dots)

Restriction will also reduce the memory consumption on controller, when it's limited.

Learn online





Solution Information