Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: f750 on November 22, 2024, 11:41:35 AM

Title: Edge finder probing
Post by: f750 on November 22, 2024, 11:41:35 AM
I have downloaded some files for edge finder which after a little works does work, what I would like is for the probe to back off 5-10 mm when it has found the edge; below is the script I use and would be grateful for ang suggestions. Cheers Tony

 
Rem VBScript To probe bottom edge
If GetOemLed (825) NE 0 Then 'Check to see if the probe is already grounded or faulty
   Code "(Probe plate is grounded, check connection and try again)"
Else
   FeedCurrent = GetOemDRO(818) 'Get the current settings
   XCurrent = GetDro(0)
   Current = GetDro(1)
   Code "G4 P1" 'Pause 1 second to give time to position probe plate
   Code "F100" 'slow feed rate to 100 mmpm
   
   Rem Probe up
   YNew = YCurrent + 75
   Code "G31 Y" &YNew
   While IsMoving()
   Wend
 
   Code "F" &FeedCurrent 'restore starting feed rate
   Call SetDro (1,Abs(getoemdro(1000))/(-2))
End If 
Rem End of To probe bottom edge script.
Title: Re: Edge finder probing
Post by: TPS on November 23, 2024, 03:02:47 AM
this should do what you want:

Code: [Select]
Rem VBScript To probe bottom edge
If GetOemLed (825) NE 0 Then 'Check to see if the probe is already grounded or faulty
   Code "(Probe plate is grounded, check connection and try again)"
Else
   FeedCurrent = GetOemDRO(818) 'Get the current settings
   XCurrent = GetDro(0)
   YCurrent = GetDro(1)
   Code "G4 P1" 'Pause 1 second to give time to position probe plate
   Code "F100" 'slow feed rate to 100 mmpm
   
   Rem Probe up
   YNew = YCurrent + 75
   Code "G31 Y" &YNew
   While IsMoving()
   Wend
 
   Code "F" &FeedCurrent 'restore starting feed rate
   Call SetDro (1,Abs(getoemdro(1000))/(-2))

   'move Y Axis away ----------------------------
   Sleep(200)   
   G90wasON =GetOEMLed(48)
   Code "G91"
   Code "G1 Y-10"
   While Ismoving()
   Wend
   If G90wasON = True Then
      Code "G90"
   End If
   '--------------------------------------------------

End If
Rem End of To probe bottom edge script.


not tested just written down
Title: Re: Edge finder probing
Post by: f750 on November 23, 2024, 02:02:35 PM
 Hi I have tried the suggestion out today and unfortunately it comes up with Scripter Compiler Error, Cheers Tony
Title: Re: Edge finder probing
Post by: TPS on November 24, 2024, 06:51:53 AM
OK try this
Code: [Select]
Rem VBScript To probe bottom edge
If GetOemLed (825) Then 'Check to see if the probe is already grounded or faulty
   Code "(Probe plate is grounded, check connection and try again)"
Else
   FeedCurrent = GetOemDRO(818) 'Get the current settings
   XCurrent = GetDro(0)
   YCurrent = GetDro(1)
   Code "G4 P1" 'Pause 1 second to give time to position probe plate
   Code "F100" 'slow feed rate to 100 mmpm
   
   Rem Probe up
   YNew = YCurrent + 75
   Code "G31 Y" &YNew
   While IsMoving()
   Wend
 
   Code "F" &FeedCurrent 'restore starting feed rate
   Call SetDro (1,Abs(getoemdro(1000))/(-2))

   'move Y Axis away ----------------------------
   Sleep(200)   
   G90wasON =GetOEMLed(48)
   Code "G91"
   Code "G1 Y-10"
   While Ismoving()
   Wend
   If G90wasON = True Then
      Code "G90"
   End If
   '--------------------------------------------------

End If
Rem End of To probe bottom edge script.

the compiler error is in the original script:

If GetOemLed (825) NE 0 Then 'Check to see if the probe is already grounded or faulty


Title: Re: Edge finder probing
Post by: f750 on November 27, 2024, 03:33:48 AM
Hi thank you for the new suggestion, unfortunately it gave me the same result, Scripter Compiler Error.
  Cheers Tony
Title: Re: Edge finder probing
Post by: TPS on November 27, 2024, 06:09:22 AM
the code is working here.

copy and paste the code into VB Scripter window
and use the ||> button to step through the code.
the VB Scripter will tell you, where the Scriper Compiler error should be.
Title: Re: Edge finder probing
Post by: f750 on December 02, 2024, 07:22:49 AM
Hi TPS thank you for your help, I have now got the edge finder working on X and Y axis in both directions. I have had to walk away and have a think about the software but now works great. Cheers Tony