131
VB and the development of wizards / Re: VB syntax
« on: March 20, 2009, 08:10:45 PM »
Well I tried
GetVar (550)
SetVar(551,(550/2))
Code "G90 G92 X0. Y0."
Code "G01 X[#551] Y[#551]"
Code "G03 X.0 Y[#550] I.0 J.0 G90"
Code "G03 X.0 Y[#550] I.0 J[-1*#550]G90"
Code "G03 X[-1*#551] Y[#551] I.0 J[-1*#551]G90"
Code "G01 G90 X.0 Y.0"
Code "G92.1"
End
and var #551 equaled 275 so I tried
v = GetVar (550)
v = v/2
SetVar(551,v)
Code "G90 G92 X0. Y0."
Code "G01 X[#551] Y[#551]"
Code "G03 X.0 Y[#550] I.0 J.0 G90"
Code "G03 X.0 Y[#550] I.0 J[-1*#550]G90"
Code "G03 X[-1*#551] Y[#551] I.0 J[-1*#551]G90"
Code "G01 G90 X.0 Y.0"
Code "G92.1"
End
and got the zero radius arc error even though the var monitor shows that #551 was properly set.
so I tried just doing the
v = GetVar (550)
v = v/2
SetVar(551,v)
in the M code and the rest in a G-code file
#550 = .5
G0G90X.25Y-.25
M79
G90 G92 X0. Y0."
G01 X[#551] Y[#551]"
G03 X.0 Y[#550] I.0 J.0 G90"
G03 X.0 Y[#550] I.0 J[-1*#550]G90"
G03 X[-1*#551] Y[#551] I.0 J[-1*#551]G90"
G01 G90 X.0 Y.0"
G92.1"
and still got the error. This code works
V = GetVar (550)
V1 = V/2.
Code "G90 G92 X0. Y0."
Code "G01 X"&V1 & "Y"&V1
Code "G03 X.0 Y"&V & "I-"&V1 & "J.0 G90"
Code "G03 X.0 Y"&V & "I.0 J-"&V & "G90"
Code "G03 X-"&V1 & "Y"&V1 & "I.0 J-"&V1 & "G90"
Code "G01 G90 X.0 Y.0"
Code "G92.1"
End
and you call it from the G-code like this
#550 = .5
G0 G90 X.25 Y-.25
M79
It runs and does a nice hole milling cycle. #550 is set to the radius of the hole minus the radius of the tool.
GetVar (550)
SetVar(551,(550/2))
Code "G90 G92 X0. Y0."
Code "G01 X[#551] Y[#551]"
Code "G03 X.0 Y[#550] I.0 J.0 G90"
Code "G03 X.0 Y[#550] I.0 J[-1*#550]G90"
Code "G03 X[-1*#551] Y[#551] I.0 J[-1*#551]G90"
Code "G01 G90 X.0 Y.0"
Code "G92.1"
End
and var #551 equaled 275 so I tried
v = GetVar (550)
v = v/2
SetVar(551,v)
Code "G90 G92 X0. Y0."
Code "G01 X[#551] Y[#551]"
Code "G03 X.0 Y[#550] I.0 J.0 G90"
Code "G03 X.0 Y[#550] I.0 J[-1*#550]G90"
Code "G03 X[-1*#551] Y[#551] I.0 J[-1*#551]G90"
Code "G01 G90 X.0 Y.0"
Code "G92.1"
End
and got the zero radius arc error even though the var monitor shows that #551 was properly set.
so I tried just doing the
v = GetVar (550)
v = v/2
SetVar(551,v)
in the M code and the rest in a G-code file
#550 = .5
G0G90X.25Y-.25
M79
G90 G92 X0. Y0."
G01 X[#551] Y[#551]"
G03 X.0 Y[#550] I.0 J.0 G90"
G03 X.0 Y[#550] I.0 J[-1*#550]G90"
G03 X[-1*#551] Y[#551] I.0 J[-1*#551]G90"
G01 G90 X.0 Y.0"
G92.1"
and still got the error. This code works
V = GetVar (550)
V1 = V/2.
Code "G90 G92 X0. Y0."
Code "G01 X"&V1 & "Y"&V1
Code "G03 X.0 Y"&V & "I-"&V1 & "J.0 G90"
Code "G03 X.0 Y"&V & "I.0 J-"&V & "G90"
Code "G03 X-"&V1 & "Y"&V1 & "I.0 J-"&V1 & "G90"
Code "G01 G90 X.0 Y.0"
Code "G92.1"
End
and you call it from the G-code like this
#550 = .5
G0 G90 X.25 Y-.25
M79
It runs and does a nice hole milling cycle. #550 is set to the radius of the hole minus the radius of the tool.