cancel
Showing results for 
Search instead for 
Did you mean: 

Tool change in PB

Genius
Genius

Hi gents! 

 

I have two questions for mill PP:

 

 1.) How to set for a first tool change block 

T01 M67 

And for every subsequent tool change with M66 word.

 

2.) How can I set a specific block after every tool change, except after first tool change? For example G18 G54 is subsequent block after every tool change, except after first tool change.

6 REPLIES

Re: Tool change in PB

Phenom
Phenom

You don't say what version you are on - but with PB8 forward - there is a possibility of putting conditional code behind a block template. That way you can decide to use a template based on being the first tool change (or not.) Right click on the template - Output Condition - New will open a tcl window - in the code - return 1 will cause the block to be issued - return 0 will not be issued.

NX10.03
Windows 7 Pro

Re: Tool change in PB

Genius
Genius

Ok, thank you, but how can I control the condition 0 or 1.

Can/how I set "If then else" condition  in Tcl code window to control 1(0) for specific block?

 

What about word M66/M67 how can I set condition here?

Re: Tool change in PB

Phenom
Phenom

Every block template which is set up for specific purpose can have conditional code - you could have one set to output tool change with M67, one with M66 (which is not cleanest - but easiest way.) 

 

First tool change:

 

In conditional code behind a tool change block template:

 

...

 

global myTCflg

if {![info exists myTCflg]} {

  # do something for first tool

  return 1

  set myTCflg 1

} else {

  return 0

}

 

...

NX10.03
Windows 7 Pro

Re: Tool change in PB

Esteemed Contributor
Esteemed Contributor

I would set the flag before I return from the procedure, else the flag would never be set.

 

global myTCflg

if {![info exists myTCflg]} {

  # do something for first tool

  set myTCflg 1

  return 1

} else {

  return 0

}
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: Tool change in PB

Genius
Genius


OK, short summary- two subsequent tool change templates

T M66
and
T M67

in each of them i need to have output condition


global myTCflg
if {![info exists myTCflg]} {
# do something for first tool
set myTCflg 1
return 1
} else {
return 0
}


If this is the case, I have one more question, since I'm going to need M67 for tool change, and I already have M66 with the expression $mom_sys_tool_change_code, how I'm going to add this word M67 in terms of expression?

Re: Tool change in PB

Phenom
Phenom

Yes (as Stefan said) the order is important. Sometimes I will just MOM_do_template in the conditional code and return zero for that reason. There will be an error if there is no return - so every branch through needs one.

With the M66/67 - you could set the value of mom_sys_tool_change_code if you like (on the fly) but you can also just put a word out with the value of 66 or 67. It depends on whether you care about a modal word. If you set the value of mom_sys_tool_change_code - you wouldn't need 2 block templates. There are a lot of options - I am just mentioning some.

NX10.03
Windows 7 Pro

Learn online





Solution Information