Home
Downloads
Mach and LazyCam
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
German Forum
Italian Forum
Portugese Forum
Resources
Links
User Reviews
User Videos
Contact Us
CNCZone
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
December 02, 2008, 10:02:11 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
Can you assign G code to a button?
Pages:
1
Go Down
« previous
next »
Author
Topic: Can you assign G code to a button? (Read 913 times)
0 Members and 1 Guest are viewing this topic.
FVMC shop
Active Member
Offline
Posts: 3
Can you assign G code to a button?
«
on:
July 01, 2008, 06:57:50 AM »
I would like to have several buttons on my Mach screen assigned to various G codes I have written. I know the button editor allows you to execute G code however you can only have 1 line and my codes are much longer.
I want to load a complete cabinet or countertop program (Subroutines and all) with the click of a button into Mach 3 so I don’t have to browses for different files with the load G code button. I don’t want it to start running I just want to load it.
I know nothing of VB but have been trying to figure out how to do this. I found some code on line, I can paste this in the button editor to view the contents of a text file but I can’t load it into Mach. Any help would be greatly appreciated.
'Declare variables.
Dim fso
Dim ts
Dim fileText
Dim ForReading, ForWriting, ForAppending
'You can just use the numbers 1,2, and 8
ForReading = 1
ForWriting = 2
ForAppending = 8
'Create file sys object
Set fso = CreateObject("Scripting.FileSystemObject")
'Open file. using ForReading (or just use 1)
Set ts = fso.OpenTextFile("C:\Test\Test.txt", ForReading, True)
'Loop while not at the end of the file.
Do While Not ts.AtEndOfStream
fileText = fileText & ts.ReadLine
Loop
'Close the file.
ts.Close
'Clean up
Set fso = Nothing
Set ts = Nothing
'Display what the file has in it
MsgBox fileText
Logged
ger21
Global Moderator
Online
Posts: 427
Re: Can you assign G code to a button?
«
Reply #1 on:
July 01, 2008, 10:17:19 AM »
Using VB script, use:
code "G0 X1 Y1"
code "G1 Z-.25"
code " G1 Xx Yy"
And on and on.....
Logged
Gerry
poppabear
S S SYSTEMS, LLC
Global Moderator
Online
Posts: 770
Briceville, TN, USA
Re: Can you assign G code to a button?
«
Reply #2 on:
July 01, 2008, 10:49:12 AM »
Put this in your "Loadcode buttons"
You can have several buttons that load code for you this way, you push the button and it loads the G-code of the file that is in that path.
If you want to "Reuse" your buttons you could name, button 1's TAP file "Button1", button 2's file could call Button2.tap, etc.
That way with your CAD/CAM, you could write any Code Changes to those buttons directly without changing what is in your screen set.
So if you wrote part #1 as file: "Button1.TAP" when you hit button "1" it would load that part file, if later you wanted to change what "Part 1" is, (modify it, make a whole new part, whatever), you could just save, and rename your OLD Button1 (if you wanted to keep it), and then post out your CAM to a new part file called button1, save it in the same place that your old buttton1 was, and when you hit button1, it would load your new file.......................
In screen designer, make a cutom button call it, Button1, and this is the VB that goes into it.
Loadfile("C:\CNC-parts-Files\Button1.TAP")
Here is the code inside Button2
Loadfile("C:\CNC-parts-Files\Button2.TAP")
as you can see, you can have as many of these quick call buttons as you want, also you can change the code they load by overwriting the file they call with your new file calling it the same name as the old. Very versitile.
Also, IF you want to get really fancey, you can use the OpenTeachFile, OpenSubroutineFile, AppendTeachFile, and CloseTeachFile(), and LoadTeachFile() functions to customize files and subroutines............
Scott
«
Last Edit: July 01, 2008, 10:57:05 AM by poppabear
»
Logged
All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
FVMC shop
Active Member
Offline
Posts: 3
Re: Can you assign G code to a button?
«
Reply #3 on:
July 01, 2008, 02:20:08 PM »
Hey thanks poppabear that worked flawlessly, I know you have read this a million times but it's guys like you helping out the rest of us that really make a difference on the forums. Keep up the good work and hopefully I can learn enough to help out on here someday.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Online
Posts: 770
Briceville, TN, USA
Re: Can you assign G code to a button?
«
Reply #4 on:
July 01, 2008, 03:07:17 PM »
Thank you, for the Thank you,..............sir,
scott
Logged
All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
Chaoticone
South Carolina, US
Administrator
Online
Posts: 2,812
Precision Chaos
Re: Can you assign G code to a button?
«
Reply #5 on:
July 01, 2008, 03:43:47 PM »
Yup, thanks Scott, good job.
Brett
Logged
If you could see the things I have in my head, you would be laughing too.
www.precisionchaos1.com
My guard dog is not what you need to worry about!
budman68
Master of the Custodial Arts better known as:
Global Moderator
Online
Posts: 616
Re: Can you assign G code to a button?
«
Reply #6 on:
July 01, 2008, 04:27:02 PM »
The man's a genuine machine -
Logged
----------------------------------------------------------------------
Dave->
poppabear
S S SYSTEMS, LLC
Global Moderator
Online
Posts: 770
Briceville, TN, USA
Re: Can you assign G code to a button?
«
Reply #7 on:
July 07, 2008, 01:14:20 PM »
FVMC:
For fun, I did a "Quicky" Mod to one of my router screens, that you could adapt to your use as well.
This Screen will be a "Part counter" that can run User G code defined number of parts, or, a manual override for number of runs.
I.e. If you want 3 "Cabinet Doors" (see G code below), the G-Code format also gives your operator Part/Job info"
So copy the "PartsCounter.set" to your main Mach3 directory.
Copy the M1000, and M1001 to the macro folder under the profile of the machine your running.
The button that says Manual PartCnt OVR ON (will select if your G code runs the part count, or the operator).
I.e. If you want 3 runs, once the operator hits cycle start, once it runs the G code 3 times, on the 4th run (it has to hit the M1000 again), it will stop the machine and give a message that the parts run is finished. (this is useful, for large part runs to keep count).
For instance the G code below "Button1.TAP":
(CDS #4, run 8, J#678) 'this message shows in your Status line, translation: CDS= Cabinet Door Style #4, Run this many 8, J# is the Job tracking number
#1=3 'Parameter #1, is the parameter you use to pass the number of runs you want
M1000 'M1000 this will HAVE to come after the parameter, and before your Code Starts
g0 x1 'tool path code
g0 x0 'tool path code
M1001 'companion counter code, has to be right before your M30
m30
The Screen set, and the above two macros are attached below....
Scott
PartsCounter.set
(123.94 KB - downloaded 36 times.)
M1000.m1s
(1.52 KB - downloaded 32 times.)
M1001.m1s
(0.63 KB - downloaded 34 times.)
Logged
All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
FVMC shop
Active Member
Offline
Posts: 3
Re: Can you assign G code to a button?
«
Reply #8 on:
July 07, 2008, 01:47:33 PM »
You have a strange way of having fun! :-)
thanks I will load the page up and take a look.
Question: Have you ever had Mach3 just flip out? As an example, I run the same cabinet program 3 times in a row then on the 4th run it just decides to make a couple random circles then drop the bit. Or it looses it's offset in the middle of the run. restart the computer and Mach and everything runs fine again. any thoughts?
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Online
Posts: 770
Briceville, TN, USA
Re: Can you assign G code to a button?
«
Reply #9 on:
July 07, 2008, 09:18:16 PM »
clueless here, never had that happen to me.
scott
Logged
All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
Pages:
1
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.
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*e*i*n*g
=> Mach Screens
=> Feature Requests
=> Non English Forums
=> FAQs
===> Finished Plugins for Download
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
-----------------------------
*****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
=> Lazy Cam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> dspMC/IP motion controller
=> Third party software and hardware support forums.
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Promote and discuss your product .
=> Sieg Machines
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
=> One on one phone support.
=> Forum suggestions and report forum problems.
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
Loading...