cancel
Showing results for 
Search instead for 
Did you mean: 

CSE - variable declaration

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hello everybody,

 

is it possible to use a declared variable out of a sub program (.spf) in the main program (.mpf)?

 

I know I can use the R-parameters, but this would be a bad solution.

 

Best wishes from Hamburg

Viktor

2 REPLIES

Re: CSE - variable declaration

Siemens Phenom Siemens Phenom
Siemens Phenom

If the variable is declared inside the subprogram is will "removed/deleted" when return back to the main program, due to the fact that this is in another context.

 

In Sinumerik it is possible to call a subprogram with a parameter which can be changed inside the subrog and the result is still visible in the calling program. (Call by reference)

 

The related subprogram need to be declared at the start of the simulation with e.g.

EXTERN CallByRefSubprogram(VAR REAL)

 

 

Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Re: CSE - variable declaration

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hi Thomas,

 

it works. Thank you very much!

Learn online





Solution Information