Hello Guest it is April 24, 2024, 10:34:35 AM

Author Topic: Step increase in feedrate.  (Read 4123 times)

0 Members and 1 Guest are viewing this topic.

Step increase in feedrate.
« on: July 19, 2011, 05:31:15 AM »
I apologize for my English. I am writing my first plugin and ran into a problem: I have appointed for your joystick buttons to actions: increase or decrease the feed rate (DoOEMButton 109, 108). But when you press the increase (decrease) occurs in 10% of the feedrate. Ie if the feed rate is set when you press 800 is increased to 880. How to change the step increase (decrease) in let's say 5% or 2.5%. Where is this variable? in which structure? ???
Re: Step increase in feedrate.
« Reply #1 on: August 04, 2011, 01:37:25 PM »
I have this same problem.  I put the feed rate override functionality into my Griffin Powermate plugin, but can't figure out how to make it move more than 10% at a time using the DoButton method.

I tried TrajectoryControl.FeedInc just to see if that was it, but it didn't work.  Maybe you just have to change the TrajectoryControl.FeedRate directly instead of using the buttons. Hopefully someone with chime in with the answer. 

I also found another weird problem.  When I issue the DoButton(1014) for the feed rate override reset button, it resets to 80% instead of 100%.  Do you also have this problem?
Re: Step increase in feedrate.
« Reply #2 on: August 09, 2011, 03:29:47 AM »
Below I have piece of software that I have to control the Feedoverride:

extern CMyScriptObject co;
extern double GetOEMDRO(short);
extern void SetOEMDRO(short,double);
const int FeedRateOverRide = 821;
double FRO;

......
     if( code == 108 ) {
      FRO = co.GetOEMDRO(FeedRateOverRide);
      FRO += 1;
      co.SetOEMDRO(FeedRateOverRide, FRO);
      return;
     }
    
     if( code == 109 ) {
        FRO = co.GetOEMDRO(FeedRateOverRide);
        FRO -= 1;
        co.SetOEMDRO(FeedRateOverRide,FRO);
        return;
     }
.......

I had a bug in a row that I noted a sign "-------->", Mach3 program installation is not prescribed in the registry value "Mach4.Document". Therefore, the functions SetOEMDRO (), GetOEMDRO () did not work.

VOID Mach3ObjectModelStartup(VOID)

{
   static const IID IID_IMyScriptObject =    { 0xf1d3ee6c, 0xab32, 0x4996,
    { 0xb2, 0x70, 0xf4, 0x15, 0x61, 0x3f, 0x5b, 0xa3 } };
   CLSID clsid;

   HRESULT res;
   res = CoInitialize(NULL);

   LPUNKNOWN lpUnk = NULL;
   LPDISPATCH lpDispatch = NULL;
   

   try {
---------->   res = CLSIDFromProgID(OLESTR("Mach4.Document"),&clsid);
      if (res == NOERROR) {

          if (res = GetActiveObject(clsid,NULL,&lpUnk) == NOERROR) {

            HRESULT hr = lpUnk->QueryInterface(IID_IDispatch,
                     (LPVOID*)&lpDispatch);

            lpUnk->Release();

            if (hr == NOERROR) {

               mach4.AttachDispatch(lpDispatch, TRUE);

               lpDispatch = mach4.GetScriptDispatch();

               co.AttachDispatch(lpDispatch, TRUE);

               connected = TRUE;
         
            }
         }
      }
   }

   catch(_com_error &e) {

   //   com_error_msg(e);
   }
}
Re: Step increase in feedrate.
« Reply #3 on: August 09, 2011, 04:31:16 PM »
Mine is simpler.  I am using the Mach includes from the Plugin Wizard.  This code gets called in a timer that I setup to run every 5ms.  MG::usbDeviceAction is a static class where I decode what action was performed on my Griffin powermate

            int rotated = MG::usbDeviceAction->rotated(MG::usbCommData->inputBuffer);
            if(rotated > 0){
               DoButton(108);
            }else{
               DoButton(109);
            }

If I rotate the grffin powermate clockwise, it returns a positive number, otherwise it is negative, and based on direction I call the Mach 3 DoButton method.

Just like you, it only changes in increments of 10% unless it is under 10% since it mimicks the operation of the clickable buttons on the Mach 3 screen.

Did you get your code to change it only 1% at a time?  It looks like your code should work.
Re: Step increase in feedrate.
« Reply #4 on: August 09, 2011, 09:06:46 PM »
Yes, I value changes by 1%. Function GetOEMDRO () returns a value from 0 to 250 "%". This code works for me.
Re: Step increase in feedrate.
« Reply #5 on: August 10, 2011, 11:42:28 AM »
That's great, Thanks George, I changed the code to the following, and it definitely changes the value by one.  This evening, I'll install the plugin on my mill PC, and try it for real on the mill.

            int rotated = MG::usbDeviceAction->rotated(MG::usbCommData->inputBuffer);
            //821 is the feed rate override DRO
            int val = GetDRO(821);
            if(rotated > 0)
               val++;
            else
               val--;
            SetDRO(821,val);