Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: mariusl on April 05, 2013, 07:36:56 AM

Title: Custom Homing code
Post by: mariusl on April 05, 2013, 07:36:56 AM
Hi all
I did this piece of code that is attached to the "Ref All Home" button. I have a tangential knife on the rotary (A) axis that has to be locked by a pin and then zeroed.
This code does not work on first startup of Mach. If I traversed the a axis once, then it will work. It seems to sit and wait for the first turn to complete but it does not turn at all. I think it hase something to do with feed rates.
Can someone help please?

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
While ismoving()
Wend

Code "G1 A0 F2000"
While ismoving()
Wend

ActivateSignal(Output2) 'set the pin
Sleep(500)

Code "G1 A-180 F2000"  ' turn the knife anti-clockwise for a half turn
While ismoving()
Wend

DoButton(11)  ' clear the DRO

Code "G1 A-180 F2000"  'turn the knife again to make sure of one full turn and lock-up
While ismoving()
Wend

DoButton( 11 )  ' do the mach referencing

SetDro(3,270) ' to head the knife in th eright direction
DeActivateSignal(Output2) ' unlock the pin
Code "G0 A0"
Code "G0 X-12"
Code "G0 Y102"
While ismoving()
Wend
DoButton( 8 )
DoButton( 9 )