Hello Guest it is March 31, 2023, 02:23:56 PM

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 - MachineMaster

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
141
VB and the development of wizards / Re: VB and variables in G code
« on: March 18, 2009, 01:54:10 AM »
Thank you. The tip about the persistent variables is great. Now I can do away with the variables at the beginning of the G code and set the new variables to what I want with another macro that I wrote just for that. I just bring it up in the VB assistant, enter what I want and run the macro right in the assistant.
Now I can end the main program with an M30 and not have my variables over written.
Again, Thank you

142
VB and the development of wizards / Re: VB and variables in G code
« on: March 17, 2009, 08:49:32 PM »
OK, I have changed some of the G code near the end of the file as follows

G00X-0.065Y-0.025
M98 P#100

G00X-0.13Y-0.025
M98 P#10

G00X-0.20Y-0.025
M98 P#1

M950                    (This is the macro that I wrote. See below)
G92.1
M05
G00 G90 X0 Y0 Z0
M01
M98 P200

M02


 O0
G00 Z0.01
G91
G00 X-0.0424 Y-0.0229
F12.0
G90

Macro
a = GetVar (1)
Print a
b = GetVar(10)
Print b
c = GetVar(100)
Print c
d = GetVar(1000)
Print d

a = a+1
If a = 10 Then a = 0
If a = 0 Then b = b + 1
SetVar 1, a
Print a
If b = 10 Then b = 0
If b = 0 Then c = c+1
SetVar 10, b
Print b
If c = 10 Then c = 0
If c = 0 Then d = d+1
SetVar 100, c
Print c
If d = 10 Then d = 0
SetVar 1000, d
Print d

I put the print statements in to see what was happening and it runs fine when called but in the VB assist window it prints the values.

143
VB and the development of wizards / Re: VB and variables in G code
« on: March 16, 2009, 09:12:17 PM »
This is what I was thinking. I have these variables in the beginning of the program

N10 G90G40
#1000 = 2.       (thousands starting digit)
#100 = 2.         (hundreds starting digit)
#10 = 5.           (tens starting digit)
#1 = 9.            (ones starting digit)
#1210 = 0.       (month tens digit)
#1201 = 1.       (month ones digit)
#2010 = 0.       (year tens digit)
#2001 = 9.       (year ones digit)
T25 M06
 
This engraves  the following

01092259

as the serial number. I am only incrementing the last four numbers. My G code as I have it so far will do that one number using the following

G90G00X0.2500Y-0.0250
M98 P#1210

G00X0.185Y-0.025
M98 P#1201

G00X0.125Y-0.025
M98 P#2010

G00X0.06Y-0.025
M98 P#2001

G90G00X0.00Y-0.025
M98 P#1000

G00X-0.065Y-0.025
M98 P#100

G00X-0.13Y-0.025
M98 P#10

G00X-0.20Y-0.025
M98 P#1

M995                    (This is the macro that I need to write to do the increment)

 O0
G00 Z0.01
G91
G00 X-0.0424 Y-0.0229
F12.0
G90
G01 Z-0.0030 F8.0
G91 G02 X0.0358 Y0. I0.0179 J0. F12.0
G01 Y-0.0293
G02 X-0.0358 Y0. I-0.0179 J0.
G01 Y0.0293
G90 G00 Z0.01
M99
 
O1
G90 G00 Z0.01
G91 G00 X-0.0076 Y-0.0574
G90 G01 Z-0.0030 F8.0
G91 G01 X-0.0126 Y-0.0126 F12.0
G01 Y0.065
G90 G00 Z0.01
G91 G00 X0.0152
G01 G90 Z-0.0030 F8.0
G01 G91 X-0.0309 F12.0
G90 G00 Z0.01
M99

I only included code for two numbers. What I want to do is use the M950 to read #1, #10, #100 and #1000 and increment as needed
and return them to the program. Is that possible?

144
VB and the development of wizards / Re: VB and variables in G code
« on: March 16, 2009, 03:44:05 PM »
Thank you. That should give me a good place to start.
My plan is to keep all of the G code in the main program and just do the logic in the macro.
That way I should be able to do away with the processor load of the

While IsMoving()
Wend

statement.
I see the one increment at the end of the first Sub main, but I am still missing how this works.
How do you call the macro? Where are you doing the position moves?

