Showing results for 
Search instead for 
Do you mean 
Solved! Go to solution

Python Parser - Defining Datatypes

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.



Kind Regards



Re: Python Parser - Defining Datatypes

Hi Alex,


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

Have you declared the variables in MCF/CCF file?




Re: Python Parser - Defining Datatypes

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?



Thanks so far


Accepted by topic author Smitti
2 weeks ago

Re: Python Parser - Defining Datatypes

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 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

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!


Learn online

Solution Information