QtPVCP - Qt 5.9.5 - QLineEdit Issue - Work Around - Run From Line

More
19 Dec 2019 02:27 #152894 by Donb9261
Hello,

I don't know if this is a fluke on my system or not. But, I have been trying for days to get Run From Line to work.

From Big John: You should be able to set a VCPLineEdit and name it. Then in the Run From Line actionButton set the actionName to
program.run:#<someVcpLineEditName>. I did and regardless of how I tried all this does is pass #<someVcpLineEdit> as a string to the run action where run(star_line=0) should receive the value of the VcpLineEdit.

In any case, I found a work around if anyone else has the issue. I know tomorrow there will be an update to master with a right click context menu but it may not work for some of my designs so I came up with the following:

1) Create a VcpLineEdit and name it lineNumber (Still need to make sure only integers are allowed to be entered. Coming soon)

2) Drag a StatusLabel in and name it starting_line_number. Set your fonts in the stylesheet property

3) Drag in an ActionButton and name it run_from_here. Set the text property to Run From Line. Set the fonts in the stylesheet. Leave the actionName blank. It will be set on the fly.

Now, open your mainwindow.py file and make your file look like mine. You can exclude all code that does not pertain to this as I have other functions set up for other stuff. You can read my other posts to understand that aspect. Pretty cool.

from qtpyvcp.widgets.form_widgets.main_window import VCPMainWindow

# 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)
        self.rapidZero.clicked.connect(self.buttonRapidZero)
        self.rapidTwentyFive.clicked.connect(self.buttonRapidTwentyFive)
        self.rapidFifty.clicked.connect(self.buttonRapidFifty)
        self.rapidSeventyFive.clicked.connect(self.buttonRapidSeventyFive)
        self.rapidHundred.clicked.connect(self.buttonRapidHundred)

        ### Setup connection to VCPLineEdit
        self.lineNumber.returnPressed.connect(self.setStartingLineLabel)

        ### Connect run_from_here Btn to clear label after start
        self.run_from_here.clicked.connect(self.clearStartLineLabel)

# -------------------------------------------------------------------------
# BEGIN MAX VEL OVERRIDE Button Group UI Contoller
# -------------------------------------------------------------------------
    
    def buttonRapidZero(self):
        self.rapidZero.setChecked(True)
        self.rapidTwentyFive.setChecked(False)
        self.rapidFifty.setChecked(False)
        self.rapidSeventyFive.setChecked(False)
        self.rapidHundred.setChecked(False)

    def buttonRapidTwentyFive(self):
        self.rapidZero.setChecked(False)
        self.rapidTwentyFive.setChecked(True)
        self.rapidFifty.setChecked(False)
        self.rapidSeventyFive.setChecked(False)
        self.rapidHundred.setChecked(False)

    def buttonRapidFifty(self):
        self.rapidZero.setChecked(False)
        self.rapidTwentyFive.setChecked(False)
        self.rapidFifty.setChecked(True)
        self.rapidSeventyFive.setChecked(False)
        self.rapidHundred.setChecked(False)

    def buttonRapidSeventyFive(self):
        self.rapidZero.setChecked(False)
        self.rapidTwentyFive.setChecked(False)
        self.rapidFifty.setChecked(False)
        self.rapidSeventyFive.setChecked(True)
        self.rapidHundred.setChecked(False)

    def buttonRapidHundred(self):
        self.rapidZero.setChecked(False)
        self.rapidTwentyFive.setChecked(False)
        self.rapidFifty.setChecked(False)
        self.rapidSeventyFive.setChecked(False)
        self.rapidHundred.setChecked(True)

# -------------------------------------------------------------------------
# END MAX VEL OVERRIDE Button Group UI Contoller
# -------------------------------------------------------------------------

# -------------------------------------------------------------------------
# BEGIN RUN FROM HERE SETUP
# -------------------------------------------------------------------------

    def setStartingLineLabel(self):
        # Set variable to the VCPLineEdit Text Value
        line_number = self.lineNumber.text()
        # Set StatusLabel to alert where the program will start
        self.starting_line_number.setText('Ready To Start @ ' + line_number)
        # Set the actionName property of the Run From Line Btn
        self.run_from_here.setProperty('actionName', 'program.run:' + line_number)

    def clearStartLineLabel(self):
        self.starting_line_number.setText('')        

# -------------------------------------------------------------------------
# END RUN FROM HERE SETUP
# -------------------------------------------------------------------------

Here is what the code does.

It connects the label and VcpEdit.

def setStartingLineLabel(self):

Gets the value from the VcpLineEdit and stores it in a variable. Then it sets the StatusLabel to notify the user that the line number was read and matches the users desired target. Then it sets the actionName of the run_from_here button.

