Home
Downloads
Mach and LazyCam
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Known Bugs
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?
February 12, 2012, 09:15:47 AM
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
Modifing Operator Editable Button Macros
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: Modifing Operator Editable Button Macros (Read 1063 times)
0 Members and 1 Guest are viewing this topic.
airnocker
Active Member
Offline
Posts: 36
Modifing Operator Editable Button Macros
«
on:
July 11, 2010, 03:28:53 PM »
I'm using a licensed version of Mach3, Version R3.042.038.
I've searched the forum and Mach Customize wiki until I'm blue in the face, so now I must ask. I am familiar with MS VBA and have a modest amount of successful experience with it.
I've read the following as well: Mach3 V3.x Programmer Reference Draft v0.11a.pdf, VB-Script-Commands.pdf, VB Constants Signal Numbers,VB Standard DROs and do not find my answers within.
When writing new VB for say, the Auto Tool Zero button, there seems to be Mach3 specific VB commands in the form of subroutines that can be entered without the formal Cypress VB "Sub Main()", "End Sub" beginning and end syntax.
As an example:
Message( "Auto Zeroing Z..." )
If IsSuchSignal (54) Then
code "G31 Z-3 F20"
While IsMoving()
Wend
Call SetDRO( 2, .059 )
code "G1 Z1"
End If
Can these VB statements be used inside of the normal Cypress VB subroutine structure as well, with defined variables etc. for an Operator Editable OEM button?
Are there any guidelines, published within the forum or wiki for doing so?
Does Cypress VB or Mach3 VB support the use of Labels as would be used with a "Goto BadEnd" statement, where "BadEnd:" is the syntax used on a script line for the goto entry point?
Many thanks in advance,
Logged
airnocker
airnocker
Active Member
Offline
Posts: 36
Re: Modifing Operator Editable Button Macros
«
Reply #1 on:
July 13, 2010, 03:40:53 PM »
Ok, please, please...someone give me an answer to why this code generates a Syntax error when used for the Auto Tool Zero button macro.
Or at least tell me what I should do differently....
Sub XYZZeroMain
Dim ConfirmReady As String
Dim DoXY As String
ConfirmReady = AskTextQuestion("Confirm Touch plate circuit is grounded to bit (y/n).")
If ConfirmReady = "y" Then
Message "You entered " & ConfirmReady & "!"
Goto Start
Else Goto BadEnd
End If
Start:
DoXY = AskTextQuestion("Zero X and Y? (y/n)")
If DoXY = "y" then Goto XY
Else Goto Z:
End If
XY:
Message( "Auto Zeroing X..." )
If IsSuchSignal (22) Then
code "G31 X-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 0, .0625 )
code "G1 X.5"
End If
Message( "Auto Zeroing Y..." )
If IsSuchSignal (22) Then
code "G31 Y-1 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 1, .0625 )
code "G1 Y.5"
End If
Z:
Message( "Auto Zeroing Z..." )
If IsSuchSignal (22) Then
code "G31 Z-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 2, .059 )
code "G1 Z1"
End If
Goto GoodEnd
BadEnd:
Message ("Tool zeroing aborted." Try again")
Goto Done
GoodEnd:
Message "Tool zeroing complete."
Done:
End Sub
Thanks
Logged
airnocker
airnocker
Active Member
Offline
Posts: 36
Re: Modifing Operator Editable Button Macros
«
Reply #2 on:
July 13, 2010, 06:09:58 PM »
I think I found the answer to my question above here:
http://www.machsupport.com/MachCustomizeWiki/index.php?title=Communications_Routes
under VB Script Programs.
Ok, so the latest version of Mach3 only supports a very small subset of Cypress VB so the use of GoTo statements and jump labels won't currently work.
So maybe in Mach4 as indicated in other posts herein we will see the more robust implementation of a VB interpreter, we hope, we hope, we hope!
Logged
airnocker
BR549
Active Member
Offline
Posts: 2,254
Re: Modifing Operator Editable Button Macros
«
Reply #3 on:
July 13, 2010, 07:20:20 PM »
SUre they work, use them all the time.
(;-)
Logged
airnocker
Active Member
Offline
Posts: 36
Re: Modifing Operator Editable Button Macros
«
Reply #4 on:
July 13, 2010, 07:36:31 PM »
BR,
That's very good to hear, so maybe you can suggest why after I load my M1s file shown in the above thread of mine, into the editor for the AutoTool Zero button and try to single step through the code I always get a syntax error that either highlights the "GoTo" line(s) or the label reference(s) but only one is every highlighted.
I'd really like to figure this out.
Thanks.
Logged
airnocker
BR549
Active Member
Offline
Posts: 2,254
Re: Modifing Operator Editable Button Macros
«
Reply #5 on:
July 13, 2010, 07:57:21 PM »
I have not studied it but it at least will run like this:
Sub Main()
Dim ConfirmReady As String
Dim DoXY As String
ConfirmReady = AskTextQuestion("Confirm Touch plate circuit is grounded to bit (y/n).")
If ConfirmReady = "y" Then GoTo 1 Else GoTo 4
1:
Message "You entered " & ConfirmReady & "!"
DoXY = AskTextQuestion("Zero X and Y? (y/n)")
If DoXY = "y" Then GoTo 2 Else GoTo 3
2:
Message( "Auto Zeroing X..." )
If IsSuchSignal (22) Then
code "G31 X-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 0, .0625 )
code "G1 X.5"
End If
Message( "Auto Zeroing Y..." )
If IsSuchSignal (22) Then
code "G31 Y-1 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 1, .0625 )
code "G1 Y.5"
End If
3:
Message( "Auto Zeroing Z..." )
If IsSuchSignal (22) Then
code "G31 Z-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 2, .059 )
code "G1 Z1"
End If
GoTo 5
4:
Message ("Tool zeroing aborted Try again")
GoTo 6
5:
Message "Tool zeroing complete."
6:
End Sub
end
Logged
airnocker
Active Member
Offline
Posts: 36
Re: Modifing Operator Editable Button Macros
«
Reply #6 on:
July 13, 2010, 07:59:31 PM »
Ooooooooooh, cool, so maybe it only likes numeric labels. I'll give it a try and report back.
Thanks BR
Logged
airnocker
airnocker
Active Member
Offline
Posts: 36
Re: Modifing Operator Editable Button Macros
«
Reply #7 on:
July 13, 2010, 08:15:30 PM »
Many thanks BR.
The code runs perfectly with the numeric labels, hurray!
Logged
airnocker
BR549
Active Member
Offline
Posts: 2,254
Re: Modifing Operator Editable Button Macros
«
Reply #8 on:
July 13, 2010, 08:20:12 PM »
Glad you got it working, I love it when a plan comes together and chips fly. (;-)
Logged
airnocker
Active Member
Offline
Posts: 36
Re: Modifing Operator Editable Button Macros
«
Reply #9 on:
July 27, 2010, 05:47:51 PM »
For those who may have been following this post, here is the final version of my X,Y & Z Auto Tool Zero Macro. The macro asks for user input in the following sequence:
1. to confirm touch plate clips are connected otherwise exit
2. to zero X & Y? otherwise skip to zero Z
3. to confirm z touch plate is in position otherwise exit
The code is currently written to expect a tool or reference bit diameter of .125" and a 90 degree piece of 1/8" x 1 1/8" angle aluminum.
The inside faces of the aluminum angle have 1/16" copper clad circuit board super glued to them for better touch conductivity. See photo.
The angle aluminum is stood on end with the copper faced, inside angle held against the corner of the work piece that will become the 0,0 XY reference.
An interim "manual" XY zero is set so that the bit used to touch for the XY zeroing operation will be centered on each corresponding copper face. For my table the XY direction from "interim zero" toward the touch plate is in the negative direction.
An interim "manual" Z zero is set so that the bottom of the bit is about 1/2" to 1" above the work piece. For my table Z travel down is a negative direction.
The XY zeroing is consecutive without stopping.
The Z confirmation dialogue is to provide a "pause" to reposition the angle aluminum on a flat side on top of the work piece and possibly change to a different bit and set a new interim Z zero as described above, or exit
I've been very pleased with how this has worked for me.
Sub Main()
Dim ConfirmReady As String
Dim DoXY As String
Dim DoZ As String
ConfirmReady = AskTextQuestion("Confirm Touch plate leads are connected and ready. (y/n)")
If ConfirmReady = "y" Then GoTo 1 Else GoTo 5
1:
DoXY = AskTextQuestion("Zero X and Y also? (y/n)")
If DoXY = "y" Then GoTo 2 Else GoTo 3
2:
Message( "Auto Zeroing X..." )
If IsSuchSignal (22) Then
code "G31 X-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 0, .0625 )
code "G1 X.5"
End If
Message( "Auto Zeroing Y..." )
If IsSuchSignal (22) Then
code "G31 Y-1 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 1, .0625 )
code "G1 Y.5"
End If
3:
DoZ = AskTextQuestion("Position the touch plate to zero Z. y to continue or n to skip. (y/n)")
If DoZ = "y" Then GoTo 4 Else GoTo 6
4:
Message( "Auto Zeroing Z..." )
If IsSuchSignal (22) Then
code "G31 Z-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetDRO( 2, .180 )
code "G1 Z1"
End If
GoTo 6
5:
Message ("Tool zeroing aborted. Try again when ready.")
GoTo 7
6:
Message "Tool zeroing complete. Check the results on the DROs."
7:
End Sub
End
TouchPlate-1s.JPG
(98.92 KB, 800x600 - viewed 53 times.)
Logged
airnocker
Pages:
1
2
»
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
=> 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.
Loading...