Hello Guest it is March 28, 2024, 02:32:31 PM

Author Topic: edit Cyclestop in screen  (Read 4847 times)

0 Members and 1 Guest are viewing this topic.

edit Cyclestop in screen
« on: April 18, 2019, 03:13:14 AM »
I would like to edit the cycle stop button  to have it lift the tool to machine zero and turn of the coolant
I go into screen edit and click on cycle stop and can get to a cyclestop macro but when I add what is needed there is does not seem to take effect 
what am I doing wrong
I have also tried editing the screenscript but this is marked as read only  so I am a but reluctant to edit it
Regards Ray
Re: edit Cyclestop in screen
« Reply #1 on: April 18, 2019, 06:13:57 AM »
Hi,
I think you may be mistaking the screen script with the .lua extension as opposed to the screen load script which
can be edited.

The screen script (with the .lua extension) is read only. All the Lua code of the GUI gets rolled into one large chunk
and it has the .lua extension. You can't edit it, you must edit those individual bits that make it up.

Open the screen editor, open the screen load script and find the cyclestop() function. That's what you need to edit.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: edit Cyclestop in screen
« Reply #2 on: April 18, 2019, 07:05:27 AM »
Hi  I think I am doing that I click on edit screen    then click on the cycle stop button and then the tab  that brings up the cyclestop script
the header is there but the functions has the -- in the front that shows them as a comment and not run I have been altering these and making the script active in there but it does not seem to work  and I am not sure why  I will not be back at the machine till Saturday and will try more things then
I do save it exit then program and restart as this is where the scripts are compiled but nothing I seem to do makes a difference
Regards Ray
Re: edit Cyclestop in screen
« Reply #3 on: April 18, 2019, 07:27:50 AM »
This is in screenscript.lua
---------------------------------------------------------------
function CycleStop()
    mc.mcCntlCycleStop(inst);
    mc.mcSpindleSetDirection(inst, 0);
    mc.mcCntlSetLastError(inst, "Cycle Stopped");
end
-----------------------------------------------------------
This is in a macro I saved in the profiles macro directory
CycleStop()
local inst = mc.mcGetInstance();
mc.mcCntlCycleStop(inst);
mc.mcSpindleSetDirection(inst, 0);
mc.mcCntlSetLastError("Cycle Stopped");
  mc.mcCntlGcodeExecuteWait(inst, "G90 G53 Z0") 

--if not idle loop
----mc.mcCntlMdiExecute ("G01 G53 Z0.000");

--ocal inst = mc.mcGetInstance()
---mc.mcCntlMdiExecute(inst, "G00 G53 Z1\nG00 X0 Y0 A0\nG00 Z0")
 a macro I have created for tool changing  in the macro directory works fine  but this does not seem to make ant difference
Regards Ray
Re: edit Cyclestop in screen
« Reply #4 on: April 18, 2019, 08:03:59 AM »
Hi,
well you need to edit the CycleStop() function. As I explained you cannot edit this script, it is screenscript.lua
and is read only.

You need to find CycleStop() in the screen load script and edit there to do as you require.

CycleStop is not a macro. You can write and save code there and is useful in that you can single step through the code
in debug mode to debug prior to installation in its final location....the screen load script.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: edit Cyclestop in screen
« Reply #5 on: April 18, 2019, 08:08:46 AM »
Hi,

To edit the screenload script, go to Operator>Edit Screen. Click the name of the screen at the very top of the screen tree manager. In the bottom, in the Properties section, click on the small Events tab (button with a little lightning bolt). The first item on that tab is the Screen Load Script. Click the button with '...' to open and edit that script. You can use Ctrl+F to search for the function you are looking for. As always, I recommend saving your screen with a unique name after changes are made, rather than altering the default screen set. To save your screen with a new name, go to Screen>Save Screen As.

Best wishes,
Bryanna
Newfangled Solutions Helpdesk: http://support.machsupport.com
YouTube Support Channel: https://www.youtube.com/c/MachSupportOfficial
Re: edit Cyclestop in screen
« Reply #6 on: April 18, 2019, 08:12:09 AM »
Hi,
CycleStop() is defined in the screen load script around line 183.

There are a few occasions where you will see a function called but be followed by what looks to be compliant
Gcode but all commented out. It is done simply to give you a glance at what you might  expect to find if you were to
dig through the screen load script for the real function definition. If you wish to change the behavior of the machine
you must dig up the one and only real function definition in the screen load script and edit it there to enact the behavior
that you want.

Craig
« Last Edit: April 18, 2019, 08:15:37 AM by joeaverage »
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: edit Cyclestop in screen
« Reply #7 on: April 18, 2019, 07:00:26 PM »
Hi
Thanks I do not think I would ever have found that without help  it is all logical once you have found out what the logic is
Regards Ray
Re: edit Cyclestop in screen
« Reply #8 on: April 18, 2019, 07:05:22 PM »
Hi,
logic is overrated.....my motto is go mad now and beat the rush. ;D

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: edit Cyclestop in screen
« Reply #9 on: April 22, 2019, 03:06:17 AM »
Hi
Well I have had a little play still can't get it to work but put cycle stop back to the unedited version when I noticed this in History  I have not read the history before
The first cyclestop error comes even before cyclestop is pressed
Any ideas ?

history.txt

Lua: Error while running chunk
?:0: attempt to call field 'CycleStop' (a nil value)
stack traceback:
   ?: in main chunk
   ?: in main chunk
Home switch Z Home tripped!Home switch Y Home tripped!Home switch X Home tripped!Home switch A Home tripped!Cycle StoppedLua: Error while running chunk
C:\Mach4Hobby\ScreenScript.lua:689: wxLua: Expected a 'string' or 'wxString' for parameter 2, but got a 'no value'.
Function called: 'mcCntlSetLastError(string)'
01. mcCntlSetLastError(number, string)
stack traceback:
   [C]: in function 'mcCntlSetLastError'
   C:\Mach4Hobby\ScreenScript.lua:689: in function <C:\Mach4Hobby\ScreenScript.lua:684>