Main program is calling sub-program and variables defined in main program is used to evaluate IF line in sub-program.
When I simulate in NX11 value of the variable defined in main progogram is lost once simulation steps in to the sub-program.
Any idea what is required to pass the value of the variable from main program to sub-program?
can you say some words about which controller you use and which type of variables you mean. Also helpful would be to see some lines of NC Code.
I use OOTB sim08_mill_5ax_sinumeric_mm NX v11.0.2, with changed grafic folder content and defined axis to match produciton machine.
These are the lines of the main program:
DEF REAL AUTO_X=0.
DEF REAL AUTO_Y=0.
DEF REAL AUTO_Z=0.
N20 AUTO_X=-0.2 AUTO_Y=0.0 AUTO_Z=0.0
N50 G0 AX[_AU]=(-68.382) AX[_CW1]=DC(0.916) AX[_CW2]=DC(0.916)
N70 G0 X-458.582 Y26.171 Z252.011 ;G0 X-461.481 Y207.432 Z323.852
N80 X-456.426 Y-108.613 Z198.591
N90 TIEFE=11 SCHRITTE=1 VORSCH=3000 ;DEPTH, STEP, FEED RATE
N100 BOHREN ;DRILL
line N20 assisgns the value of the AUTO_X, AUTO_Y and AUTO_Z
THEN LINE N30 calls sub-prog LENCOMP_1_444
and here are the lines of that program:
DEF REAL MAXWERT=2.0
IF ((AUTO_X<MAXWERT*(-1)) OR (AUTO_X>MAXWERT))
MSG("KORREKTURMAS IN AUTO_X UEBERSCHRITTEN")
IF ((AUTO_Y<MAXWERT*(-1)) OR (AUTO_Y>MAXWERT))
MSG("KORREKTURMAS IN AUTO_Y UEBERSCHRITTEN")
IF ((AUTO_Z<MAXWERT*(-1)) OR (AUTO_Z>MAXWERT))
MSG("KORREKTURMAS IN AUTO_Z UEBERSCHRITTEN")
When stepping thru simulation line-by-line I can see variable values in Variable window and while in main program after reading line N20
but when simulation executes sub-program call varaible AUTO_X loses it's value.
then is not possible to continue running sub-program and evalaluate IF statement...
little bit more:
my NC main program is in same folder as CAM setup PRT file and sub-programs are in
I hope this gives you more info.
thanks for the detailed description and sorry for the late response.
Long story short... DEF REAL BLABLA variables are local defined variables and only usable in the program level where they are defined. The CSE behaves at this point as the real Sinumerik controller.
From what I know (there may be other ways)
- Use the "R" variables already available (R1, R2, etc.)
- you can define your own global variables (on the machine) (e.g. UGUD):
def nck real _MOOG_SPECIAL_VARIABLE
Then use these in your program & subroutine. (Assuming the machine builder doesn't lock you out of doing this)
There's more info on this in the Sinumerik Advanced Programming Guide.
EDIT: I'm not sure how to let IS&V know about your own custom global variables (assuming you can).
IS&V Should handle the "R" variables OK (I assume...)
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled
Examples I sent are from the machine. Production is running from Main program which is calling sub-prog's up to "4 levels" deep and all defined user varaiables are defined in main or further "deeper" in sub-progs and further calcualted and evaluated in any of the 4 levels and do not lose its value.
At the end of the main program run all varaibles have value as set and calculated in programs.
Once main program runs from the begining value is reset and new part is made based on values of the variables. If CMM report indicates that some machined feature require accuracy compensation then we change the value of required variable and next part will be in spec...
If what you replied is correct it is not same as machine.
Which way then I can simulate programs/sub-prog's with variables passing value as described above?
is there a place where I can define all variables?
Thanks for that input.
Where do I define user variables? In which file you would type that line in your example?
On the machine you set user variables in the UGUD.DEF file, make sure to do this when the machine is not used at all.
In addition it helps to restart the machine from scratch to get a clear situation, before and after that change.
For IS&V you use the ..._main.ini file in the cse_driver folder of the machine kit.
Also make sure to read about UGUD.DEF in the job planning PDF of the Sinumerik controller, for further clarification and information.
Production: NX10.0.3, VERICUT 8.1, 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
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide