Seeing values of gcode settings
- diep
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
03 May 2023 18:45 #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 or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23162
- Thank you received: 4860
17 May 2023 08:30 #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 or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4001
- Thank you received: 1729
17 May 2023 09:06 - 17 May 2023 09:12 #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
Not a 'point and click' solution I'm afraid.
Attachments:
Last edit: 17 May 2023 09:12 by Aciera.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23162
- Thank you received: 4860
17 May 2023 09:15 #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.
(python, print(linuxcnc.status.settings[3])
I would be absolutely astonished if that actually worked, though.
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
Less
More
- Posts: 10780
- Thank you received: 3551
17 May 2023 09:27 - 17 May 2023 09:29 #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!
Last edit: 17 May 2023 09:29 by rodw.
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
Less
More
- Posts: 10780
- Thank you received: 3551
17 May 2023 09:33 #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 or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4001
- Thank you received: 1729
17 May 2023 09:47 - 17 May 2023 09:49 #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.
Last edit: 17 May 2023 09:49 by Aciera.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23162
- Thank you received: 4860
17 May 2023 10:19 #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 or Create an account to join the conversation.
- phillc54
- Offline
- Platinum Member
Less
More
- Posts: 5706
- Thank you received: 2084
17 May 2023 10:46 #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.
;py,import linuxcnc
;py,s=linuxcnc.stat()
;py,s.poll()
;py,print(s.settings[3])
;py,sys.stderr.write(f"{s.settings[3]}\n")
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4001
- Thank you received: 1729
17 May 2023 11:23 - 17 May 2023 11:29 #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:
;py,import emccanon
;py,emccanon.MESSAGE(str(s.settings[3]))
Last edit: 17 May 2023 11:29 by Aciera. Reason: use MESSAGE instead of CANON_ERROR
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
Time to create page: 0.199 seconds