Hello Guest it is March 28, 2024, 06:01:13 AM

Author Topic: Stringing MDI Instructions together  (Read 9198 times)

0 Members and 1 Guest are viewing this topic.

Stringing MDI Instructions together
« on: January 09, 2017, 03:15:49 AM »
I have a small Machine (600mm X 300mm) on which I use an XBox controller as my pendant. I also have a laser crosshair (vitually identical to the Tweakie setup) which I use to position the X and Y axes for the progarm start point.

Trouble is, I have the pendant configured to prevent diagonal moves - this because I find it a lot easier to keep to straight X or Y moves to get me close to the required start point. I can then 'jog' at slow speed to get me right over the start point i require - again using the pendant.

However, when I use the 'Tweakie' macro to move the cutting head to the required start point, Mach3 seems to have great difficulty in deciding which X or Y move to make to get me there. The motors make a lot of weird noises but do eventually get me to the right point. It seems like it struggles to do it smoothly as one continuous move.

I would prefer to do the moves singly (rather than a diagonal) as I dont want to change the configuration on the pendant for the reasons already stated above.

I admit to being absolutely useless with VB in Mach3 - its like it's written in Chinese to me, just can't get my haed around it at all, I find the whole VB thing a bit of a black art!

However, I can (just about) get the result I am looking for via the MDI Line instructions - providing I concentrate.

My thoughts are that I would like to string together two lines that I use via the MDI to make the moves required but with some sort of  'WAIT' instruction between the lines so that they dont both happen concurrently - and attempt this diagonal movement again.

Can someone possibly point me in the right direction with this?

Many thnks if you can....

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Stringing MDI Instructions together
« Reply #1 on: January 09, 2017, 04:39:40 AM »
Quote
I would prefer to do the moves singly (rather than a diagonal) as I dont want to change the configuration on the pendant for the reasons already stated above.

I admit to being absolutely useless with VB in Mach3 - its like it's written in Chinese to me, just can't get my haed around it at all, I find the whole VB thing a bit of a black art!

In my macro try replacing the single line;

Code "G91 G0 X" &Xmove & "Y" &Ymove ' Makes an incremental move the distances that you set

with;

Code"G91 G0 X" &Xmove
While IsMoving ()
Wend
Code "G0 Y" &Ymove

This should then perform the axes moves seperately.

Tweakie.
PEACE
Re: Stringing MDI Instructions together
« Reply #2 on: January 09, 2017, 05:34:08 AM »
Many thanks Tweakie - I'll certainly be giving this a try...
Re: Stringing MDI Instructions together
« Reply #3 on: January 10, 2017, 02:21:48 AM »
OK, I've modified the code as suggested and, yes, it now moves as I would like it to. However, it still sounds lile the X and Y steppers are fighting with each other while the moves are being made.

When I make a 'straight' move using the controller joysticks, the move is as smooth as silk. But when I invoke the Macro via the Xbox Controller button, the motors seem to 'stutter' into position, not smoothly as I would expect.

Any ideas why this shold be? ???
Re: Stringing MDI Instructions together
« Reply #4 on: January 10, 2017, 02:41:33 AM »
Just a thought, this is the code I am using at the moment - just so you can see if I have made any mistakes?

Xs = GetOemDRO(59) 'X-Scale DRO

Ys = GetOemDRO(60) 'Y-Scale DRO

Xmove = -1.5386 * 1/Xs 'Move distance adjusted for X-Scale factor

Ymove = 1.0863 * 1/Ys 'Move distance adjusted for Y-Scale factor

DeActivateSignal(OUTPUT5) 'Turn off laser

Code"G91 G0 X"  &Xmove
While IsMoving ()
Wend
Code "G0 Y"  &Ymove
While IsMoving () ' Waits while that happens

Wend

Code "G90" 'Goes back to absolute moves

DoOEMButton (1008) 'Zero X-Axis DRO

DoOEMButton (1009) 'Zero Y-Axis DRO

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Stringing MDI Instructions together
« Reply #5 on: January 10, 2017, 02:44:23 AM »
I suspect that if you run the macro from an on-screen button your motors will run smoothly (as intended) so the problem lies with the communication between the XBox controller and Mach3 which is basically being asked to run two macro's at the same time. There may be an easy way around this but I will leave that to someone who is more familiar with the XBox related plugin.

Tweakie.
PEACE
Re: Stringing MDI Instructions together
« Reply #6 on: January 10, 2017, 03:10:43 AM »
Great answer, had never really thought about it that way.

Sounds to me that you are about right with this, as you say, there is bound to be a little confusion if it is actually running two macros concurrently.

Why didn't I think of this?
Re: Stringing MDI Instructions together
« Reply #7 on: June 25, 2017, 06:37:09 PM »
Your machine and drawing should reference a X0,Y0 corner or certain spot on the sheet. That way you would line up on that point zero x and y then run. Your gcode should carry you to the starting point of the cut.
I have this ultimate set of tools I can fix it.