Hello Guest it is March 29, 2024, 10:08:47 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.


Messages - Cbyrdtopper

631
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 10, 2018, 02:33:07 PM »
 This was allowing me to get text and numbers and use them.   Just not inside the repeat command.

 

632
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 10, 2018, 01:40:07 PM »
Daz,
Here is my entire macro.  The repeat command works, to test this I kept hitting cancel and it pops back up as expected. 

However, when I input a number, it acknowledges that number until it reads the "until" line, then the variable "ActualTool1" returns an ERROR instead of #.

--What is the actual tool?
function m110()
local inst = mc.mcGetInstance()

repeat
     local ActualTool1 = wx.wxGetNumberFromUser("What tool is in the turret?", "Tool # ","Current Tool", 1, 1, 6) -- Default, Min, Max.
until (ActualTool1 ~= -1)

mc.mcToolSetCurrent(inst, ActualTool1)

end --m110

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

633
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 10, 2018, 12:33:55 PM »
After testing the "Repeat" Command.  It isn't working as expected.  When I run through the code, it returns an ERROR when it reads "while actualtool ~=1"  After I input a number in the box, it reads that number just fine.  But as soon as the debugger gets on the "While" line, it returns an ERROR in the ActualTool Variable.

634
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 10, 2018, 10:34:09 AM »
Thanks for the info, Brett and Craig.
I've looked through that manual before.  I don't know why I didn't think to look for a "Repeat" command.  Couldn't see the forest for the trees I guess.
Craig,
I'm guessing Mach uses the 5.2 stuff then?

635
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 09, 2018, 04:26:02 PM »
Thanks Daz.  That's exactly what I was looking for.  I had no idea that command even existed!! :)

636
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 09, 2018, 10:00:56 AM »
So,
to make this loop, I was going to do something like this:

while rc == -1 do
local ActualTool = wx.wxGetNumberFromUser()
local rc = ActualTool
end

but it won't change the rc inside the loop.  I changed the variable name to Test and it returned an ERROR.   Why is that?

While writing this reply, I was testing the loop again.  It isn't even changing my variable ActualTool from the GetNumberFromUser. 

637
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 04:45:34 PM »
This is working great!
I went ahead and made it a function in the screen load script; just to tidy things up.  

I also put it on the 25th scan.  

if testcount == 25 then
SetActualTool()
end

It was popping up right as Mach4 was initializing, and it was hiding it behind Mach.  So, moved it to 25 and it pops up on the screen just fine, in about 1.5 seconds. 

638
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 03:34:25 PM »
Quote
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. 

I like calling them regionally global.  ;D

Brett, I like it! lol :)
I thought about making a function.  It would make it a little cleaner.  I'll give that a try next. 

639
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 03:12:40 PM »
Yes, but you asked also asked for a way to ask the user for a number for a 'position'.  Thought I would save someone in the future reading this thread some time so they don't try it for that.

Gotcha!   ;)

640
Mach4 General Discussion / Re: Message Box with Cancel?
« on: February 08, 2018, 03:07:46 PM »
Correct me if i'm wrong but wx.wxGetNumberFromUser() only works with integers. 

hth

rt

I'm using this to get the "Actual Tool" that is in the turret, so all I need is the integer. 
This box pops up, the operator looks at the turret sees that "Tool #" is the current tool, they type it in the message box and it updates the Current Tool DRO.