cancel
Showing results for 
Search instead for 
Did you mean: 

Python Parser - Defining Datatypes

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hello everybody,

who can help me with this topic?

 

How do I define datatypes in the python parser for CSE Simulation?

The L-variable is already defined as STRING, before starting the simulation.

#-varibale is defined as a DOUBLE when read.

grafik.png

 

Kind Regards

Alex

4 REPLIES

Re: Python Parser - Defining Datatypes

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Alex,

 

which parser (Fanuc, Okuma, TNC, your own) is in use here? 

Have you declared the variables in MCF/CCF file?

 

Thanks

Thomas

Re: Python Parser - Defining Datatypes

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi Thomas,

 

thanks for the quick reply.

 

I used the Fanuc Parser as base file and added 'L' as VARNAME in the Lex file.

I didn't declared any variables in de MCF file.

 

When I add L38 to MCF file and choose DOUBLE its shown correct in the execution window.

But why is one variable already declared before starting the simulation.

How does NX determine the datatype for non declared variables?

grafik.png

 

Thanks so far

Alex

Re: Python Parser - Defining Datatypes

Siemens Phenom Siemens Phenom
Siemens Phenom
The answer is not the shortest...

if a variable is declared in MCF/CCF then this declaration wins against a possible declaration in Python (which is possible --> look at the #0 or #3100 in CSEFanuc.py file --> InitilizeChannel)

2.) There you will also see the function varManager.ActivateAutoDeclare(True) --> this function declares automatically a variable when it is used the first time ( which is used for the Fanuc Parser) with the default type DOUBLE

2.a. When a value is assigned to a variable (the first time) then this variable inherits the assigned type of the value (#1234="Hello" --> String)

hope that helps

Re: Python Parser - Defining Datatypes

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi Thomas,

 

weird things are happening.

After I deleted L38 from MCF it is getting correctly determined in python.

Besides that, both variables are now getting assigned at run time.

 

Tanks a bunch!

Alex

Learn online





Solution Information