Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 24, 2012, 12:11:19 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
How do I get my X, Y, and Z axis DROs to reset in this script?
Pages:
1
2
3
»
Go Down
« previous
next »
Author
Topic: How do I get my X, Y, and Z axis DROs to reset in this script? (Read 3368 times)
0 Members and 1 Guest are viewing this topic.
agauger
Active Member
Offline
Posts: 18
How do I get my X, Y, and Z axis DROs to reset in this script?
«
on:
May 10, 2009, 12:18:57 PM »
This script centers my end mill on the part to set up for a perfectly centered slot to be cut along the X axis.
I
t does 4 things...
1) It probes down to the top (Z axis) of the part and records this position
2) It probes over to the front and back of the part (Y axis), records the position of each
3) It probes over to the left and right of the part (X axis), records the position of each
4) It moves the Z axis so it just touches the top of the part, the Y axis to the middle of the part, and the X axis to the middle of the part
Once the script completes, I manually reset the X, Y, and Z DROs and run my G-Code which cuts the slot in the parts.
I've never been able to successfully add a function to the script that will reset the X, Y, and Z DROs automatically upon completion. You can see my attempt below but it does not reset any of the DROs. Can someone suggest the appropriate command to accomplish this?
Thank you,
-Aaron
Code:
Rem
VBScript To center mill On quick relase handle In preparation For slot cutting
If GetOemLed (825) <> 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 "F2"
'slow feed rate to 2 ipm
Rem
Probe Down
ZNew = Zcurrent - 1
'set scan to top edge of part - up to 1 inch of travel
Code "G31 Z" &ZNew
'move down to scan for top edge
While IsMoving()
'wait for the move to finish
Wend
ZTop = GetVar(2002)
'get the probe touch location
Code "G0 Z" &ZTop + .25
'rapid move .25 inches above part surface
Code "G0 Y" &YCurrent + .75
'Move to far end of part for next scan start point
Code "G0 Z" &ZTop - .1
'Move down to .1 inches below part top edge
Rem
Probe foward
Code "G31 Y" &YCurrent
'Scan back edge
While IsMoving()
Wend
YPos1 = GetVar(2001)
'Record back edge position
Code "G0 Y" &YPos1 + .25
'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25
'Move up to .25 above part surface
Code "G0 Y" &YPos1 - 1.25
'Move 1.25 inches to front edge of part
Code "G0 Z" &ZTop - .1
'Move down to .1 inches below part top edge
Rem
Probe backward
Code "G31 Y" &YPos1
'Scan for front edge of part
While IsMoving()
Wend
YPos2 = GetVar(2001)
'record front edge of part
YCenter = (YPos1 + YPos2) / 2
'calculate Y axis center
Code "G0 Y" &YPos2 - .25
'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25
'Move .25 inches above part surface
Rem
move To the center
Code "G0 Y" &YCenter
'Move to Y axis center location
Code "G0 X" &XCurrent + .825
'Move 1 inch to right for right edge of part probe
Code "G0 Z" &ZTop - .4
'Move down to .4 inches below part top edge
Rem
Probe Left
Code "G31 X" &XCurrent - 1.5
'Move into left edge of part to determine right edge
While IsMoving()
'wait for the move to finish
Wend
XPos1 = GetVar(2000)
'record location of right edge of part
Code "G0 X" &XPos1 + .25
'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25
'Move up to .25 invhrd sbovr part surface
Code "G0 X" &XPos1 - 1.25
'Move 1.5 inches left side of part
Code "G0 Z" &ZTop - .4
'Move down to .4 inches below part top edge
Rem
Probe Right
Code "G31 X" &XPos1 + 1.5
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2) / 2
'center is midway between XPos1 and XPos2
Code "G0 X" &XPos2 - .25
'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25
'Move .25 inches above part surface
Code "G0 X" &XCenter
'rapid move to the x center location
Code "G0 Z" &ZTop
'Place mill at 0 Z height
Code "F" &FeedCurrent
'restore starting feed rate
Rem
Reset DROs
Call SetDro (0,0.00)
'reset X axis DRO
Call SetDro (1,0.00)
'reset Y axis DRO
Call SetDro (2,0.00)
'reset Z axis DRO
End If
Logged
MachineMaster
Active Member
Offline
Posts: 151
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #1 on:
May 10, 2009, 09:51:00 PM »
Change
Call SetDro (0,0.00) 'reset X axis DRO
Call SetDro (1,0.00) 'reset Y axis DRO
Call SetDro (2,0.00) 'reset Z axis DRO
to
SetMachZero(0)
SetMachZero(1)
SetMachZero(2)
Darrell
Logged
Teyber
Active Member
Offline
Posts: 7
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #2 on:
May 10, 2009, 11:37:42 PM »
sorry NOOB here.
what language is this?
Logged
MachineMaster
Active Member
Offline
Posts: 151
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #3 on:
May 11, 2009, 01:04:32 AM »
A version of visual basic supported in Mach3
Logged
agauger
Active Member
Offline
Posts: 18
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #4 on:
May 11, 2009, 06:13:14 PM »
Well I made the suggested change but the DROs still do not reset after the script completes the probe points.
Any other thoughts or suggestions?
Thanks,
-Aaron
Code:
Rem
VBScript To center mill On quick relase handle In preparation For slot cutting
If GetOemLed (825) <> 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 "F2"
'slow feed rate to 2 ipm
Rem
Probe Down
ZNew = Zcurrent - 1
'set scan to top edge of part - up to 1 inch of travel
Code "G31 Z" &ZNew
'move down to scan for top edge
While IsMoving()
'wait for the move to finish
Wend
ZTop = GetVar(2002)
'get the probe touch location
Code "G0 Z" &ZTop + .25
'rapid move .25 inches above part surface
Code "G0 Y" &YCurrent + .75
'Move to far end of part for next scan start point
Code "G0 Z" &ZTop - .1
'Move down to .1 inches below part top edge
Rem
Probe foward
Code "G31 Y" &YCurrent
'Scan back edge
While IsMoving()
Wend
YPos1 = GetVar(2001)
'Record back edge position
Code "G0 Y" &YPos1 + .25
'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25
'Move up to .25 above part surface
Code "G0 Y" &YPos1 - 1.25
'Move 1.25 inches to front edge of part
Code "G0 Z" &ZTop - .1
'Move down to .1 inches below part top edge
Rem
Probe backward
Code "G31 Y" &YPos1
'Scan for front edge of part
While IsMoving()
Wend
YPos2 = GetVar(2001)
'record front edge of part
YCenter = (YPos1 + YPos2) / 2
'calculate Y axis center
Code "G0 Y" &YPos2 - .25
'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25
'Move .25 inches above part surface
Rem
move To the center
Code "G0 Y" &YCenter
'Move to Y axis center location
Code "G0 X" &XCurrent + .825
'Move 1 inch to right for right edge of part probe
Code "G0 Z" &ZTop - .4
'Move down to .4 inches below part top edge
Rem
Probe Left
Code "G31 X" &XCurrent - 1.5
'Move into left edge of part to determine right edge
While IsMoving()
'wait for the move to finish
Wend
XPos1 = GetVar(2000)
'record location of right edge of part
Code "G0 X" &XPos1 + .25
'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25
'Move up to .25 invhrd sbovr part surface
Code "G0 X" &XPos1 - 1.25
'Move 1.5 inches left side of part
Code "G0 Z" &ZTop - .4
'Move down to .4 inches below part top edge
Rem
Probe Right
Code "G31 X" &XPos1 + 1.5
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2) / 2
'center is midway between XPos1 and XPos2
Code "G0 X" &XPos2 - .25
'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25
'Move .25 inches above part surface
Code "G0 X" &XCenter
'rapid move to the x center location
Code "G0 Z" &ZTop
'Place mill at 0 Z height
Code "F" &FeedCurrent
'restore starting feed rate
Rem
Reset DROs
SetMachZero(0) 'reset X axis DRO
SetMachZero(1) 'reset Y axis DRO
SetMachZero(2) 'reset Z axis DRO
End If
Logged
MachineMaster
Active Member
Offline
Posts: 151
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #5 on:
May 11, 2009, 08:30:52 PM »
Well I know that
SetMachZero(0) 'reset X axis DRO
SetMachZero(1) 'reset Y axis DRO
SetMachZero(2) 'reset Z axis DRO
Does reset the machine coordinates to zero for X, Y & Z.
Try putting it in a separate macro and call it after your script before milling the slot.
Logged
vmax549
Guest
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #6 on:
May 13, 2009, 08:25:55 AM »
SetMachZero(0) is ONLY used to reset the axis(0) MACHINE COOR DRO to zero. IT cannot set to a value and it only sets the machine COOR position dro. NOW that does effect the value in the USER COOR base but only because you changed the MachineDRO.
SetDRO(0,0.000) WORKS here
(;-) TP
Logged
agauger
Active Member
Offline
Posts: 18
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #7 on:
May 13, 2009, 09:55:58 PM »
Ok, the SetDRO (0,0) command does work… almost.
Turns out I was changing the wrong script, thus my changes were not taking affect.
What happens is that I’ve included the SetDRO (0,0) command to run at the end of the script just before the command that restores the original federate. This does work but does not actually change all the DROs to zero. Thinking these problems may have been caused by the script executing the reset commands too quickly, I added a pause command (code “G04 p.5”) between them to give each time to reset before resetting the next DRO. This did not have any affect other then adding a half second between DRO changes.
Here is what happens…
The X axis DRO is changed to +0.6105
The Y axis DRO is changed to +0.0000
The Z axis DRO is changed to +0.4000
I do not know where these figures came from. I moved each axis to a different position and re-ran the script and those same numbers again appear once the SetDRO (0,0), SetDRO (1,0), and SetDRO (2,0) commands are executed in the script.
Any clue why this behavior is occurring? I’m very close to getting everything to function correctly.
Thanks for the responses thus far, they’ve been very helpful!
-Aaron
Code:
Rem
VBScript To center mill On quick relase handle In preparation For slot cutting
If GetOemLed (825) <> 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 "F2"
'slow feed rate to 2 ipm
Rem
Probe Down
ZNew = Zcurrent - 1
'set scan to top edge of part - up to 1 inch of travel
Code "G31 Z" &ZNew
'move down to scan for top edge
While IsMoving()
'wait for the move to finish
Wend
ZTop = GetVar(2002)
'get the probe touch location
Code "G0 Z" &ZTop + .25
'rapid move .25 inches above part surface
Code "G0 Y" &YCurrent + .75
'Move to far end of part for next scan start point
Code "G0 Z" &ZTop - .1
'Move down to .1 inches below part top edge
Rem
Probe foward
Code "G31 Y" &YCurrent
'Scan back edge
While IsMoving()
Wend
YPos1 = GetVar(2001)
'Record back edge position
Code "G0 Y" &YPos1 + .25
'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25
'Move up to .25 above part surface
Code "G0 Y" &YPos1 - 1.25
'Move 1.25 inches to front edge of part
Code "G0 Z" &ZTop - .1
'Move down to .1 inches below part top edge
Rem
Probe backward
Code "G31 Y" &YPos1
'Scan for front edge of part
While IsMoving()
Wend
YPos2 = GetVar(2001)
'record front edge of part
YCenter = (YPos1 + YPos2) / 2
'calculate Y axis center
Code "G0 Y" &YPos2 - .25
'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25
'Move .25 inches above part surface
Rem
move To the center
Code "G0 Y" &YCenter
'Move to Y axis center location
Code "G0 X" &XCurrent + .825
'Move 1 inch to right for right edge of part probe
Code "G0 Z" &ZTop - .4
'Move down to .4 inches below part top edge
Rem
Probe Left
Code "G31 X" &XCurrent - 1.5
'Move into left edge of part to determine right edge
While IsMoving()
'wait for the move to finish
Wend
XPos1 = GetVar(2000)
'record location of right edge of part
Code "G0 X" &XPos1 + .25
'Move .25 inches away from last scanned edge
Code "G0 Z" &ZTop +.25
'Move up to .25 invhrd sbovr part surface
Code "G0 X" &XPos1 - 1.25
'Move 1.5 inches left side of part
Code "G0 Z" &ZTop - .4
'Move down to .4 inches below part top edge
Rem
Probe Right
Code "G31 X" &XPos1 + 1.5
While IsMoving()
Wend
XPos2 = GetVar(2000)
XCenter = (XPos1 + XPos2) / 2
'center is midway between XPos1 and XPos2
Code "G0 X" &XPos2 - .25
'Move .25 inches away from from edge of part
Code "G0 Z" &ZTop + .25
'Move .25 inches above part surface
Code "G0 X" &XCenter
'rapid move to the x center location
Code "G0 Z" &ZTop
'Place mill at 0 Z height
Rem
Reset DROs
SetDro (0,0.00)
'reset X axis DRO
Code "G04 P.5" 'pause .5 seconds
SetDro (1,0.00)
'reset Y axis DRO
Code "G04 P.5" 'pause .5 seconds
SetDro (2,0.00)
'reset Z axis DRO
Code "G04 P.5" 'pause .5 seconds
Code "F" &FeedCurrent
'restore starting feed rate
End If
Logged
agauger
Active Member
Offline
Posts: 18
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #8 on:
May 14, 2009, 05:22:39 AM »
Also tried the SetOEMDRO(800,0) function as well - with the same result. Do the reset buttons for the X, Y, and Z axis have a OEM value that I could call from the script? I need a command within the script that has the exact affect as pressing each of these buttons.
I am using the MachBlue screen set.
Logged
vmax549
Guest
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
«
Reply #9 on:
May 14, 2009, 08:25:50 AM »
HI Arrron, WHat version of mach are you using? WHat you are seeing is a CLUE to what I have been chasing for a while. The fact that the values stayed the same even afer a positional change is a NEW clue/INFO (;-)
IF all else fails try reloading MACH and try again. I would be interested to see IF that fixed it for a while.
I have seen what you described and the only way to fix it so far is to reload mach.
HERE the setdro() works just fine without error.
Just a thought, (;-) TP
«
Last Edit: May 14, 2009, 08:30:24 AM by vmax549
»
Logged
Pages:
1
2
3
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...