Hello Guest it is April 19, 2024, 05:15:38 PM

Author Topic: Looping in VB?  (Read 3241 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarak

*
  •  229 229
    • View Profile
Looping in VB?
« on: September 16, 2007, 03:22:42 AM »
I've created a g code program that works really well for me, in my effort to make it more user friendly/idiot proof, I've made one of the screens have DRO's for all the variables.
How do I go about telling a certain part of the program to loop so many times in VB?
I've tried quite few different thing but I can't quite get it to work.
Thanks

This is part of my G code program that works:

#2=20 ;Length of groove
#3=6   ;No of Passes
M98 P1 L#3
M30

O1
G90 X0.
G91 G1 X#2
G0 Z10.
X[#2-[#2*2]]
Z-11.
M99

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Looping in VB?
« Reply #1 on: September 16, 2007, 11:21:12 AM »
'Darc

'1). make a length of groove dro
'2). a number of passes dro

'then put this in a "compile" button: on your main screen or where ever
'you put your dros, this is really just a fancy Teach wizard on the main page.

'*********************************Darcs sub wizard******************



groovelength=getuserdro(*********1)
numberpasses=getuserdro(*********2)

OpenTeachFile "Darcsfile.tap"
Code "(Darcsfile.tap)"

Code "#2=" & groovelength
Code "#3=" & numberpasses
Code "M98 P1 L#3"
Code "M30"
Code "o1"
Code "G90 X0"
code "G91 G1 X#2"
code "G0 Z10"
code "X[#2-[#2*2]]"
code "Z-11"
code "m99"

CloseTeachFile
Call LoadTeachFile()

'******note there is not a call standard layout, since this button is in your main
' mach, not a seperat wizard.
'enjoy scott
fun times

Offline Tarak

*
  •  229 229
    • View Profile
Re: Looping in VB?
« Reply #2 on: September 16, 2007, 08:33:31 PM »
Hi Scott,
Yet again thanks, it works great.
You guys are right it's amazing how much you can learn from looking at other peoples wizards.
Thanks again.