def clearStartLineLabel(self):

Resets the StatusLabel to empty once the Run From Line button is pressed.

When the button is pressed it now has the proper line number appended to the actionName like this program.run:int.

The program will then start from the entered line number.

I kinda like this method better because you have more control over when and what happens before the program starts. Also, feedback to let you know what you expect to happen will happen.

To use it, simply enter a line number in the text field and press enter. You will see the Status Label change to "Ready To Start @ (lineNumber). Then press Run From Line. Away you go. Easy Peasy!





If you have issues or concerns hit me back.

Don
Attachments:
The following user(s) said Thank You: KCJ, Leon82, hottabich

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

More
28 Dec 2019 09:08 #153360 by hottabich
Thanks, it works. and how would you react to this addition:
Sergey Sanych wrote (a):
That is, I stopped the machine, say, to clean the cutter - the chips were wound. He brought him out of the working area, did everything that was needed.
1stop the program
2 remember the location of the instrument
2.1 for such purposes, I usually use the command to remember the place where the program stopped
MDI_COMMAND = G28.1
3 cube food is convenient for me to clean or even replace the cutter
4 to return to the starting position such commands
MDI_COMMAND = G53G0X [# 5161]
MDI_COMMAND = G53G0Y [# 5162]
MDI_COMMAND = G53G0Z [# 5163]
Well, then run the program with the selected line, after turning on the spindle,
for convenience, drawing the appropriate buttons on the panel.

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

More
29 Dec 2019 02:43 #153391 by Donb9261
This idea is good but is too specific to a single concept and would be best suited for a custom application to which you could do rather simply. Although in many regards CNC controls have many flavors most follow a simple but predictable approach that helps standardize the operation. ie... RS274 GCODE. The reason being is that while OEM's may desire specific functionality, such functionality mat only be important to the OEM and the customers who buy them.

Long story short, I like the idea but it may be a bit edge for main line incorporation.

In the mean time,,, Добро пожаловать. Счастливого тебе нового года.
The following user(s) said Thank You: hottabich

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

More
29 Dec 2019 02:52 #153392 by Donb9261
After a few moments thought this is like the Fanuc option return from manual position. I wrote a macro that is now mainstream for Fanuc and is standard if asked for.

Basically, I put the machine in a specific mode that allows for Manual Handle Return. So, I place the program in feed hold with the option turned on. I switch to Handwheel mode and move to a position. Change inserts... whatever... But what happens in the background is the control, stores all modal codes and positions. Tool offset, work offset and last stored position. Once done you place back into Auto Mode and press cycle start. The Z axis will retract to safe position, XYABC will return to original positions and then the Z will feed to last known position with offsets intact and begin running from where the program left off.

This can be done but will be a challenge. And would be main line IMO.

Let me wrap my brain around how.

Don San
The following user(s) said Thank You: hottabich

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

More
02 Jan 2020 01:25 #153759 by BigJohnT
I've just run into this issue as well trying to run from line using a line edit, something extra is getting passed to program.run, I'll see what we can come up with to sort this out. I do know that the MDI widgets work in this manner #<somelineedit> is correctly applied.

JT

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

More
02 Jan 2020 15:04 #153797 by Donb9261
Yeah, it seems to only be when the runfromline is specified. All other uses work.

I tried to isolate the issue but for the life of me cannot so it must be deeper than a surface sweep of the machine_actions.py level.

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

More
06 Jan 2020 07:26 #154130 by hottabich

Thanks, it works. and how would you react to this addition:
Sergey Sanych wrote (a):
That is, I stopped the machine, say, to clean the cutter - the chips were wound. He brought him out of the working area, did everything that was needed.
1stop the program
2 remember the location of the instrument
2.1 for such purposes, I usually use the command to remember the place where the program stopped
MDI_COMMAND = G28.1
3 cube food is convenient for me to clean or even replace the cutter
4 to return to the starting position such commands
MDI_COMMAND = G53G0X [# 5161]
MDI_COMMAND = G53G0Y [# 5162]
MDI_COMMAND = G53G0Z [# 5163]
Well, then run the program with the selected line, after turning on the spindle,
for convenience, drawing the appropriate buttons on the panel.

Please help me create a subroutines return for the SubCallbButton button, if possible, I will be very grateful.

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

More
06 Jan 2020 23:13 #154182 by Donb9261
hottabich,

I will take a look at it soon. Fighting other issues currently. Sorry.

Don
The following user(s) said Thank You: hottabich

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

Moderators: KCJLcvette
Time to create page: 0.194 seconds
Powered by Kunena Forum