Hello Guest it is October 03, 2023, 05:17:32 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 - rhtuttle

391
Mach4 General Discussion / m3 gets special treatment?
« on: November 19, 2017, 06:21:05 PM »
Here is the code for two macros, identical except one is the  m3.mcs file and the other is m300.mcs file code

If the 'm3 s500' is called from the mdi hParam == nil, if the 'm300 s500' is called from the mdi hParam ~= nil.
Does m3 get stripped of it's parameters?  If so why and how do you capture the requested s value?

function m3(hParam)
   if (hParam ~= nil) then
      wx.wxMessageBox('hParam~=nil')
   else
      wx.wxMessageBox('hParam==nil')
   end   

end

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

function m300(hParam)
   if (hParam ~= nil) then
      wx.wxMessageBox('hParam~=nil')
   else
      wx.wxMessageBox('hParam==nil')
   end   

end

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


tia

RT

392
Mach4 General Discussion / Actual Spindle Speed DRO delay
« on: November 13, 2017, 01:46:40 PM »
Running PMDX 411 and Gecko G540 on build 3481 on a lathe.

I have a cheap opto sensor on my spindle that works very well reporting the actual spindle speed as verified with a tach.

I noticed that when I issue a M5 that the Dro that shows the actual speed does not return to zero for about 3-5 seconds from the time that the spindle actually stops spinning.

Does anyone know if this is due to the opto, PMDX or Mach4 not updating?

I was using this DRO value to check to see if the spindle had overloaded and stopped and it was not disabling movement promptly.

Is there a better way to handle this? (I am electronically challenged so hopefully I don't have to create some citrcuit ;D)

TIA

RT

393
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: November 11, 2017, 05:53:58 PM »
Daz, works a charm!

They may have been in the other one but I have never seen a list of all the codes listed anywhere.

Thanks!

RT

394
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: November 10, 2017, 05:51:42 PM »
Daz,

Everyone always something more. ;D

In Lee's mach3 plugin the thumb sticks had another capability by depressing them straight down.  Would it be possible to expose that as a button click in your next release of the  plugin?

RT

395
Mach4 General Discussion / Re: Check if Enabled
« on: November 10, 2017, 05:47:12 PM »
Thank you Daz.

I need to be more diligent.  I looked at the signals and must have scanned too fast because I missed it.  They're not alphabetical.

TYOGO

RT

396
Mach4 General Discussion / Check if Enabled
« on: November 10, 2017, 03:28:24 PM »
What is the proper script language to check if Mach4 is currently enabled?

TIA

RT

397
Mach4 Plugins / Re: Check if is enabled
« on: November 10, 2017, 03:27:21 PM »
Disregard, posted in wrong forum.  Don't know how to delete from here.

398
Mach4 Plugins / Check if is enabled
« on: November 10, 2017, 01:49:07 PM »
What is the proper script language to check if Mach4 is currently enabled?

399
Mach4 General Discussion / Re: DRO behavior
« on: November 09, 2017, 07:50:37 PM »
I am not at this stage trying to jog anything.  I am trying to get the jog increment changed programatically so that later I can use a xBox to change it and have the xBox and the keyboard have the same increments all the time.  Every time I change the increment I play a wav file that tells me what increment I have selected.  Since my Lua panel code was unsuccessful I just added a button to refine the tests.

Attached are two pics, one of the dro with dro code set to Current Jog Incr. and the button with code below.  If you open the register diagnostic window and pin it like the second photo you can see the registers change.

Here is the button script


Code: [Select]
        local NewInc=0
        local i=0
        local mInst=mc.mcGetInstance()
        local CurInc = mc.mcProfileGetInt(mInst,"Preferences","JogIncSet",0) --Get the previously saved setting in profile to hold our current inc number
        local SetInc = mc.mcProfileGetDouble(mInst,"Preferences","JogInc",0.00) -- fetch our inc value from the profile JogInc + 2 say = [Preferences][JogInc2]
        --check to see if the JogInc exists
        for i = 1 , 10 ,1 do
          if SetInc == mc.mcProfileGetDouble(mInst,"Preferences","JogInc"..tostring(i),0.00)then
            mc.mcCntlSetLastError(mInst,"Matched "..tostring(SetInc).." - "..tostring(i))
            NewInc=i
          end
        end
        --did we find a match
        if NewInc==0 then
          mc.mcCntlSetLastError(mInst,"current setting does not match")
        end
        --choose the next increment
        if NewInc==10 then
          NewInc=1
        else
          NewInc=NewInc+1
        end
        CurInc=NewInc
        SetInc = mc.mcProfileGetDouble(mInst,"Preferences","JogInc"..tostring(CurInc),0.00)
        --this is where I assumed it would be the same as typing a new value in but it isn't
        scr.SetProperty('droJogInc',"Value",tostring(SetInc))  --set the dro to the distance to jog

       --save the profile updated information
        mc.mcProfileWriteInt(mInst,"Preferences","JogIncSet",CurInc) --set our profile to new CurInc         
        mc.mcProfileWriteDouble(mInst,"Preferences","JogInc",SetInc) --set our profile to new SetInc
        --[[assumed the above would change the registers but it doesn't so do it, this was commented out to test
            whether the button code changed the registers but it didn't while a manual entry of a jog increment key press did
            same as Scott's for i,0,5 example
       --]]
        mc.mcJogSetInc(mInst, mc.X_AXIS, SetInc) -- set inc for axis
        mc.mcJogSetInc(mInst, mc.Y_AXIS, SetInc) -- set inc for axis
        mc.mcJogSetInc(mInst, mc.Z_AXIS, SetInc) -- set inc for axis
        mc.mcJogSetInc(mInst, mc.A_AXIS, SetInc) -- set inc for axis
        mc.mcJogSetInc(mInst, mc.B_AXIS, SetInc) -- set inc for axis
        mc.mcJogSetInc(mInst, mc.C_AXIS, SetInc) -- set inc for axis     

        mc.mcProfileFlush(mInst)
        mc.mcProfileReload(mInst)
    --    local s=tostring(CurInc)
    --    mc.mcCntlSetLastError(mInst,s)
do a couple of jog increment presses,  then jog, and then do a couple of button presses and a couple of jogs and you will see that the even though the
values have been written to the prfile and the registers changed the jog is still what ist was set to before the button presses

All this really proves is that Programatically entering a new value in a jog dro does not have the same effect as entering a value manually.  And shows that writing to the profile and registers does not have the same effect as using the Jog cycle increment key.

Or did I miss something here?

RT

400
Mach4 General Discussion / Re: DRO behavior
« on: November 09, 2017, 05:40:26 PM »
Afternoon Craig,

Thanks once again for taking a stab at these problems.

The profile does not contain a current increment, rather it has a current 'JogIncSet' which is the index into the 10 settings and I have changed the value programmaticaly:  mc.mcProfileWriteInt(mInst,"Preferences","JogIncSet",CurInc) that along with flushing and reloading the profile but it has not made any difference in the outcome.  I have a sneaking suspicion that in this case they have chosen to not re-read the registers or the current indexed value.  I could be wrong, wouldn't be the first or last time, but my tests seem to show otherwise.

And of course it does not address the other parts of the questions asked.

RT