How to load and run program in QtPyVCP
Now I need to do 2-d operation. I can build new program in my old (1-st operation) but there is so many o-words and o-calls.
I think it's better to make some new button to load another g-code and to run it, after finishing program - to load previous or default program.
I tried to use remapped M-code but I see that it's not run, I don't know why, I cloned it from previous program.
Please Log in or Create an account to join the conversation.
I've made such program I try to run it from MDIButton as remapped m-code.
But it doesn't run or run partly.
If I open this file as default g-code program, It works fine.
Attachments:
Please Log in or Create an account to join the conversation.
So i guess there is something different in MDI, auto or jog mode.
Usually i start now to trigger missing signal but i have no idea what i'm looking for. And after 20min reading of motion.c and homing.c i got big headache. So my road ends.
But i'am pretty sure we have to set one signal to simulate automode or somthing like that.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
So are you essentially trying to have a button that loads then runs a ngc prog? Treating that prog from the user’s point of view as a canned cycle. Ie. “ push button X and machine will do the Y series of operations”?
Yes, you are right about that.
Button that makes such macros:
1) loaf g-code program (.ngc)
2) run loaded g-code program (.ngc)
Currently in QtPyVCP is very easy to change working modes:But i'am pretty sure we have to set one signal to simulate automode or somthing like that.
- actionButton with sets: machine.mode.manual (auto, mdi), so on.
It's not working.
Other remaped M-codes are work fine.
I suspect that problem could be in setting "modalgroup=10" in .ini file when I remap m-code or some G-codes can't run in M-codes.
I think I have few methods to solve this problem but to make special button would be more beautiful.
Please Log in or Create an account to join the conversation.
there is the subcall button type that may be of use. But if the operation you want is material and you want to see it all happening in the plot like a proper loaded prog then automaitng load/mode/run will be likely be cleaner.
J.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I have a lot of buttons that use remapped M-codes, they are work fine in default mode (I don't know if it MDI mode, but auto mode is for sure).If you are using MDI_COMMAND then, yes, it only really works when MDI is valid. ie never in "Auto" mode (ie when G-code is running) And not always in "Manual" mode. I have a suspicion that this is annoyingly UI dependent.
... But if the operation you want is material and you want to see it all happening in the plot like a proper loaded prog then automating load/mode/run will be likely be cleaner.
Unfortunately I'm not good in python, but I hope that I have chance to solve this probrlem))
I need to study Python Interface to anderstand this.
But I didn't anderstand 2 things:
- how to use @Slot, can you show some example of using it?
- how to connect my "program" to the main program? It's enaugh using "import"?
Please Log in or Create an account to join the conversation.
your "program" is just an ngc file - yes?
If so I will see if I can find some time over the next couple of days to make a very quick example that you can look at. It should be super simple but these things are always easier to understand when looking at a simple working example than snippets posted without context.
Cheers - J.
Please Log in or Create an account to join the conversation.
The axis.ngc file in the archive needs to be in your: linuxcnc/nc_files directory.
Look at the mainwindow.py file.
The line:
self.btn_loadrun.clicked.connect(self.load_then_run)
is what makes he signal connection between the actionbutton named "btn_loadrun" and the method in this code file called "load_then_run".
import os
from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow
# Load in the methods needed to load and run a ngc prog
from qtpyvcp.actions.program_actions import load, run
from qtpyvcp.utilities.info import Info
# Setup logging
from qtpyvcp.utilities import logger
LOG = logger.getLogger('qtpyvcp.' + __name__)
class MyMainWindow(VCPMainWindow):
"""Main window class for the VCP."""
def __init__(self, *args, **kwargs):
super(MyMainWindow, self).__init__(*args, **kwargs)
# add custom signal connections here
self.btn_loadrun.clicked.connect(self.load_then_run)
# add any custom methods here
def load_then_run(self):
# now we load the prog
print "btn run and load clicked"
info = Info()
nc_files_dir = info.getProgramPrefix()
path = os.path.expanduser(nc_files_dir)
load(path + "/axis.ngc")
run()
Please Log in or Create an account to join the conversation.