leif
Aug 22nd, 2001, 02:38 PM
I have some formulas outputting to a text box. The numbers keep rounding up. How do I stop this?
kedaman
Aug 22nd, 2001, 02:49 PM
supply the code or we won't know what went wrong
leif
Aug 22nd, 2001, 04:13 PM
Pi = 3.14159
major = txtmajor.Text
minor = txtminor.Text
t = txtdia.Text
p = txtpitch.Text
z = txtflutes.Text
f = txtchipload.Text
v = txtsfm.Text
cl = txtclearance.Text
n = (v * 12) / (Pi * t) 'rpm
f1 = f * z * n
f2 = f1 * (major - t) / major 'feed
ri = minor / 2
ro = major / 2
re = ((ri - cl) ^ 2 + ro ^ 2) / (2 * ro)
D = 20 / major / p
a = Pi * major / 4
r = a * (Tan(D * (Pi / 180)))
p1 = 1 / p
x = 0
y = (ri - cl) * (-1)
ro1 = ro * (-1)
txtprogram.Text = "N10 G90 G0 X0 Y0 Z0" & vbCrLf & "G91 G41 D" & txtdvalue.Text & " X0 Y" & Format(y, ".0000") & " Z0" & vbCrLf & "G3 X" & Format(ro, ".0000") & " Y" & Format(re, ".0000") & " Z? R" & Format(re, ".0000") & " S" & Format(n, "0.") & " F" & Format(f2, "0.") & vbCrLf & "G3 X0 Y0 Z" & Format(p1, ".0000") & " I" & Format(ro1, ".0000") & " J0" & vbCrLf & "G3 X" & Format(ro1, ".0000") & " Y" & Format(re, ".0000") & " Z? R" & Format(re, ".0000") & vbCrLf & "G0 G40 X0 Y" & Format(y, ".0000") & " Z0" & vbCrLf & "M1"
kedaman
Aug 23rd, 2001, 02:18 AM
Whoa! That looks heavy :p
Where's the declarations of each and one of the variables?
Muddy
Aug 25th, 2001, 11:05 PM
looks to me like you are telling them to round up with the Format Functions. Get rid of the formats and they shouldn't round up.