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?
Solved! Go to Solution.
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.
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:
I have added the C letter:
And in the CseTNC_Yacc.py, I have added:
def p_word_29(self, p):
'''word : AXIS AXIS'''
p = TNCWordInfo(p,p)
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"
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.
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.
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.
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?
I solved it. The name of the method is CSEPreprocessLine with the P uppercase, not lowercase.
Wow, what a headache!! until I discovered it.