changing modes

More
27 Feb 2020 18:05 #158656 by blazedforever
changing modes was created by blazedforever
so i have some buttons on my custom screen that run mdi commands when pressed, then it stays in mdi mode. How can i switch it back to manual or auto after the movement so the jog buttons will work again.

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 18:23 #158661 by tommylight
Replied by tommylight on topic changing modes
I am pretty sure this was asked before, but am on the phone so can not help much.
Try to search google but add
Site:linuxcnc.org
After the search terms.

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 18:58 #158672 by COlger81
Replied by COlger81 on topic changing modes
Post your files and i can help you sort it out.

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 19:09 #158677 by blazedforever
Replied by blazedforever on topic changing modes
i've tried some searches on google and on here , cant seem to find a working answer. the closest i've got is adding this code to the handler file and calling it right after the mdi movement

self.command.mode( linuxcnc.MODE_MANUAL )
self.command.wait_complete()

but i just get tracebacks saying command is not valid

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 19:13 #158680 by COlger81
Replied by COlger81 on topic changing modes
Files?

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 19:49 #158685 by tommylight

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 19:54 #158686 by blazedforever
Replied by blazedforever on topic changing modes
not sure what files you want but heres the handler file and the error im getting when trying the above method found searching this forum
Attachments:

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 23:34 #158697 by cmorley
Replied by cmorley on topic changing modes
Change this:
    def on_mdi_command_finished(self, data=None):
       self.command.mode( linuxcnc.MODE_MANUAL )
       self.command.wait_complete() 

To This:
    def on_mdi_command_finished(self, data=None):
         self.emc.set_manual_mode()

an alternative:
    def on_mdi_command_finished(self, data=None):
       self.emc.emccommand.mode(self.emc.emc.MODE_MANUAL)
       self.emc.emccommand.wait_complete() 
The code looks weird because gscreen has the reference to linuxcnc command a couple layers deep.
If you import linuxcnc in the handler file, you could use the more familiar coding.

Chris

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 23:42 #158700 by cmorley
Replied by cmorley on topic changing modes
Also to facilitate faster help this info is helpful as a start:
What version of linuxcnc
What Screen or screen building toolkit you are using.
What you expected to happen
What actually happened.
An exact description of the error message.
the relevant config files - usually easiest to zip up all of them and post that - unless you are very sure where the error lies.
In this case the error message and the handler file was all the info that was needed,

gscreen takes some time to get the hang of and it is a little hard to follow where the answers are.
In the future QtVCP is an improvement.

Chris
The following user(s) said Thank You: blazedforever

Please Log in or Create an account to join the conversation.

More
27 Feb 2020 23:50 #158702 by cmorley
Replied by cmorley on topic changing modes
If you are wondering where I got this:
         self.emc.set_manual_mode()

You can look here for other functions
github.com/LinuxCNC/linuxcnc/blob/2.7/sr...een/emc_interface.py

Chris
The following user(s) said Thank You: blazedforever

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.146 seconds
Powered by Kunena Forum