- Posts: 19
- Thank you received: 0
Seeing values of gcode settings
3 years 5 months ago #270582
by diep
Seeing values of gcode settings was created by diep
Hello, the active gcodes in the active gcode tab - what do i type in the mdi window or where do i click with mouse to see the value displayed for example of G64 gcode that is active?
Kind Regards,
Vincent
Kind Regards,
Vincent
Please Log in to join the conversation.
3 years 5 months ago #271512
by andypugh
Replied by andypugh on topic Seeing values of gcode settings
I am not sure that there is a built-in way to see the G64 setting.
I have looked at increasingly hacky ways to find it (numbered and named parameters, HAL pins, Python status) and I don't see it mirrored anywhere.
The next step would be to start from the other end and see if the data gets put anywhere in the code, but it is going to be a long and winding journey an I don't have time right now:
github.com/LinuxCNC/linuxcnc/blob/master...erp_convert.cc#L2194
I have looked at increasingly hacky ways to find it (numbered and named parameters, HAL pins, Python status) and I don't see it mirrored anywhere.
The next step would be to start from the other end and see if the data gets put anywhere in the code, but it is going to be a long and winding journey an I don't have time right now:
github.com/LinuxCNC/linuxcnc/blob/master...erp_convert.cc#L2194
Please Log in to join the conversation.
3 years 5 months ago #271516
by Aciera
Replied by Aciera on topic Seeing values of gcode settings
Looks like the G64 settings can be found in the 'settings' attribute in the python interface:
linuxcnc.org/docs/master/html/config/python-interface.html
Not a 'point and click' solution I'm afraid.
linuxcnc.org/docs/master/html/config/python-interface.html
Attachment not found
Not a 'point and click' solution I'm afraid.
Please Log in to join the conversation.
3 years 5 months ago #271517
by andypugh
Replied by andypugh on topic Seeing values of gcode settings
And you can run Python in the MDI window (I think...)
I would be absolutely astonished if that actually worked, though.
Code:
(python, print(linuxcnc.status.settings[3])
I would be absolutely astonished if that actually worked, though.
Please Log in to join the conversation.
3 years 5 months ago #271518
by rodw
Replied by rodw on topic Seeing values of gcode settings
I thought Andy was right. But wait, there may be a shortcut. But it seems that the G64 P & Q Parameters are passed to the state tags structure
github.com/LinuxCNC/linuxcnc/blob/master...tion/state_tag.h#L96
and
github.com/LinuxCNC/linuxcnc/blob/master...ion/state_tag.h#L118
eg in fields_float[GM_FIELD_FLOAT_PATH_TOLERANCE]
Maybe Andy can tell you if that's accessible from the Python interface, otherwise you would need to add a pin for it in motion.c
github.com/LinuxCNC/linuxcnc/blob/master...motion/motion.c#L708
Good luck!
EDIT: Cross posted, heaps of options!
github.com/LinuxCNC/linuxcnc/blob/master...tion/state_tag.h#L96
and
github.com/LinuxCNC/linuxcnc/blob/master...ion/state_tag.h#L118
eg in fields_float[GM_FIELD_FLOAT_PATH_TOLERANCE]
Maybe Andy can tell you if that's accessible from the Python interface, otherwise you would need to add a pin for it in motion.c
github.com/LinuxCNC/linuxcnc/blob/master...motion/motion.c#L708
Good luck!
EDIT: Cross posted, heaps of options!
Please Log in to join the conversation.
3 years 5 months ago #271519
by rodw
Replied by rodw on topic Seeing values of gcode settings
So at a guess, the field_float array is copied ot the Python Settings array as the field order is the same
Very cool! Thank Andy for getting state tags into the code base
Very cool! Thank Andy for getting state tags into the code base
Please Log in to join the conversation.
3 years 5 months ago #271521
by Aciera
Replied by Aciera on topic Seeing values of gcode settings
The magic comment does not work.
'Nested comment found'
It seems that it does not like nested brackets in a comment.
'Nested comment found'
It seems that it does not like nested brackets in a comment.
Please Log in to join the conversation.
3 years 5 months ago #271525
by andypugh
Replied by andypugh on topic Seeing values of gcode settings
It seems to be
(py, python code)
or
;py, python code
It calls code here:
github.com/LinuxCNC/linuxcnc/blob/2.8/sr...python_plugin.cc#L67
And multi-line python code can (probably) be passed using "\n"L www.programiz.com/python-programming/methods/built-in/exec
Though if the OP wants to do this a lot, a custom M-code might be easier.
(py, python code)
or
;py, python code
It calls code here:
github.com/LinuxCNC/linuxcnc/blob/2.8/sr...python_plugin.cc#L67
And multi-line python code can (probably) be passed using "\n"L www.programiz.com/python-programming/methods/built-in/exec
Though if the OP wants to do this a lot, a custom M-code might be easier.
Please Log in to join the conversation.
3 years 5 months ago #271526
by phillc54
Replied by phillc54 on topic Seeing values of gcode settings
If LinuxCNC is started in a terminal the MDI python method does write to terminal but requires a few commands:
I don't know how to get it to appear in AXIS and I have not tried any other GUI's. I did attempt sending it to stderr but that didn't help.
Code:
;py,import linuxcnc
;py,s=linuxcnc.stat()
;py,s.poll()
;py,print(s.settings[3])
Code:
;py,sys.stderr.write(f"{s.settings[3]}\n")
Please Log in to join the conversation.
3 years 5 months ago #271529
by Aciera
Replied by Aciera on topic Seeing values of gcode settings
Thanks phil,
For output to axis add:
For output to axis add:
Code:
;py,import emccanon
;py,emccanon.MESSAGE(str(s.settings[3]))
Please Log in to join the conversation.
Time to create page: 0.148 seconds
