Hello Guest it is March 28, 2024, 02:27:24 PM

Author Topic: Altering a Macro Help please.  (Read 2930 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris.Botha

*
  •  488 488
  • wine me.. dine me.. tram my mill for me...
    • View Profile
    • Digital-Jeweller
Altering a Macro Help please.
« on: November 07, 2014, 05:04:02 AM »
Hey All,

Need some help from the code junkies please.. I have an existing macro that does my homing and a tool pro be for me.  it runs like so:

Z, Y, X then Probe.  https://www.youtube.com/watch?v=gQVm4YjLM3E


I have since upgrade to a 5th axis, and I need to home A and B as well..

BUT

B = no issue as it cannot crash anything//

A = Issues..

then script will need to run as follows now:

action sequence:

1. Home Z: then Move Z to a safe distance. (say 10mm down from home switch)

2. Home X: then Move it to Fixture 1(g54) X0  (XYZ share one input signal, I have to move off the switch for next axis homing run)

3. Home Z: then move it to Fixture 1(g54) Y0  (XYZ share one input signal, I have to move off the switch for next axis homing run)

4: Home B:

5: Home A: then move A to -A45

6: Probe Tool: (note Z MUST stay at same height until its directly over tool probe before going Down Z.

7: Return to the safe Z (10mm below Z probe) over X0andY0


So! Most of the code already exists, and the tool probe position is programmed via my interface so all I need added are the A and B bits..

Any help appreciated folks!

(here is the current standing of my build, jsut about ready to start making noise!! https://www.youtube.com/watch?v=gQVm4YjLM3E)

and attached is the current Macro. (adding it as file because code is being converted into smiley characters by forum)



Quote
HomSigY = IsActive(5)
HomSigZ = IsActive(8)
Xreferd = GetLED(7)
Yreferd = GetLED(8)
Zreferd = GetLED(9)

If HomSigX Or HomSigY Or HomSigZ = True Then
        MsgBox("Home switch active...please deactivate before tool change.")
        Exit Sub
End If

If Xreferd Or Yreferd Or Zreferd = True Then
        MsgBox("Axis not referenced...please home all first.")
        Exit Sub    
End If

LastFeed=GetOEMDRO(818)

SetUserLED(1001,False)
SoftState = GetOEMLED(815)
If SoftState = True Then
DoOEMButton (119)
SetUserLED(1001,1)
End If

SetUserLED(1002,0)
WorkUnits = GetOEMLED(801)
If WorkUnits = True Then
code "G21"
SetUserLED(1002,1)
End If

DoOEMButton(104)
While IsMoving()
Sleep 100
Wend

xTSensPos = GetUserDRO(1200)                
yTSensPos = GetUserDRO(1201)                
code "G00"                        
code "G53X" & xTSensPos & "Y" & yTSensPos      
While IsMoving()
Sleep 100
Wend

SensGapPos = GetUserDRO(1203)
code "G00"
code "G53Z" & SensGapPos
While IsMoving()
Sleep 100
Wend

zTSensPos = GetUserDRO(1202)
SensSpeed = GetUserDRO(1204)
code "G31Z" & zTSensPos & "F" & SensSpeed
While IsMoving()
Sleep 100
Wend

CurrFixture=GetOEMDRO(46)

Select Case CurrFixture
Case 2
     ProgXZero = GetUserDRO(1209)
     ProgYZero = GetUserDRO(1210)
     ZtoProbe = GetUserDRO(1212)
Case 3
     ProgXZero = GetUserDRO(1213)
     ProgYZero = GetUserDRO(1214)
     ZtoProbe = GetUserDRO(1216)
Case Else
     ProgXZero = GetUserDRO(1205)
     ProgYZero = GetUserDRO(1206)
     ZtoProbe = GetUserDRO(1208)
End Select

SetDRO(2,ZtoProbe)

code "G00"
DoOEMButton(104)
While IsMoving()
Sleep 100
Wend

code "G00"
code "G53Y" & ProgYZero & "G53X" & ProgXZero
While IsMoving()
Sleep 100
Wend  

If GetUserLED(1001)= 1 Then
DoOEMButton (119)
SetUserLED(1001,0)
End If

If GetUserLED(1002)= 1 Then
code "G20"
SetUserLED(1002,0)
End If






« Last Edit: November 07, 2014, 05:06:11 AM by Chris.Botha »

Offline Vogavt

*
  •  260 260
    • View Profile
Re: Altering a Macro Help please.
« Reply #1 on: November 08, 2014, 02:19:00 PM »
Use "code" instead of "quote". It's the hashtag to the left of the insert quote button  <grin>

Code: [Select]
HomSigY = IsActive(5)
HomSigZ = IsActive(Cool
Xreferd = GetLED(7)
Yreferd = GetLED(Cool
Zreferd = GetLED(9)

If HomSigX Or HomSigY Or HomSigZ = True Then
        MsgBox("Home switch active...please deactivate before tool change.")
        Exit Sub
End If...................





Offline Chris.Botha

*
  •  488 488
  • wine me.. dine me.. tram my mill for me...
    • View Profile
    • Digital-Jeweller
Re: Altering a Macro Help please.
« Reply #2 on: November 08, 2014, 04:59:23 PM »
Thanks I got help.  Issue resolved