Hello Guest it is April 19, 2024, 11:03:31 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - TonyMemphis

Pages: 1
1
Mach4 General Discussion / Coroutine question/problem
« on: September 15, 2021, 05:58:31 PM »
 i double posted this by accident (over in the General mach forum)

First, what I am attempting to do is create a button that raises the router to what I call "safeZ" - just to get it out of the way to work on my workpiece or whatever.

I created a coroutine so the DRO would show the progress.  Now, after the GCode move is complete, I'd liek to do some other stuff.  But, after the move is complete, nothing happens!  I've tried all sorts of commands down there and nothing happens.  One thing I was trying to add was to disable the machine after the move.  If I add that down there, it disables before the move!

What I mean by down there is after the else where it says back to work coordinates.

So, basically I am trying to complete a move and keep the DRO live, then do other things like display the error message and perhaps disable the machine.

One more thing I noticed....in the function, message boxes are executed, but not the mach functions like mc.CntlSetLastError.

Thanks for any help!

Tony





Code: [Select]
--10FE20

--This script is to test using a coroutine so that when a Gcode
--is sent, the DRO's are updated live and the completion message doesn't
--show up until the move is complete
--another post on Mach4 suggested checking to see if the machine is indeed in the
--correct location before displaying the finished message in case something happened
-- to prevent it from getting there - not sure how to do that yet.

local inst = mc.mcGetInstance()
local val
local rc
local homed

--Change to machine coords
local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_MACHINE_CORD)
local sig = mc.mcSignalGetState(hsig)

if (sig == 0) then
mc.mcSignalSetState(hsig,1)
end


--check if Z is homed . if not - do nothing

homed , rc = mc.mcAxisIsHomed(inst,mc.Z_AXIS)

if homed == 1 then
SafeZ = coroutine.create(function()

mc.mcCntlGcodeExecute(inst, "G53 G1 Z-0.5 F25")
coroutine.yield()
val,rc = mc.mcAxisGetMachinePos(inst,mc.Z_AXIS)
    if val == -0.5000 then
--wx.wxMessageBox("Safe Z Finished")
mc.mcCntlSetLastError("Safe Z completed")
else
wx.wxMessageBox("Oops! - Didn't make it to -0.5'")
end
--wx.wxMessageBox("Safe Z Finished")
end)

else
wx.wxMessageBox("Move Cancelled - Z is not homed")
end

--back to work coords
mc.mcSignalSetState(hsig,0)
wx.wxMessageBox("Safe Z Finished")

2
Mach4 General Discussion / Jog Rate lost each shutdown
« on: July 29, 2021, 11:51:01 PM »
I asked about this a while back, but I don't think I got any replies.  Mach 4 doesn't save my current jog rate.  I can manually change it in the ini file and that works.  Am I doing something wrong?

Not a big deal, but just something I'd like to fix if possible. 

I am using the Avid screenset.  Mach 4.  Nothing unique. 

Thanks for the help.

Tony

3
Mach4 General Discussion / Default Jog Speed/Rate Value?
« on: September 17, 2020, 04:31:54 PM »
I'm using the Avid CNC setup on one of their Standard machines. 

I'd like to have the Jog rate set at around 35 or so as my default.  I have been searching all around trying to find how that is set.  I saw on the screen close script, there is a save to the Machine.ini file. But for some reason, that doesn't always save the current setting.  I manually changed the value in the ini file and that works, but if I change the rate on the screen, then close, it doesn't get saved.  Any ideas?  Thanks!

Tony

4
Mach4 General Discussion / Cycle Time Display
« on: May 18, 2020, 11:29:56 PM »
I'm using the Avid set...  There is a text box that displays the cycle time.  I managed to find the function in the PLC script that sets the value there if the machEnabled variable is 1.  My issue is that I want to see the cycle time when after the G code is complete, but the value is set to zero before I can see it.  The script only changes the value is the machine is enabled.  I can't figure out how the value gets changed back to zero?  The text box has an event set "On Update Script," but I'm not sure what that means and I can't find it mentioned anywhere. 

