Hello Guest it is March 28, 2024, 06:51:01 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 - rrc1962

41
Mach4 General Discussion / Re: Reading text box on screen
« on: April 11, 2017, 07:20:39 PM »
That was it.  The textbox now has a "Value" property.  As far as I can tell, the license is still good.  How can you tell if you're in demo mode?  I'm not running a machine, just developing.

42
Mach4 General Discussion / Re: Reading text box on screen
« on: April 11, 2017, 04:08:42 PM »
I'm on 2914.  Can I update without upsetting the license, screenset or directories I'm currently working on?  I know Mach 4 uses a different licensing scheme than Mach 3

43
Mach4 General Discussion / Re: Reading text box on screen
« on: April 11, 2017, 10:23:31 AM »
Quote
Have you tried that?

I have. Can get it and set it as expected here.

Code: [Select]
MyTest = scr.GetProperty("txtTest", "Value")
wx.wxMessageBox(MyTest)
scr.SetProperty("txtTest", "Value", "Test2")

Doesn't work on my end.  Maybe they exposed the value property in a later version.  What version are you running? 

Just so we're on the same page, we are talking about a textbox here, not a DRO.  If I place a textbox, I don't see a "Value" property associated with it.  If I place a DRO, I do see a "Value" property.


44
Mach4 General Discussion / Re: Reading text box on screen
« on: April 10, 2017, 11:30:40 PM »
Have you tried that?  The text box element does not have a "value" parameter.  DROs do, text boxes don't.  Makes one wonder why there would be a screen element that allows user input, but no way to read that input.

45
Mach4 General Discussion / Re: Reading text box on screen
« on: April 10, 2017, 07:58:01 PM »
Well, I found how to get input from the operator, which solves the problem at hand.  This function does it...

wxGetTextFromUser()

There is a file picker in the same group of function.  Might also give that a try.  I'd still like to find a way to read a text box though.

46
Mach4 General Discussion / Re: Reading text box on screen
« on: April 10, 2017, 05:26:51 PM »
On a similar note, is there such a thing as a user input dialog in Lua?  Or maybe a way to invoke the windows file dialog and capture the users input?

I think the problem with text boxes is that there is no "value" or "text" property.  How do you read the value of a text box?  Problem here is the operator needs to enter alpha numeric data and I need to read it back.  DRO's can only take numbers.

47
Mach4 General Discussion / Reading text box on screen
« on: April 10, 2017, 04:56:21 PM »
I'm having some diffiuclty with this.  I'm doing this numerous times with DRO's, but the text box seems to be an issue.  This is how I'm doing it with DRO's and it works great.  I figured the same approach would work with text boxes....

First, I save the text box value in the On Modify Script like this...

Code: [Select]
local inst = mc.mcGetInstance()
local val = scr.GetProperty("twFileName", "Value")
mc.mcProfileWriteString(inst, "PersistentDROs", "twFileName", string.format (val))

Then inside a Lua module, I try to read the value like this.  The code executes, but always returns "Error", which I'm assuming means that it's not finding the key value.

Code: [Select]
----------------------------------------------------------------
-- Get parameters
----------------------------------------------------------------
function getParam(key)
    local inst = mc.mcGetInstance()
    local theParam = mc.mcProfileGetString(inst,'PersistentDROs',key,'Error')
    return theParam
end
----------------------------------------------------------------
-- Display file name to dialog
----------------------------------------------------------------
function TW.ShowFileName()
    f = getParam('twFileName')
    wx.wxMessageBox(f)  
end

I can do this in a button event script as well, but I wasn't able to read the text box value there either.  Any idea what I'm doing wrong?  This works fine with DRO's.

Thanks

48
The external THC handles all Z motion, and lighting the torch.  All you need in M4 is an output to tell the THC to initiate the cut.  After the THC does it's thing and lights the torch, it sends a signal to M4 to move.  At the end of the cut, M4 needs to signal the THC to end the cut cycle.  THC will shut off the torch and retract to safe Z.  The THC then sends a signal to M4 to continue to the next cut...and the whole thing repeats.

Basically, you need a M code that triggers an output then loops while waiting for an input to go active.  I'd put a time limit on the loop so it the THC somehow fails, the M code will exit rather than locking up M4.  The output is to initiate the cut sequence and the input is the signal from the THC that it's OK to move.

At the end of the cut, either fire another output to end the cut sequence or just turn off the output you turned on to start the sequence.  Depends on how the THC handles those signals. After the THC turns off the torch and retracts, it should signal M4 to move to the next part.  To do this, you would use another loop in the "end sequence" M code waiting for that signal.


49
Mach4 General Discussion / Refreshing a module
« on: June 18, 2016, 09:39:18 PM »
It seems that when M4 loads, it compiles modules into memory.  When I make a change to a module, I have to shut down M4 and restart to see the change.  Is there something I can add or do that will refresh the module without restarting M4? 

Thanks

50
Mach4 General Discussion / Re: Huge feedrate error
« on: June 13, 2016, 09:07:21 AM »
Have you ever considered using the registry plugin (also can be persistent) and assign a register to your dro, this can then be retrieved from within the macro.

DazTheGas

Good idea.  I had not thought of that.  Could the feedrate also be set that way?  IE:  Assign the Feedrate DRO to a register and rather than posting 'F100' to mc.mcCntlGcodeExecuteWait(), just set the registry value assigned to the DRO.  Retrieving the feedrate value wasn't the problem.  Setting it was the issue.

I did get it working.  I knew the macro was running because is was setting last error.  I was just failing somewhere within.  I put message boxes after every line of code and ran it until the message boxes quit showing.  Turns out it was a case of a bad line of code.  The code looked fine and ran fine in the editor, just wouldn't run in real time.  I retyped what looked like an identical line and commented the first, and it ran fine.  This is the second time this has happened.