Hello Guest it is April 26, 2024, 12:39:52 AM

Author Topic: Editing Function  (Read 894 times)

0 Members and 1 Guest are viewing this topic.

Offline cncmagic

*
  •  63 63
  • what me worry? heck...it ain't my machine anyway
    • View Profile
Editing Function
« on: August 22, 2023, 11:14:04 PM »
any way to modify the base coding on what the CycleStart() function will do? I'd like to have it check to make sure the axis' are homed prior to allowing a CycleStart and popup a messagebox indicating that they are not homed. The homing sequence is being done outside of Mach4 by a physical plc which activates an input being read by mach4.

If editing the call is not possible, how can I add a function that can be called by a button? available documentation does is not particularly an easy read. Any help pointing me in the appropriate direction appreciated.

and yes.. I seem to be able to muddle through LUA.. and I thought 'C' was bad..

Bob
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds

Offline cncmagic

*
  •  63 63
  • what me worry? heck...it ain't my machine anyway
    • View Profile
Re: Editing Function
« Reply #1 on: August 23, 2023, 07:25:06 AM »
found answer.. not too difficult.. a bit difficult to find.. 8)
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds
Re: Editing Function
« Reply #2 on: August 23, 2023, 02:15:52 PM »
Hi Bob,

Do you mind sharing what you found?

Offline cncmagic

*
  •  63 63
  • what me worry? heck...it ain't my machine anyway
    • View Profile
Re: Editing Function
« Reply #3 on: August 23, 2023, 03:54:06 PM »
wish there system wouldn't suddenly disconnect but what the heck.. makes life more fun  :-X

for the push button open the screen editor.. click on the pb or add a new one. In the properties window click on the box to the right of 'Left Up Script'. Click on the small button on the right of the text and that will open the script editor. Modify the code in the displayed editor ... save and then exit the editor. Close the screen editor by selecting Operator-Edit Screen and save the screen when prompted. Presto!! the button will execute whatever code you placed in the script. Now thats the more difficult part.. finding the correct functions, addresses, etc. that will allow you to do what you want to. Reviewing some of the other posts will help with syntax, etc.

for the actual functions being called such as CycleStart the process is similar.. open the screen editor.. click on the top of the displayed tree on the left (on my system its wx4).. at the top of the properties box you should see Screen Load Script.. click on the box to the right.. and now you should see the small button on the right.. click on this and there is the screen load script.. modify as required.. save.. close the script editor.. close the screen editor and save and Presto!!   ;D

word of advice.. you can modify things to a point where the system will crash and abort.. save your screen set and if necessary delete the screen set you modified and copy the original back..

Does that help?
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds

Offline cncmagic

*
  •  63 63
  • what me worry? heck...it ain't my machine anyway
    • View Profile
Re: Editing Function
« Reply #4 on: August 23, 2023, 04:05:57 PM »
I should note.. I am using Mach4, a SmoothStepper, and four(4) LS Servos and a small actual plc.. the servos have several built-in homing functions that are much better than trying to muck around and get Mach4 to try and duplicate. While the servos are in Step/Dir, the homing cycle is in velocity and allows for a torque limit as well.. so they will report being homed to the plc which in turn reports back to an ESS input when all three(3) axis have completed the homing process..  I modified the Ref All Axis to output a single Homing request to the plc and the plc in turn triggers the servos homing sequences. Once the homing sequence completes Mach4 sets all the internal reference home status and positions. I also modified the Cycle Start pb so that the machine won't start until all the axis' are homed. Just like a normal machine would do. ::)
any semblance of information posted to anything remotely  close to accuracy is merely coincidence. Use at you own discretion.. or play the lottery.. same odds