145
VB and the development of wizards / Re: VB and variables in G code
« on: March 16, 2009, 01:02:01 PM »
Thank you. I would really appreciate that. Often all I need is a good example.

146
VB and the development of wizards / Re: VB and variables in G code
« on: March 16, 2009, 02:53:31 AM »
Is there a tutorial on macro programming? Is the VB Script Editor where you build a macro? I have been looking at the Wiki and all of the PDF files on the Mach site and am still lost.

147
VB and the development of wizards / Re: VB and variables in G code
« on: March 15, 2009, 07:10:12 PM »
I have been studying the "Mach Script Language Reference" and have looked at the Script editing window but I am still at a loss as to how to put it all together for what I need.
The code snip that I posted above was easy to convert to Mach type code using #100=2. etc. but the part I didn't show like the following is what has me stumped. I have eight sections like the following

%MONE:
%NUM = 4.
G00X0.185Y-0.025
IF %MONES EQ 0. GOTO %ZEROZ
IF %MONES EQ 1. GOTO %ONEO
IF %MONES EQ 2. GOTO %TWOT
IF %MONES EQ 3. GOTO %THREET
IF %MONES EQ 4. GOTO %FOURF
IF %MONES EQ 5. GOTO %FIVEF
IF %MONES EQ 6. GOTO %SIXS
IF %MONES EQ 7. GOTO %SEVENS
IF %MONES EQ 8. GOTO %EIGHTE
IF %MONES EQ 9. GOTO %NINEN
M02

and if %MONES = 6 I need to jump to the following code

%SIXS:
G90 G00 Z0.01
G91 G00 X-0.0378 Y-0.07
G90 G01 Z-0.0030 F%ZFD
G91 G03 X0.0327 Y0.046 I-0.0137 J0.0445 F%FD
G03 X-0.038 Y0. I-0.019 J0.
G03 X0.038 Y0. I0.0191 J0.
G90 G00 Z0.01
IF %NUM EQ 2. GOTO %MONE
IF %NUM EQ 4. GOTO %YTEN
IF %NUM EQ 6. GOTO %YONE
IF %NUM EQ 8. GOTO %INCA
IF %NUM EQ 10. GOTO %NUMC
IF %NUM EQ 12. GOTO %NUMB
IF %NUM EQ 14. GOTO %NUMA
GOTO %START

which will engrave a 6 and then either jump to another section of code or return to START depending on the value of %NUM.

Using IF and GOTO in this manner allows the program to engrave sequential serial numbers for each part.

Where does VB come into the picture? Do I write VB code in the G code file or is it used some where else?

148
VB and the development of wizards / VB and variables in G code
« on: February 25, 2009, 07:14:18 PM »
I have been looking at MACH3 and testing it on a BOSS 5 mill. So far it has been quite good. I have been running the mill with AHHA software for the last ten years but they are no longer around and I need something to replace it with for when it does fail.
My only problem is that I use variables and parametric code in my G code to do things that would either take many pages of G code or not be possible in G code.
An example would be

; ENGRAVE TIP
M01 L09
N10 G90G75G40 S1200
%THOUS = 1.  * ; THOUSANDS
%HUNDS = 5.  * ; HUNDREDS
%TENS = 2.  * ; TENS
%ONES = 5.  * ; ONES
%MTENS = 0.  * ; MONTH TENS
%MONES = 3.  * ; MONTH ONES
%YTENS = 0.  * ; YEAR TENS
%YONES = 5.  * ; YEAR ONES
T25 M06
%START:
M05
%ZFD=10.0
%FD=8.0
G54
G90 G49
G00 X0 Y0 Z0
M01 L01 ;PUT IN CORRECT L #
;
;
; INSERT ANY OTHER ROUTINE HERE
; NOTE Z AXIS PARAMETERS ARE ZERO = WORK SURFACE
; Z CLEAR IS +0.01. ANY FILE INSERTED HERE WILL RUN THEN
; MOVE TO A TOOL CHANGE POSITION, PAUSE TO MOVE THE PART, DRILL A
; HOLE, CHANGE TOOLS, DO THE ENGRAVING, FOUR NUMBERS WILL BE OUTPUT
; AND THE PROGRAM WILL RETURN TO START AND PAUSE.
;

This is the beginning of a program that engraves a serial number on a part. The program increments the serial number for each part.
Without variables there is no way to run the serial number part of the program.
Can this be done with VB?

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15