Welcome, Guest. Please login or register.
Did you miss your activation email?
October 02, 2014, 09:29:10 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  VB syntax
Pages: « 1 2 3   Go Down
Print
Author Topic: VB syntax  (Read 4338 times)
0 Members and 1 Guest are viewing this topic.
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 2,083


Briceville, TN, USA


View Profile WWW
« Reply #20 on: March 22, 2009, 09:14:56 AM »

Jusst another side note:

you have to set the vars before you can use them.

you have this:

'M79.m1s
GetVar (550)
Code"#551=[#550/2]"

You need this:

'M79.m1s
Var1 = GetVar (550)
SetVar (551, (Var1/2))

'When ever you use a "Get" something, you have to set it = to something, OR, put the Get as the parameter of another function.
'for example

SetVar (551, (GetVar (550)/2))

'scott



« Last Edit: March 22, 2009, 09:17:27 AM by poppabear » Logged

Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
https://sites.google.com/site/sssystemsautomation/
MachineMaster
Active Member

Offline Offline

Posts: 151


View Profile
« Reply #21 on: March 22, 2009, 10:50:50 AM »

I think you may be missing the fact that

Code"#551=[#550/2]"

does set 551. In reality, I don't need

GetVar (550)

Variable 550 is set in the calling G-code and I could either set 551 as I am doing in the macro or with

#551=[#550/2]

in the G-code following the #550=  line.
Logged
MachineMaster
Active Member

Offline Offline

Posts: 151


View Profile
« Reply #22 on: March 22, 2009, 03:21:03 PM »

Hi

You appear to be confusing integers with strings and are showing a integer value within string quotes
The below is not strictly necessary but clearly shows the difference between the 2 types of data you are combining.
(   Str() converts an integer to a String and Val() does the reverse  )

Dim V As Double
Dim s1 As String

V= GetVar (550)

s1 = "G90 G00 X" &Str(V) & " Y" &Str(V)

Code s1

regards

Melee

Actually, when I first set V with

V= GetVar (550)

I am implicitly declaring V as Double. The same is true when I then set V1 with

V1=[V/2]

because the value being set is Double.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 2,083


Briceville, TN, USA


View Profile WWW
« Reply #23 on: March 22, 2009, 09:24:14 PM »

Well all righty then, you got it all figured out then
Good luck

scott
Logged

Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
https://sites.google.com/site/sssystemsautomation/
Pages: « 1 2 3   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!