Hello Guest it is April 25, 2024, 05:11:35 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gnorton

Pages: 1 2 »
1
VB and the development of wizards / Re: IsMoving Hangs Mach3
« on: July 19, 2014, 02:02:32 PM »
Just as an update, I thought I could be clever and re-wrote the macro so that the IsMoving loop wasn't necessary.  I just set the DRO based on the plate thickness and amount of overrun found.  The new version is below.  Everything except the move command seems to be working.  When I attempt to run the new macro, the probe moves until the probe touches, the Z axis DRO is reset, and the last message is "Z Zero Routine Complete".  Except the probe doesn't retract as commanded.   Very strange behavior.

Does anyone know if Mach has a log file of all G code executed or anything where I can get some more debugging info from Mach?

Any suggestions are welcome.

Thanks.
Greg

Code: [Select]
DownStroke = -0.5 'Set the down stroke to find probe
DownFeedRate = 10 'Set the down FeedRate
RetractStroke = 0.5 'Set the retract Stroke
RetractFeedRate = 40 'Set the retract FeedRate
PlateThickness = 0.060

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
' Not getting correct value for PlateThickness - hard coded for now
' PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
Code "(Probe Complete: " & GetVar(2002) & ")"
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
Code "(Checking)"
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
' Set Z DRO to plate thickness, less the amount of overrun where
' the overrun is the difference between the probe trigger point
' and the current position
Code "(Probe OK!)"
Call SetDro (2, PlateThickness - (ZProbePos - GetOEMDRO(802)))
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &RetractStroke &" F" &RetractFeedRate 'retract
Code "(Z axis is now zeroed - hard coded to " &PlateThickness &")" 'puts this message in the status bar
Else
Code "G0 Z0" 'retract to start pos
Code "(Z-Plate not found, check connection or stroke - try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Code "(Z Zero Routine Complete)"
Exit Sub     

2
VB and the development of wizards / Re: IsMoving Hangs Mach3
« on: July 18, 2014, 08:17:16 PM »
Gerry,

I changed the section of code so that I now appears as shown below.  There was no change in behavior.  The Z axis still stopped after making contact and Mach had to be reset to regain control.

Thanks.
Greg

Code: [Select]
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
                Code "(Retracting Probe to touch depth)"
While IsMoving ()
Wend
Code "(Retract Complete)"

3
VB and the development of wizards / IsMoving Hangs Mach3
« on: July 18, 2014, 05:26:25 PM »
Hello All,

I have a custom version of a Z zeroing macro I found here.  For some reason one of the IsMoving loops hangs Mach3 when it executes.  The only way I can regain control is to hit the reset button in mach.  The last message I see is "Retracting Probe to touch depth" and it never comes out of the IsMoving loop as "Retract Complete" never shows up.  Anyone have thoughts on this?  I am running version 066 (latest - just downloaded).  I am calling the script from the Set Z Height button on the Offsets tab.  Any input is greatly appreciated.

Thanks.
Greg

Code: [Select]
DownStroke = -0.5 'Set the down stroke to find probe
DownFeedRate = 10 'Set the down FeedRate
RetractStroke = 0.5 'Set the retract Stroke
RetractFeedRate = 40 'Set the retract FeedRate
PlateThickness = 0.060

CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
' Not getting correct value for PlateThickness - hard coded for now
' PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the axact point the probe was hit
If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Code "(Retracting Probe to touch depth)"
Wend
Code "(Retract Complete)"
Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code "G1 Z" &RetractStroke &" F" &RetractFeedRate 'retract
While IsMoving ()
Wend
Code "(Z axis is now zeroed - hard coded to " &PlateThickness &")" 'puts this message in the status bar
Else
Code "G0 Z0" 'retract to start pos
While IsMoving ()
Wend
Code "(Z-Plate not found, check connection or stroke - try again)" 'puts this message in the status bar
End If
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
End If
Code "F" &CurrentFeed 'Returns to prior feed rate
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Exit Sub     


4
General Mach Discussion / Re: Touch Off Macro Half Works
« on: August 27, 2012, 04:50:07 PM »
Tweakie,

Where would I even start for something like this?  I should note that the machine works fine in regular operation.  The only time I have this problem is when using this macro?  If it was a systemic problem with machine itself I would think that other odd behaviors would be showing up at other times when I'm using the machine.

Thanks for your input, I'm just not sure where to start looking right now.
Greg

5
General Mach Discussion / Re: Touch Off Macro Half Works
« on: August 20, 2012, 11:13:33 PM »
OK, very strange behavior is happening now, see below.  But first to address the questions:

Hood - yes I'm using a licensed copy of Mach.

Gerry - thanks for the info about the safe Z retract.  I will add that back to the macro when I have figured out why it's not behaving properly after touching the plate.  For now I would be happy to get correct and consistent results from this macro.

Tweakie - I added your line "DoOemButton(1003)" where you specified.  This caused some very strange behavior.  What does this do?

1.  The direction of movement was frequently up instead of down when doing the probe move.  But it wasn't consistently wrong.  This seems to be before it even executed your new line.

2.  When your line was in the macro, after touching the plate, the machine moved on the X and Z axes simultaneously when it tried to retract.  It moved about 2 inches to the right as well as moving up about the 0.25 inches specified by the macro.

I am quite mystified by this, so if anyone can set me straight I would appreciate it very much.

Thanks to everyone.
Greg


6
General Mach Discussion / Re: Touch Off Macro Half Works
« on: August 20, 2012, 10:08:41 AM »
Gerry,

