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

81
Mach4 General Discussion / Re: M Codes in MDI
« on: May 27, 2016, 09:49:06 PM »
Evidently you can't use a screen element in a M code...

This works...

    inst = mc.mcGetInstance()
    val = '0.50000'
    gCode1 = 'G00 Z' .. val
    mc.mcCntlGcodeExecute(inst, gCode1)

This does not...

    inst = mc.mcGetInstance()
    val = scr.GetProperty('droTest1', 'Value')
    gCode1 = 'G00 Z' .. val
    mc.mcCntlGcodeExecute(inst, gCode1)

82
Mach4 General Discussion / Re: M Codes in MDI
« on: May 27, 2016, 07:13:54 PM »
Interesting....

If I remove this...

    local EndZ = scr.GetProperty('droEndZ', 'Value')
    local CodeLine1 = 'G00 Z' .. EndZ

and just do this...
    local CodeLine1 = 'G00 Z0.5'

It works. Yet when I look at what's getting passed to mc.mcCntlGcodeExecute, it is the same.  CodeLine1 is the same in both cases.

83
Mach4 General Discussion / Re: Stretching Images
« on: May 27, 2016, 07:02:33 PM »
You're my hero!  That works great.

84
Mach4 General Discussion / M Codes in MDI
« on: May 27, 2016, 05:29:25 PM »
I'm trying to test some M codes in MDI without much luck.  M codes that trigger outputs seem to work fine, but anything to create motion does not work.  See code below.  I tried all of the code execute functions with no luck.  The function is running because last error is updating correctly, just not getting an movement.  If I hit run in the editor, it runs fine.  If I step through the code it runs fine.  It does not work by typing M101 in MDI or by calling M101 in a Gcode file.  The file name is m101.mcs.  What could be wrong to make it run fine in the editor and fail in MDI and gcode?


Code: [Select]
function m101()
    ---------------------------------------------------------------------
    -- GoTo Safe Z
    ---------------------------------------------------------------------
    inst = mc.mcGetInstance()
    mc.mcCntlSetLastError(inst, 'Move to SafeZ')
    local SafeZ = scr.GetProperty('droSafeZ', 'Value')
    local CodeLine1 = 'G00 Z' .. SafeZ
    mc.mcCntlGcodeExecute(inst, CodeLine1)
    --mc.mcCntlMdiExecute(inst, CodeLine1)
    --mc.mcCntlGcodeExecuteWait(inst, CodeLine1)
end

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

85
Mach4 General Discussion / Re: Writing to machine.ini
« on: May 27, 2016, 02:47:33 PM »
I was thinking more along the lines of a way to do it all in the unload script.

86
Mach4 General Discussion / Re: Writing to machine.ini
« on: May 27, 2016, 12:42:25 PM »
So saving the state of a button can only be done in one of the buttons event scripts, correct?  There are plenty of outputs that will never be used.  I suppose I could tie the button to an output and get the state of the output on unload.  Are the outputs readable in an unload script?

87
Mach4 General Discussion / Re: Stretching Images
« on: May 27, 2016, 10:33:58 AM »
Static screen size doesn't really work because you never know what size screen a user will have.  The fact that it resizes is actually a nice feature...One I always wished M3 had...It just doesn't work when applied to images and image buttons.

88
Mach4 General Discussion / Re: Writing to machine.ini
« on: May 27, 2016, 09:50:38 AM »
So what I did is I put this code in the button Down Script...

inst = mc.mcGetInstance()
mc.mcProfileWriteString(inst, "Registers", "togCheck1", "1")

And this code in the Button Up script....

inst = mc.mcGetInstance()
mc.mcProfileWriteString(inst, "Registers", "togCheck1", "0")

And this works.  Must some sort of conflict with doing this in the unload script.  Maybe Mach is writing the ini file before the unload script runs.


89
Mach4 General Discussion / Re: Writing to machine.ini
« on: May 27, 2016, 09:19:25 AM »
I'm pretty much doing exactly what's in the scripting manual, but I changed the code to match the manual exactly and still nothing.  Is it possible that mc.mcProfileWriteString in the unload script is trying to write to the ini file while another process is writing to it?  Or will one wait fro the other to finish?

90
Mach4 General Discussion / Re: Stretching Images
« on: May 26, 2016, 11:52:41 PM »
I'm guessing there is not a way to lock images.  This is driving me nuts.  I'm trying to make a nice looking screen with images and image buttons, but it's impossible when the images distort when the screen size changes.