Hello Guest it is December 15, 2019, 08:44:59 AM

Author Topic: Modifing Operator Editable Button Macros  (Read 17398 times)

0 Members and 1 Guest are viewing this topic.

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #20 on: April 19, 2018, 06:43:37 AM »
the machine itself has a card   BL-usbMach  that works on usb....
but lets get into.... it
i use a 3 axis plate  with an 10 mm gap extra on x and Y axis and 3 mm on the z axis
i have a macro that works on this version... for touch plate.. on Z axis

FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
ZCurrent = GetOemDro(802)   'OEM DROs (802)=Z DRO
GageH = GetOEMDRO(1001)   'OEMDRO(1001)=Gage Block Height
ZNew = ZCurrent - 300      'probe down 20 mm

Code "G90F200"         'slow feed rate to 100 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 Z" &ZNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (2,GageH)      'DRO(2)=Z DRO

FinalMove = GageH + 10
Code  "G0 Z" &FinalMove
Code "F" &FeedCurrent        'restore starting feed rate   
SetOemDRO(818,FeedCurrent)

it works  for the touch plate.. and i want to modify it to make a 3 axis Zero
i modify it for the x axis as this...

FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
XCurrent = GetOemDro(800)   'OEM DROs (800)=X DRO
Gagexy = -10   'OEMDRO(1001)=Gage Block xy
XNew = XCurrent + 300      'probe to the right

Code "G90F200"         'slow feed rate to 100 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 X" &XNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (0,Gagexy)      'DRO(0)=x DRO

FinalMove = Gagexy -10
Code  "G0 X" &FinalMove
Code "F" &FeedCurrent        'restore starting feed rate   
SetOemDRO(818,FeedCurrent)


and i works just fine for the x axis and puts the tip 20 mm to the left of plate

the y axis version is

' probe y surface macro
FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
YCurrent = GetOemDro(801)   'OEM DROs (800)=Y DRO
GageY = -10   'OEMDRO(1001)=Gage Block xy
YNew = YCurrent + 300      'probe  on y axis

Code "G90F200"         'slow feed rate to 100 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 Y" &YNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (1,GageY)      'DRO(1)=y DRO

YFinalMove = GageY -10
Code  "G0 Y" &YFinalMove
Code "F" &FeedCurrent        'restore starting feed rate   
SetOemDRO(818,FeedCurrent)

it also works fine

but as the time that i want to mix with movement on the axis ...nothing works


Re: Modifing Operator Editable Button Macros
« Reply #21 on: April 19, 2018, 01:52:22 PM »
Thanks for showing your VB script.

Might I be correct in that your "Code "G90F200" is setting your feed rate to 200mm/min rather than what the comment denotes?

I'm assuming you know this but just in case, the use of a touch plate to effect zeroing XY or Z axes behaves as the ON/OFF switch for controlling the beginning and end of axis motion.  It requires a wire be connected to the router bit and another connected to the axis contact plate.  These two wires connect back to one input and one Ground terminal of the breakout board, forming a readable electro-mechanical switch.  

The IF/THEN loop begins with the touch plate switch "OFF/Open" and for as long as the switch condition is open, (If IsSuchSignal(22) Then) move the axis in the defined direction at the defined feed rate, keep checking the state of the switch and when the switch reads "ON/Closed" stop all axis motion as the tool bit has come in contact with the conductive "zero" plate.  Input 22 on the parallel port break-out board is internally held at 5v by a pull-up resistor, one of the two touch plate leads connects to here.  The other lead is connected to the common Ground of the controller board.  The VB touch plate loop is always checking whether pin 22 is pulled down to Ground potential.  When the two leads meet, the "touch" is complete, the DRO is set to the touch plate thickness, etc.

In your code I do not see the "If IsSuchSignal()" statement, which may be why you are having these issues.

Here is a sample of my original Auto Tool Zero Method VB script.

If IsSuchSignal (22) Then  'this line is sensing whether a "touch" has occurred
   code "G31 X-2 F10"
   While IsMoving()
   Sleep 100
   Wend
   Call SetOEMDRO( 800, .0625 )
                Sleep 100
   code "G1 X.5"
End If
« Last Edit: April 19, 2018, 01:54:18 PM by airnocker »
airnocker

Everything depends on everything else

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #22 on: April 20, 2018, 01:11:59 AM »
ok...ok..
1.-  I fixed the  200mm/min  comment...
2.-  I have not a parallel port on my machine  so i dont know if the   IF/THEN work as you said.
3.-  I have the wires conected .... as all the Axis  will work fine if they are   on different  macro .. i will post a video
4.-  To avoid the pre contact of the plate  i did put some adhesive tape under the plate...   because on the CNC  i have mounted a  metal working space  
5.-  if i put  the X zeroing macro first   .. it works well on zeroing X axis  ,and positionong the tip previous to the Y Axis Zeroing Macro

A------X axis zero  macro

' probe x surface macro
FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
XCurrent = GetOemDro(800)   'OEM DROs (800)=X DRO
GageX = -10                   'OEMDRO(1001)=Gage Block xy
XNew = XCurrent + 300      'probe to the right
YCurrent = GetOemDro(801)   'OEM DROs (801)=Y DRO
GageY = -10         'OEMDRO(1001)=Gage Block y


Code "G90F200"         'slow feed rate to 200 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 X" &XNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (0,GageX)      'DRO(0)=x DRO

