VERICUT Users' Forum

Due to relentless spammers, we are no longer automatically accepting new forum registrations. If you wish to register for this forum, please send an e-mail to: info@cgtech.com

You are not logged in.

#1 2020-11-18 23:48:01

epoirier
Member
Registered: 2014-06-05
Posts: 14

Current program number variable

Fanuc system variable #4115 is the current program number. Vericut does not track the program number correctly and I'm hoping there is a solution.

Variable 4115 is set in the O* Word/Address under G-Code Processing, so as subroutines and macro programs are called the variable is updated, just as it should be. The problem is variable 4115 is not being reset back to the previous/calling program number as the subroutines and macro programs end and return to the calling program.

For example, with a main program number of O0001, variable 4115 will be set to 1 at the start of the program. If subroutine O8000 is called in the main program (M98 P8000), variable 4115 will be changed to 8000 which is correct. However, when the M99 at the end of O8000 is executed and the control returns to program O0001, variable 4115 will remain set to 8000 when it should have been reset back to 1. This should be a function of the "ReturnFromSub" macro.

The call stack shows the chain of programs, and the subroutine at the deepest level is the current program and is what variable 4115 should be set to, so the information already exists and is being kept track of. Is there any way I can pull this data for use in setting variable 4115? Any other alternatives?

Thank you.

Offline

#2 2020-11-20 05:24:12

s_liam
Senior Member
From: Russia
Registered: 2008-12-15
Posts: 23

Re: Current program number variable

Hi.
Maybe exists an easy way. But you can do next.
When subroutine is called, you can save previous programm number to some variable (you should define some variable in def file of the control before), and before return you can restore this number for #4115 variable.
At the start of each sub program you should command
_your_variable = #4115
and before end sub program you could restore it
#4115 = _your_variable.

Offline

Board footer