QtPyVCP - Single Block - halui.program.step {SOLVED}

More
05 Jan 2020 14:30 #154098 by Donb9261
I would like to have more control over how step works. Currently, you can install a button and apply program.step which will step one line at a time like most controllers. But, I would like it as a mode.

if single block... Then cycle start runs one line at a time... else execute whole program.

Maybe add a slot to program.step function that allows the bool from the cycle start to trigger the AUTO_STEP cmd???

halui.program.step pin is exposed in axis. Can it be exposed in QtPyVCP? Not sure how??? Maybe some insight. Once working I would do a run from line as step function to allow one to chose where to start single step from. Would that provide any help for my desire?

Only issue i see is not being able to turn off step while running. I suppose I could grab the running line where step stopped, then use my run from line routine to go to the line in auto mode without step and set feed hold. The cycle start would run the program normally. Kinda of how Fanuc does it in the background.

Currently my run from line routine(function) works great. Just need to know how or if possible to simulate the tandard single block functionality other controllers use as standard protocol. Odd that LCNC chose such a methodology and avoided the standard practice as it is the defacto standard. I believe there is an ISO for that in RS274 gcode standards. I can look it up.

Regardless, some expert input would be greatly appreciated.

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

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

More
05 Jan 2020 22:00 #154113 by BigJohnT
Something like that you would have to create in Python.

Looks at my Mill Touch V6 for tons of ideas.

github.com/jethornton/mill_touch_v6

JT

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

More
05 Jan 2020 22:19 #154115 by KCJ
I like the idea of having step as a mode and using the cycle start button to start each step.

I think it might be simpler than you are thinking to implement. Currently if you start a program running you can pause it and hit the program.step button to step, and if you press the program.run button it will run continuously from the the current line.

I think all you need to do is add a checkbox to select whether step mode is active, and then add a custom cycle start method in your mainwindow.py file. This method would check if the checkbox was checked, and if it was then call actions.program.step(), else actions.program.run() call.

If you want to be able to use a physical button connected thru HAL to trigger this method it would be easy to add a pin and connect it to the method.

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

More
06 Jan 2020 20:56 #154171 by Donb9261
Thanks guys,

Pointed me in the right direction. Here is what I came up with:

QPushButton - singleBlock - Set Checkable

Cycle Start = Obvious btn usage

STEP FROM LINE - Start the program from a specified line number in STEP MODE if . Cycle Start runs each block one at a time from the specified block. Sub Calls and M calls obviously do not step as LCNC from what I see limits you there. :( Uses the same def call but if's the SB button status.

RUN FROM LINE - Run the program normally from the specified line. Run from here button (UI) work around (see other post) waits for operator to press the button and then execution starts.

Cycle Start checks status of SB button and then sets program.step or program.run based on it's status. Works great. No bugs so far.

# -------------------------------------------------------------------------
# BEGIN RUN/STEP FROM HERE SETUP
# -------------------------------------------------------------------------

    ### If Single Block is active(Checked) then the program will start from
    ### the line specified in the lineNumber VCPLineEdit in STEP mode.
        ### NOTE *****The cycle start button works is used for STEP 
        ### WARNING *****If NOT STEP run_from_here WILL EXECUTE Program when pressed only
        ### RECOMMENDED *****Never executing full run inside a py program call. 
    ### ELSE it will set the run_from_here normal and wait for operator
    ### to press the button in the UI

    def setStartingLineLabel(self):
        sb = self.singleBlock.isChecked()
        if sb:
            print('Single Block Value: ' + str(sb))
            # Set variable to the VCPLineEdit Text Value
            line_number = self.lineNumber.text()
            # Set StatusLabel to alert where the program will start
            self.run_from_here.setText('RUN FROM LINE ' + line_number)
            # Set the actionName property of the Run From Line Btn
            self.run_from_here.setProperty('actionName', 'program.run:' + line_number)
            # Update the run_from_here checked status to notify when ready
            self.run_from_here.setChecked(True) 
            # OPTIONAL - Play a sound to alert when ready
            playsound('/home/don/Downloads/bvmtnf_ui-21.wav')
            # Cause the click event for the 'run_from_here' btn
            self.run_from_here.click()
            # Set Feed Hold
            pause() 
            # Clear Out the VCPLineEdit for lineNumber
            self.lineNumber.setText('')
        else:
            # Set variable to the VCPLineEdit Text Value
            line_number = self.lineNumber.text()
            # Set StatusLabel to alert where the program will start
            self.run_from_here.setText('RUN FROM LINE ' + line_number)
            # Set the actionName property of the Run From Line Btn
            self.run_from_here.setProperty('actionName', 'program.run:' + line_number)
            # Update the run_from_here checked status to notify when ready
            self.run_from_here.setChecked(True) 
            # OPTIONAL - Play a sound to alert when ready
            playsound('/home/don/Downloads/bvmtnf_ui-21.wav')
            # Clear Out the VCPLineEdit for lineNumber
            self.lineNumber.setText('')

    def clearStartLineLabel(self):
        # Clear out text set by prior call
        self.run_from_here.setText('RUN FROM LINE')
        # UnCHeck the btn
        self.run_from_here.setChecked(False)        

# -------------------------------------------------------------------------
# END RUN/STEP FROM HERE SETUP
# -------------------------------------------------------------------------

# -------------------------------------------------------------------------
# BEGIN CYCLE START FUNCTION
# -------------------------------------------------------------------------

    ### Works for normal run actions outside run from here

    def CycleStart(self):
        # Check Single Block Status
        sb = self.singleBlock.isChecked()
        if sb:
            # Start program in STEP
            step()
        else:
            # Start program in full run mode
            run()

# -------------------------------------------------------------------------
# END CYCLE START FUNCTION
# -------------------------------------------------------------------------

Init Connections:

        ### 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)
The following user(s) said Thank You: BigJohnT, KCJ, Leon82

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

More
08 Jan 2020 06:40 #154288 by KCJ
Very nice solution, thanks for following up!
The following user(s) said Thank You: Donb9261

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

More
08 Jan 2020 11:18 #154299 by Donb9261
That is how I roll. Once I got my head wrapped around it, easy peasy. Thanks for the boost.

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

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