Hello Guest it is July 06, 2020, 06:01:54 AM

Author Topic: Mach3 Plasma set-up. How do I set the z axis machine coords in VB script?  (Read 971 times)

0 Members and 1 Guest are viewing this topic.

Sorry this is probably as clear as mud.

I appreciate Mach3 has been superseded but would still appreciate getting the most out of my simple plasma system.

I have just fitted Home switches to X and Y and they work fine, Z home not connected in ports and pins inputs.
Ref all Home X and Y do as I would expect move to activate the home switches and then back off until the switch goes to normal State (NC) and with the home off setting I can make the displayed machine coords display what I enter.

I wanted to use Z probe to do similar for the Z axis by making the Z home the same input as the probe input and it does work exactly the same, only I realised it did Z first then Y then X and being a plasma table means Z could probe to an empty void hit limit then try and move Y and X jamming the head.  So I looked for a way to change the order of referencing to Y then X then Z, as I could always leave a block of steel for Z to touch off on at the home position.

But finding no way to change the order of homing I began to look for another way.

As I use an M800 macro to probe the top of work prior to cutting, I thought it could be possible to also set the Z axis machine coord as well as setting the work z axis coord.

But I can not discover what parameter I need to set, OEMDRO, DRO etc? either my brain is fuddled or I have missed something basic.

At the moment I can not remember where I got the 2002 to use in the line  GetprobePos = GetVar(2002),  2002 must be the position when the probe activated.  So I may have lost some docs or wiki link.
Later in the makro I use  Call SetOEMDRO(802, AH) where AH is the adjustment value before moving to pierce height but that is only working coords, I have tried a few of the DRO's without success but basically want to make the Z axis machine coord the same as the work coord so I can have some sensible soft limits working on Z.

Can anyone help please?

Adrian
I have timed out on being able to edit, but after more searches I have found out how to reverse the order of Ref all home as such I have changed
the VB script for the ref all button from
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

To

DoButton( 23 )
DoButton( 22 )
DoButton( 24 )

So that changes the order.  Now I have done this on two screens the Program run Alt1 screen and the MDI screen Al2, I thought they may have acted the same but for some reason they do not.  The Alt1 screen goes to safe Z height before moving Y and X.  The Alt2 screen does not, so I have missed something there?

Also I tried to use the following
DoButton( 23 )
DoButton( 22 )
DoButton( 24 )
Code("G1 Z10.0 F600")   ' Move up 10
  While (IsMoving())   ' Wait for movement to complete
  Sleep(100)      ' Sleep, so other threads can run while we wait
  Wend

But Z will not move to a height of 10.

So again I am missing something that must be obvious here?

I would still appreciate knowing how to make the machine or ABS Z the same as Work Z?

Thanks.

Adrian
The last post tonight before I go to bed, sorry but I keep playing and playing until I manage to get somewhere.

I was on the latest version of Mach3 and realise the plasma screen Ii am using has a few old codes in there so I changed the Ref all home buttons to use the OEM buttons, I also added some waiting in there as I guessed that I had to do so similar to my VB code for probing of the top of work so the two reference all buttons now have the following codes:

DoOEMButton(104)     ' Go to Safe Z  
  While (IsMoving())     ' Wait for movement to complete
  Sleep(100)         ' Sleep, so other threads can run while we wait
  Wend
DoOEMButton(1023)   ' Reference Y
DoOEMButton(1022)   ' Reference X
DoOEMButton(1024)   ' Reference Z
  While (IsMoving())   ' Wait for movement to complete
  Sleep(100)         ' Sleep, so other threads can run while we wait
  Wend
DoOEMButton(104)   ' Go to Safe Z  

It basically works for an initial set up to be safe enough that I do no damage.  It was confusing however, that if Z was already at Z=10 which is my safe height, the 1st DoOEMButton(104) will move Z up to 20mm, before referencing.  I then realized that the Safe Z was set for incremental which is probably the safest way for it to be.

Adrian
« Last Edit: April 26, 2018, 06:51:55 PM by AdrianH »