Hello Guest it is November 08, 2024, 09:52:00 PM

Author Topic: A little Help for finishing my Plugin  (Read 14265 times)

0 Members and 1 Guest are viewing this topic.

A little Help for finishing my Plugin
« on: October 05, 2014, 02:29:12 PM »
Hello all !
I'm writing my  own Pluging with Visual C++ 2008 and the so convenient  'Wizard Plugin' by Edward D. Bryson.

It's a kind of very simple plugin:
A dialog box asks you to choose in a list Box the item  you want to CNC machine and then brings the spindle to
the 0 reference XY of that piece.

The help i need is the following:

When i'm homing the machine with  DoButton(1024);DoButton(1023);DoButton(1022);
i would like to know how to do for waiting the homing to be done (like a kind of  a While( IsMoving) statement, but in C++)
before executing a next instruction.

I've tried if(Engine->State== true) , if(Engine->Jogging== true)  , if(Engine->Homing== true) and some others
but each time mach3 does it's homing without taking care of of those conditions.

In the  same way ,when i'm executing a GCode( X..Y.. Z...) instruction, a SetDRO(800,0.0000) just after  isn't executed.

It's seems that Mach3 while moving the axis,continues the "reading"  of the code but doesn't execute it -like a jump- , and
THEN , when the move is finished, take again any new instruction into account.
So instructions are " lost "in between..

Is it possible to programmatically initiate a move, then wait till this movement is finished  (how????), and then execute other lines of codes ?

Thanks for helping

Cyril  :-X
« Last Edit: October 05, 2014, 02:37:47 PM by kilooli »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
Re: A little Help for finishing my Plugin
« Reply #1 on: October 07, 2014, 10:11:08 AM »
It might be easier for you to look at the "Homed" OEM LEDs for each axis..
i.e.   

if GetLED(X axis homed led number) and GetLED(Y.......) and GetLED(Z ....)
     set can continue to true or what ever....

another option, is to set up a switch statements(s) that switch on conditions of your sequences.

Scott
fun times
Re: A little Help for finishing my Plugin
« Reply #2 on: October 07, 2014, 10:30:07 AM »
Hello,
thanks for having answered !
I'll give a try  at the Homed LED "method".
Thanks
Re: A little Help for finishing my Plugin
« Reply #3 on: October 07, 2014, 02:38:04 PM »
Hi again Poppabear.

The home LED solution was good .

I need another advice:
I do a Code(XYZ) instruction , mach3 moves to the specified coordinates.
After it finishes moving, i want to toggle in Work Coordinates and do a X and Y zeroing.

Below is  a part of my code, but i can't achieve to do the zeroing, as Mach3 doesn't seem to take it  into account
Maybe you have an idea ?

Code: [Select]



 coordonnees  = sprintf_s( GCode, 40,"F1000 G53 X%s Y%s",X,Y);
Code (GCode);
GCodeExecuted=true;  // variable to "memorize" that instruction Code has been executed

if (GCodeExecuted==true && Engine->StatLast[0]==0 && Engine->StatLast[1]==0) // to see if there's still any movements
      {
        DoButton(181);   //  WORK  coordinates
DoButton(1009);  // Zeroing  Y
DoButton(1008);  // Zeroing  Y

        GCodeExecuted=false;
       }




« Last Edit: October 07, 2014, 02:40:06 PM by kilooli »
Re: A little Help for finishing my Plugin
« Reply #4 on: October 08, 2014, 06:52:57 AM »
Hello everybody,

i reply to myself as i found  the way to detect the existence of a movement  (it was obvious, after founding it) .

There's a LED called "System movement in effect or movement imminent LED", code  number 999
that provides the good information.

Bye