Hello Guest it is April 27, 2024, 09:56:36 AM

Author Topic: JogOn and JogOff in Macros  (Read 560 times)

0 Members and 1 Guest are viewing this topic.

Re: JogOn and JogOff in Macros
« Reply #10 on: December 01, 2023, 03:36:15 AM »
Thank you very much for your support, but it is not working in my case. I will have to find another solution for my application. On first sight it appeared to be very easy using jogon and jogoff, but reality is diffrent..

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #11 on: December 01, 2023, 05:43:24 AM »
so what are you realy trying to do? maybe there is an other way for it.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: JogOn and JogOff in Macros
« Reply #12 on: December 01, 2023, 06:24:39 AM »
It is a very simple task. As I wrote it has nothing to do with a Mills, Lathes etc. The Mach3 is going to run in a minimzed Window, no commands will be entered directly into the Mach3 SW. My UI, Control System, Vision System and Motion System is written in C# using MS VS. At one point, I need to teach setpoints for the stepper motors (4 of them). They are used for a timing belt driven loading system. The accuracy of this system has to be better than 0.1mm. In the past I used motion controllers which are unfortunately not available anymore. This lead me to use Mach3 with a CL stepper driver running in 12800steps/rev microstep-mode. So far, so easy. Now, for teaching the positions, I am using standard buttons on a screen. Actually the mousedown event is used to send a G1 code to mach3 which will start a move to the max possible position. If the button is released, the Mouse_Up event is used to send a Stop using OEMButton 1003. This is working, but there is always a delay until the motor stopps. It is not the ramp down of the movement profile. Therefor I thought the JogOn/Off would be a better way to do this.

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #13 on: December 01, 2023, 06:40:55 AM »
what is the interface between your vision system and Mach3?

why cant you send G1 to the expected position?

if you want to do small steps, like jog in step mode
you can send a "G91 G1 X1 F10" for example
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: JogOn and JogOff in Macros
« Reply #14 on: December 01, 2023, 07:15:27 AM »
I found my solution !!!!
In C#
I added a Referenc to Mach3.exe (Reference is named Mach4.. Why? No idea

using Mach4;

in my class (Form)

        private IMach4 _mach;
        private IMyScriptObject _mInst;

and

private void GetMachInstance()
        {
            try
            {
                _mach = (IMach4)Marshal.GetActiveObject("Mach4.Document");
                _mInst = (IMyScriptObject)_mach.GetScriptDispatch();
                Status_label.Text = "Mach3 Instance found";
            }
            catch
            {
                _mach = null;
                _mInst = null;
                Status_label.Text = "No Mach3 Instance found";
            }
        }

now, the _mInst object can be used foralmost everything.

_mInst.JogOn(0,0)    IS WORKING
_mInst_JogOff(0)      IS WORKING TOO

I only need to figure out, how to set Jog Speed. F comand is not working..

If you are intrested in this, I can send you my C# test-project

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #15 on: December 01, 2023, 09:02:11 AM »
great!

with OEMDro(3) you should be able to set the slow jog speed in %, i think.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: JogOn and JogOff in Macros
« Reply #16 on: December 02, 2023, 06:12:00 AM »
Yes, that is what I am using. Working fine. Do you know, if there is a way to jog multiple axis at the same time? I would need X&Y and Z&A

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #17 on: December 02, 2023, 07:13:26 AM »
here:

https://www.cnczone.com/forums/attachments/5/2/5/2/6/61017.attach

i found some time ago a document for OEM Buttons

352-355 do other axis combination's but never found something for X&Y or Z&A sorry.

maybe you can do a brain witch jog's two axis via a UserLED you can write, never tryed it.
« Last Edit: December 02, 2023, 07:15:37 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #18 on: December 02, 2023, 07:27:01 AM »
here is a brain where i played arround a bit
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.