cancel
Showing results for 
Search instead for 
Did you mean: 

New M command into a Heidenhain simulation gets parse error.

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Hello everybody,

 

I need to implement a new M command into a heidenhain CSE simulation.

Lets say M123, the problem is that the M123 must accept two parameters. For example

M123 A B

where A and B are the fourth and five axis leaders.

 

If I implement the command M123 without parameters, the simulation goes well, but if I try to implement the M123 command with two parameters the simulations gets "parse error after reading M123 A B".

 

Is there any way to implement that command into CSE without modifying the parser?

 

If I need to modify the parser, may you point me to a starting point to learn how to do it?

 

Regards

Frank.

9 REPLIES

Re: New M command into a Heidenhain simulation gets parse error.

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello,

 

short answer: For your case it is needed to update the parser.

Is that a standard TNC feature M123 A B ?

 

I will check if we can post a hint how to customize the python parser to do this in these forum.

 

 

Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Re: New M command into a Heidenhain simulation gets parse error.

Genius
Genius
Hello Tom

If i see this correct than it should be M138 "fourt_axis" "fifth_axis" which means that the Controller use another Kinematic Chain. For Example M138 A B --> Machine use both rotary axis on the head.
M138 A C -- Machine use a Axis on the head and the Table.
As i said this is only an example.

Heinrich

Re: New M command into a Heidenhain simulation gets parse error.

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

That's correct Heinrich,It is a command to change the kinematics form head-head to table-table and viceversa.

 

On the other hand.

Is there any documentation besides the one that comes with the NX11 help to learn how to modify the parser?

 

I'm trying to add the "M138 A B" command into CseTNC-Yacc.py but I only gets the values of A and B but not the string itself.

 

I have modified CseTNC_Lex.py, in the AXIS def:

def t_AXIS(t):
r'X|Y|Z|A|B|U|V|W'
return t

 

I have added the C letter:

def t_AXIS(t):
r'X|Y|Z|A|B|C|U|V|W'
return t

 

And in the CseTNC_Yacc.py, I have added:

def p_word_29(self, p):
'''word : AXIS AXIS'''
p[0] = TNCWordInfo(p[1],p[2])

 

When the simulation proccess "M138 A B" I only obtain the A and B values, not the string "A" and the string "B". If the nc file has the instruccion M138 A C, I get an error "Internal CSE error"

 

 

Frank

 

 

Re: New M command into a Heidenhain simulation gets parse error.

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Frank,

 

as Heinrich stated I like to double that the TNC parser will support M1238 axis1 axis2 .

My question now is:

Are you looking to a solution that M123 also should support that? Or was M123 only an example?

 

Your idea how you try to change in the python files goes in the wrong direction, don't do it this way !!!

 

I can add here a solution of the Python parser enhancement for the case M123 should behave the same way as M138, but like to get it clear first.

 

Please see for more information the NX Help. Search for python in the CAM area you will get details description as a starting point.

 

Thomas

 

Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Re: New M command into a Heidenhain simulation gets parse error.

Genius
Genius
Hi Frank,

The intention of this command is to change the machine kinematics.

You can do it in different way
First one is to do it in CSEpreprocessLine. where you can search the string M138 A B
if it is find in the Line then set
GV_strSwivelingChainName
GV_strMachineType
GV_dFourthAxisX
GV_dFourthAxisY
GV_dFourthAxisZ
....
all the variable the you need for the A B Configuration

Then do the same for "M138 B C" and "M138 A C"
After this you can set the line to an empty string so that the parser has nothing to do.



The better way to do this, is in the Methode which is called by the M138 command

You can do it with the ifcommand and isdefined(A) AND isdefined(B)
after this you have to define also the Variables as shown before.

regards
Heinrich

Re: New M command into a Heidenhain simulation gets parse error.

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Hi Thomas,

M123 is only an example, what I need is M138.

 

I have restored the parser at its original state, then I have changed the parser to treat M138 as a comment, only for avoid the parser error.

 

Regards

Frank.

 

 

Re: New M command into a Heidenhain simulation gets parse error.

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Thanks Heinrich for your answer.

 

I don't know how the CSEpreprocessLine works. Does this method have a parameter with the contents of the line? If so, I'm going to try it.

 

Regards

Frank.

Re: New M command into a Heidenhain simulation gets parse error.

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

In NX10, the method CSEpreprocessLine seems not work.

I have defined the method with an assert command and the method is not called.

How can I make the method work?

 

Regards

Frank.

Re: New M command into a Heidenhain simulation gets parse error.

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

I solved it. The name of the method is CSEPreprocessLine with the P uppercase, not lowercase.
Wow, what a headache!! until I discovered it.

Learn online





Solution Information