Hello Guest it is October 23, 2019, 03:08:56 PM

Author Topic: dispenser suckback script - incremental move in macro  (Read 1958 times)

0 Members and 1 Guest are viewing this topic.

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
dispenser suckback script - incremental move in macro
« on: August 01, 2010, 03:02:09 PM »
Hey guys, doing my best at this VB programming thing but still quite new to it.  I'm using my C-axis as a fluid dispenser which is mounted on a linear actuator to move it in and out of the work area.  Currently, I have it set up as M802 to extend the actuator (output 2 in Mach) and M902 to retract it.  On the retract command, M902, I want to add a few lines to incrementally step the dispenser back a set amount.  Here is what my current script looks like:

'M902
'raises dispenser actuator
DeActivateSignal(Output2)
code("G91")
code(G01 C-.005 F50")
code("G90")

This script does work in testing, but I'm worried that the G91 command is going to affect the g-code I am running by switching it momentarily to incremental mode and then back to absolute.  Is there a way to make the g91 only affect the c-axis, or a way to momentarily inhibit movement on the other 5 axes?  It seems like there should be a really obvious solution here but I can't figure it out for the life of me!
Mr. Creosote

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: dispenser suckback script - incremental move in macro
« Reply #1 on: August 01, 2010, 04:07:59 PM »
ASC, the way you are doing it IS the way it is done. Switching back and forth should have NO effect on accurary. You just have to make sure all your moves are correct.

The one thing you may want to consider is to add sleep() and  while ismoving() statements to insure the macro thread stays in sync with itself.

'M902
'raises dispenser actuator
DeActivateSignal(Output2)
Sleep(10)
code"G91"
Sleep(20)
code"G01 C-.005 F50"
While Ismoving()
Sleep(100)
Wend
code"G90"
sleep(20)
« Last Edit: August 01, 2010, 04:10:46 PM by BR549 »

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
Re: dispenser suckback script - incremental move in macro
« Reply #2 on: August 01, 2010, 04:17:18 PM »
thank you again!  You've cured both of my big headaches today!  If only I could email you a beer....
Mr. Creosote