Hello Guest it is April 26, 2024, 09:01:09 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 - rhtuttle

401
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

402
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

403
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

404
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

405
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.

406
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?

407
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

408
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

409
Mach4 General Discussion / DRO behavior
« on: November 09, 2017, 01:29:30 PM »

If a DRO who's DRO code is set to CurrentJogIncr. has a valid number (read, one of the 10 jog increments defined) entered through the keyboard the 'core/inst' register entries for JogIncX through JogIncC are updated with the new value and when incremental jogging is requested the axis moves the correct amount.  Same thing occurs when using the 'Incremental Jog Step' button. 

It appears that some event is triggered when the value changes.

If however you change the value programmaticaly, e.g. scr.SetProperty('droJogInc',"Value",tostring(SetInc)) , the event is not fired.  Shouldn't any change to the 'Value' call the update event/action?
Is there a way to force/call that event/action?

Additionally, it you write to the registers, new values:

        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

they are ignored on further incremental jog requests.  Is it not correct to read the register for the jog increment each time an incremental move is made?

And why is there no mcJogCycleIncrement() api available?

TIA

RT

410
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: November 08, 2017, 12:13:45 PM »
I've been chasing my tail with trying to change the jog increment for a full day.  To test it without the xBox so as to limit the possible errors I have done the following:
on the jog panel added a DRO and set it to CurrentJogIncr.  When using the 'Incremental Jog Step' button it correctly updates.
I then added a button and in the left up script added the following code which is what I would be doing in the xBox controller:

Code: [Select]
       local mInst=0
        local CurInc = mc.mcProfileGetInt(mInst,"Preferences","JogIncSet",0) --make a new setting in profile to hold our current inc number
        local SetInc = mc.mcProfileGetDouble(mInst,"Preferences","JogInc"..CurInc,0.00) -- fetch our inc value from the profile JogInc + 2 say = [Preferences][JogInc2]

        CurInc = CurInc + 1 -- increment our CurInc by 1
        if CurInc > 10 then CurInc = 1 end -- if our CurInc is greater than 10 then go back to 1
        
        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.mcProfileWriteInt(mInst,"Preferences","JogIncSet",CurInc) --set our profile to new CurInc
        local s=tostring(CurInc)
        mc.mcCntlSetLastError(0,s)

When I use the button the txtJogInc control updates but the DRO does not.  You can see from the error messages that the CurInc is updating but when the 'Incremental Jog Step' button is used it is not synced to the last change.  There seems to be a flaw in the way the dro works or in the way mach checks to see what the current increment has been changed to...or...in my understanding!

Any help?

RT