Hello Guest it is April 16, 2024, 04:15:34 PM

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.


Messages - Cbyrdtopper

641
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 03:06:17 PM »
Brett,
I only put the 2nd wx.wx.messagebox in there to test with.  I will make it loop until the operator puts a number in there, I'm forcing them to set the current tool to the actual tool in turret rather than just assuming the operator will be sure to put the correct tool number in the DRO.  This code will run only on the start up. 

Speaking of running only 1 time.
I put this in the "First Run PLC Script."  It didn't crash and as far as I can tell it didn't alter anything else.  Is that okay?  Or is there a better way to make something run only on startup?   Open to any and all suggestions. 

Also, I thought we could use Global Variables (like "testcount" in PLC Script) everywhere, even in a macro.  It won't let me.

642
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 01:04:25 PM »
I'm not sure if this is the "correct" way to do this.  But it works for my proof of concept.

--What is the current tool?
function m110()

local inst = mc.mcGetInstance()
local ActualTool = wx.wxGetNumberFromUser("What tool is in the turret?", "Tool # ","Current Tool", 1, 1, 6) -- Default, Min, Max.
local rc = ActualTool
if rc == -1 then
wx.wxMessageBox("Set the current tool to the actual tool.")
else
mc.mcToolSetCurrent(inst, ActualTool)
end

end --m110

if (mc.mcInEditor() == 1) then
 m110()
end

643
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 12:02:46 PM »
Okay, So, I've found the Return Value I need.  But how do I get my syntax correct.  

local ActualTool, rc = wx.wxGetNumberFromUser()
if rc == -1 then
mc.mcCntlSetLastError(inst, "ERROR")
else
mc.mcToolSetCurrent(inst, ActualTool)
end

This isn't working correctly.  When I hit cancel, it puts a "-1" in my current tool and skips over the    if rc == -1
Obviously I have something wrong.  

If I just have rc =wx.wxGetNumberFromUser() everything works properly.  But I wold rather have the variable "Actual Tool" instead of just "rc"


644
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 11:53:20 AM »
Do you know what the Return Values are for this, I can't seem to find them?  If the operator hits "cancel" I want to Pop up the User Input Box again.

645
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 11:39:27 AM »
Excellent!
Works perfectly!  Since I'm using a number.  wx.wxGetNumberFromUser works great!

646
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 11:33:03 AM »
Okay.  Very nice.  I'll have to play with it and see what works well.
Just to let you know what I'm trying to accomplish:
On the lathe we are retrofitting, I want to prompt the operator on startup to enter the current tool in the turret.  Just in case Mach4 is shut down before retaining the current tool. 

647
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 10:00:31 AM »
So,  I've got another message box question.
Is there a way I can have a user type in a number in a message box, and then use that number to set an offset?

648
Thanks Bryanna.

649
Mach4 General Discussion / Re: Mach 4 Goto Zero
« on: February 08, 2018, 09:07:32 AM »
One really cool feature of Notepad++ is the fact that you can easily find your "end" from functions or "if" statements, this is useful if you have several nested features in a chunk of code. 

650
I will be watching this thread.  I tried to turn on the soft limits with an Initialize Code on startup.  It never worked properly.  It would turn the button Yellow, like I had pressed it, but it wouldn't actually turn the soft limits on.  Frustrating.

That would be a nice feature.  Have an option to have soft limits turn on as a default from the general config.