XFinalMove = GageX -10
Code  "G0 X" &XFinalMove

'Y to position
YpreOne = YCurrent-30

Code "G0 Y" &YpreOne
Code "G0 X20"

Code "F" &FeedCurrent        'restore starting feed rate    
SetOemDRO(818,FeedCurrent)

------------------------------------------------------end of macro-------------------------------

6.- putting the next  Y Zeroing macro on the ....Operator / Edit Button Script   , erase the previous macro  and puting the Y axis macro...
     it works fine  and prepares the tip for the Z Axis Zero  on place.

' probe y surface macro
FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
YCurrent = GetOemDro(801)   'OEM DROs (801)=Y DRO
GageY = -10         'OEMDRO(1001)=Gage Block y
YNew = YCurrent + 300      'probe  on y axis
ZCurrent = GetOemDro(802)   'OEM DROs (802)=Z DRO
GageH = GetOEMDRO(1001)      'OEMDRO(1001)=Gage Block Height



Code "G90F200"         'slow feed rate to 200 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 Y" &YNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (1,GageY)      'DRO(1)=y DRO

YFinalMove = GageY -10
Code  "G0 Y" &YFinalMove

'Z Position
ZpreOne = ZCurrent +15
Code "G0 Z"&ZpreOne
Code "G0 Y20"

Code "F" &FeedCurrent        'restore starting feed rate    
SetOemDRO(818,FeedCurrent)

---------------------------End of Macro------------------------

7.- erase the previous script   and place the Z Zeroing macro...

'probe z surface macro
FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
ZCurrent = GetOemDro(802)   'OEM DROs (802)=Z DRO
GageH = GetOEMDRO(1001)      'OEMDRO(1001)=Gage Block Height
ZNew = ZCurrent - 300      'probe down 20 mm

Code "G90F200"         'slow feed rate to 200 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 Z" &ZNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (2,GageH)      'DRO(2)=Z DRO

FinalMove = GageH + 10
Code  "G0 Z" &FinalMove
Code "F" &FeedCurrent        'restore starting feed rate    
SetOemDRO(818,FeedCurrent)

----------------------------------------------END----------------------------

this 3 works fine...

8.-  But..  if i mix the 3 into one large script.....
the machine works erratic..

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #23 on: April 20, 2018, 01:16:36 AM »
video  1  x zero   and prepares for  y zero

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #24 on: April 20, 2018, 01:17:28 AM »
video 2  y zero and prepares for z zero

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #25 on: April 20, 2018, 01:18:23 AM »
third video   z zeroing
Re: Modifing Operator Editable Button Macros
« Reply #26 on: April 20, 2018, 02:06:38 AM »
Nice update, thanks. The videos do show it working for each individual axis.

However, could you please point out for me where your code is sensing when the two wires for closing the circuit touch?  I still do not see any evidence of this.

airnocker

Everything depends on everything else

Offline TPS

*
  •  1,412 1,412
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #27 on: April 20, 2018, 04:14:53 AM »

this 3 works fine...

8.-  But..  if i mix the 3 into one large script.....
the machine works erratic..


IMHO your script's have some  minor "leaks".

first read about GetVar(2000) to GetVar(2002), here are the values stored, where the the probe was hit,
because you will allways get an overrun of the axis caused by the decceleration during stop. so the usage
of  this values is elementary (for me) for precise probing.

i personaly put allways after a movement instruction caused by script (G0 / G1) a

While IsMoving()
 Sleep(10)
Wend

if you add this While IsMoving() to your code, you will see that the code will be a lot more
than you exepect.

you can also read about a Little bit here:

http://www.machsupport.com/forum/index.php/topic,36784.msg252331.html#msg252331



 

anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #28 on: April 20, 2018, 07:11:01 AM »

However, could you please point out for me where your code is sensing when the two wires for closing the circuit touch?  I still do not see any evidence of this.


mmmmm...
as far as today... my learning curve  for this has been , 
by learning in forums and watching youtube videos  ,
 the machine came with no manuals , and the modified version of mach3 have some different configuration

to be onest   .............I have no clue

i added this commands by taking some notes  and modifying some scripts found elsewhere..
they only sended this script ,

'probe z surface macro
FeedCurrent = GetOemDRO(818)    'Get the current settings, OEM DROs (818)=Feedrate DRO
ZCurrent = GetOemDro(802)   'OEM DROs (802)=Z DRO
GageH = GetOEMDRO(1001)      'OEMDRO(1001)=Gage Block Height
ZNew = ZCurrent - 300      'probe down 20 mm

Code "G90F200"         'slow feed rate to 200 MM/MIN
SetOemDRO(818,200)
Rem Code "G4 P1"      'Pause 1 second to give time to position probe plate
Code "G31 Z" &ZNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (2,GageH)      'DRO(2)=Z DRO

FinalMove = GageH + 10
Code  "G0 Z" &FinalMove
Code "F" &FeedCurrent        'restore starting feed rate   
SetOemDRO(818,FeedCurrent)

---------------------------------------------------------------------------
sensing the closing cicuit ?    i have been trying to learn what every command does or what it is for....but i also cant find it..

Offline yemil

*
  •  21 21
    • View Profile
Re: Modifing Operator Editable Button Macros
« Reply #29 on: April 20, 2018, 07:16:51 AM »
here is my copy of the main screen..
« Last Edit: April 21, 2018, 01:18:56 AM by Tweakie.CNC »