I modified the macro as you suggested and there was no change in behavior.  So I removed some of the complexity to try and locate the offending line.  It seems that the machine is just ignoring the retract move and I still get the message saying "Z Axis is now zeroed".  The Z axis DRO is being set properly, just no retraction move is done.

Any suggestions are welcome, below is the current version that I'm using that has been stripped down to the bare minimum.

Greg

Code: [Select]
'Tool Zero Setting Macro

' Change the following three lines to suit your machine
PlateThickness = 0.060 ' Thickness of touch plate
RetractClearance = 1.000 ' Clearance above touch plate to retract to
ProbeFeed = 5      ' Feedrate to use for probing

' Define some constants
ZDRO = 2      ' Z Axis DRO
' Wait a few seconds for user to get touchplate in place
Code "G4 P2"
   
' Do the touch move
Code "G31 Z-0.5 F" & ProbeFeed

' Wait for it to complete
While IsMoving()
Wend

' Delay a bit
Code "G4 P0.25"

' Set Z DRO to touch plate thickness
Call SetDro (ZDRO, PlateThickness)

Code "G0 Z0.250"
   
' Tell user we're done
Code "(Z axis is now zeroed)"

Exit Sub

7
General Mach Discussion / Re: Touch Off Macro Half Works
« on: August 19, 2012, 06:40:51 PM »
Hood,

That is correct, I'm using the parallel port.

Thanks.
Greg

8
General Mach Discussion / Re: Touch Off Macro Half Works
« on: August 19, 2012, 06:02:08 PM »
Hood,

Yes, I believe the probe is being seen correctly by Mach.  On the diagnostics screen, the digitize LED lights up when the bit touches the plate.  Also, when executing the macro, the Z axis stops as soon as it touches the plate.  The code is also checking to see if the probe is already active when the macro starts, so I should have received a message to that effect if this were the case.

Thanks for your help.
Greg

9
General Mach Discussion / Touch Off Macro Half Works
« on: August 19, 2012, 01:44:53 PM »
I've got a touch off plate, but the software only half works.  By this I mean the tool comes down and stops when it touches the plate, but it does not then retract and it does not set the Z height.  Also, after running this macro I cannot manually jog the machine until I reset it.  Can someone point out what I'm doing wrong?  I "borrowed" this macro code from these forums (thanks to whomever wrote it).  The code seems OK to me.

Thanks.
Greg

Code: [Select]
'Tool Zero Setting Macro

' Change the following three lines to suit your machine
PlateThickness = GetOEMDRO(1001) ' Thickness of touch plate
RetractClearance = 0.100 ' Clearance above touch plate to retract to
ProbeFeed = 5      ' Feedrate to use for probing

' Define some constants
ZDRO = 2      ' Z Axis DRO
AbsoluteModeLED = 48   ' Absolute Coordinate Mode LED
IncrementalModeLED = 49   ' Incremental Coordinate Mode LED
FeedrateDRO = 818   ' OEM code for feedrate DRO
ProbeLED = 825      ' OEM code for probe input LED
ZTouchDRO = 2002   ' OEM code for DRO that holds Z touch position

' Do nothing if probe is already grounded
If GetOemLed(ProbeLED) = 0 Then

   ' Wait a few seconds for user to get touchplate in place
   Code "G4 P2"
   
   ' Save current feedrate
   CurrentFeed = GetOemDRO(FeedrateDRO)
   
   ' Save current coordinate mode
   AbsMode = GetOemLED(AbsoluteModeLED)

   ' Set absolute coordinate mode
   Code "G90"

   ' Zero Z DRO
   Call SetDro (ZDRO, 0.0000)

   ' Pause for DRO to update
   Code "G4 P0.5"

   ' Do the touch move
   Code "G31 Z-0.5 F" & ProbeFeed

   ' Wait for it to complete
   While IsMoving()
   Wend

   ' Delay a bit for Huh
   Code "G4 P0.25"

   ' Get the Z position where probe input triggered
   ZProbePos = GetVar(ZTouchDRO)

   ' Go back to touch position (G31 backs off after touch)
   Code "G0 Z" & ZProbePos

   ' Wait for it to complete
   While IsMoving ()
   Wend

   ' Set Z DRO to touch plate thickness
   Call SetDro (ZDRO, PlateThickness)

   ' Pause for DRO to update
   'Code "G4 P0.5"

   ' Retract Z to SafeZ, if enabled, else to RetractClearance above plate
   If(IsSafeZ() = 1) Then
      SafeZ = GetSafeZ
      If  SafeZ  > PlateThickness Then
         GotoSafeZ()
      End If
   Else
      RetractHeight = PlateThickness + RetractClearance
      Code "G0 Z" & RetractHeight
   End If
   
   ' Tell user we're done
   Code "(Z axis is now zeroed)"

   ' Reset feedrate to original value
   Code "F" & CurrentFeed
   
   ' Reset coordinate mode to original value
   If AbsMode = 0 Then
      Code "G91"
   End If
Else
   Code "(Z-Plate is grounded, check connection and try again)"
End If

Exit Sub

10
General Mach Discussion / Re: Need Help w/ Encoder Interface
« on: July 31, 2012, 11:34:44 AM »
I put these numbers in and still have the same behavior.  I left the A axis alone since I don't have a 4th axis and unchecked it's enable. 

Thanks for your efforts, I'm closer than before.
Greg

Pages: 1 2 »