If I can figure this out, I may have a text box display the last cycle time and a double click event to clear it to zero or something like that. 

I wish there was some better documentation of this stuff.  I have searched and looked at the help file before I bothered asking.  I appreciate the help.

Any ideas? 

Tony

5
Mach4 General Discussion / Toggle Machine Coordinates from a script
« on: February 13, 2020, 01:06:10 PM »
Sorry to keep asking...the lack of documentation makes this stuff pretty frustrating.  I really appreciate your help!  Thank you!

So, I've been doing a lot of digging, but not found a solution.  I want to make sure I am in in Machine Coordinates modes and that the DRO's display machine coords before I start a procedure.  I can check the state using OSIG_MACHINE_CORD and that works.  But how to toggle the,m if they are on Work Coordinates?  Back to my VB days, I thought I'd just click the button but I read that is not a good method and I couldn't get it to work. 

In my playing, I found that the Machine Coordinates On action doesn't work?  Off works and Toggle works, but On doesn't.  Wasn't sure how to do that from the script anyway. 

Any ideas?  Do I need to change the signal?  Will that toggle the screen DRO's and button?  I haven't tried that sort of thing yet.

Tony

6
Mach4 General Discussion / How to determine enabled/disabled state?
« on: February 11, 2020, 12:15:49 PM »
Just wondering how I can determine if the Enable/Disable button is enabled?  For example, when I click a button that involves a move, I thought I might check and see if the enable button is down before I even try to move.  Maybe flash a message - "Hey dummy...."

I am new to this so I don't really understand how all the parts work, so thanks for your patience and effort to teach me.  I really appreciate it.  I do a lot of looking before I post, but I haven't had any success with what I was trying.  I read about GetState and it reports the state of the controller, but I wondered what that enable button really is doing?

I thought that the GetState request would tell me, but all I ever get is that the machine is idle, so I thought maybe I'm asking the wrong question? 

I tried this code this morning.  All I got was a state of 0 regardless of the state of the enable button.  That's when I thought hmmmm....

Code: [Select]
local mcState, rc = mc.mcCntlGetState(inst)
if (mcState == mc.MC_STATE_IDLE) then
msg="Machine is IDLE  "..mcState
else
msg="Machine is not idle  "..mcState
end

wx.wxMessageBox(msg)

Then reverted back to my VB days and wondering if I could just figure out the property of the button (up or down)?

Thanks for any help. 

Tony

7
Mach4 General Discussion / How do determine if Gcode move is complete?
« on: February 08, 2020, 11:08:56 PM »
I understand the Gcode execution options (I think).  If I use the wait option, nothing happens until its done but the DRO's are not 'live' during the move.  If I don't wait, then how can I determine if the move is done?  I want both - I want the DRO's to be live during the move and I want to know the move is done so I can flash a message upon completing the move. 

I found the IsStill inquiry, but I'm also read some posts that it may not be working.  In Mach3, it was easy. 

For example, I wrote a script that moves to G53 -0.5.  I use that in a button to get the router out of the way with one click so I can do whatever.  Its very handy.  I'd like to see the DRO change as it moves (just 'cause) and I'd like to flash a message when it gets there or play a sound.  Right now, the finished message is displayed while it is still moving.

Thanks!

Tony

8
Mach4 General Discussion / Playing a sound in a script?
« on: February 06, 2020, 10:21:35 PM »
I am trying to play a sound in a script.  I tried several examples that are all basically the same.  Nothing worked.  I get no errors when debugging or when I click the button I created.  I am using the Avid configuration if that makes any difference. 

Just wondering if I am missing something?  Just getting started with Mach4.

This is one of the things I tried:

local logoff = wx.wxSound('C:\\Mach4Hobby\\Sounds\\logoff.wav',0)

logoff:Play()

Thanks,

Tony

Pages: 1