171
Mach4 General Discussion / Re: Ethernet Smooth Stepper.
« on: December 03, 2014, 07:48:34 AM »
Thank You Greg
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.
In some instances G91 is the only way to fly.
([#100] -X Probed Position)
([#101] +X Probed Position)
([#102] -Y Probed Position)
([#103] +Y Probed Position)
([#200] Estimated Diameter of hole)
([#202] Tip or Tool Diameter)
([#203] Probe X Travel Distance)
([#204] Probe Y Travel Distance)
([#206] Retract Distance)
([#225] Rough Probe Speed)
([#226] Fine Probe Speed)
([#230] Computed Diameter of hole)
([#5061] G31 X probe position)
([#5062] G31 Y probe position)
#320=[#5021] (Current machine X)
#321=[#5022] (Current machine Y)
#322=[#5023] (Current machine Z)
#323=[#4100] (machine X fixture offset difference)
#324=[#4101] (machine Y fixture offset difference)
#325=[#4102] (machine Z fixture offset difference)
#326=[#320 - #323] (machine X fixture offset)
#327=[#321 - #324] (machine Y fixture offset)
#328=[#322 - #325] (machine Z fixture offset)
#330=[#326 - [#200 * 0.7]] (X- New Position to Probe to)
#331=[#326 + [#200 * 0.7]] (X+ New Position to Probe to)
#332=[#327 - [#200 * 0.7]] (Y- New Position to Probe to)
#333=[#327 + [#200 * 0.7]] (Y+ New Position to Probe to)
g61
g90
g31 x[#330] f[#225]
#100 = #5061
g01 x[#100+#206]
g4p1
g31 x[[#100]+[#203*-1]] f[#226]
#100 = #5061
g0 x[#320]
g4p1
g31 x[#331] f[#225]
#101 = #5061
g01 x[[#101]+[#206*-1]]
g4p1
g31 x[#101+#203] f[#226]
#101 = #5061
#105 = [[#100+#101]/2]
g0 X#105
g31 y[#332] f[#225]
#102 = #5062
g01 y[#102+#206]
g4p1
g31 y[[#102]+[#204*-1]] f[#226]
#102 = #5062
g0 y[#321]
g4p1
g31 y[#333] f[#225]
#103 = #5062
g01 y[[#103]+[#206*-1]]
g4p1
g31 y[[#103]+[#204]] f[#226]
#103 = #5062
#104 = [[#102+#103]/2]
g0 Y#104
g4p1
z[#206]
#230=[[[[-#100+#101]+[-#102+#103]]/2]+#202]
g64
m30
-----------------------------------------------------------------------------
-- Machine Type: Standard Mill Control
-- Author: MachMotion Development Team
-- Created: 09/24/2013
-- Modified by: MachMotion Development Team
-- Modified on: 01/10/2014
-- Description: Example: Reading Variables into MCodes
-- Copyright: © 2013-2014 Edge Solutions LLC All Rights Reserved
-----------------------------------------------------------------------------
function m702(hVars)
local macroname = "m702"
local a,b,c,rc,rc2
local inst = mc.mcGetInstance() -- Get the current instance
local nilPoundVar = mc.mcCntlGetPoundVar(inst,0)
local message = ""
if hVars ~= nil then
local ParameterLetterArray = {"A", "B", "C", "D", "E", "F", "H", "I", "J", "K", "L", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
local ParameterNumberArray = {mc.VAR_A, mc.VAR_B, mc.VAR_C, mc.VAR_D, mc.VAR_E, mc.VAR_F, mc.VAR_H, mc.VAR_I, mc.VAR_J, mc.VAR_K, mc.VAR_L, mc.VAR_P, mc.VAR_Q, mc.VAR_R, mc.VAR_S, mc.VAR_T, mc.VAR_U, mc.VAR_V, mc.VAR_W, mc.VAR_X, mc.VAR_Y, mc.VAR_Z}
for i = mc.VAR_A, #ParameterNumberArray do
rc = mc.mcCntlGetLocalVar(inst, hVars, ParameterNumberArray[i])
message = message .. "#" .. ParameterLetterArray[i] .. ":" .. tostring(rc) .. "\n"
end
wx.wxMessageBox(message)
end
return nil, true, macroname .. " Ran Successfully"
end
if (mc.mcInEditor() == 1) then
m702()
end
----------------------------------------------------
--Brought to you by the: "Mach4^2 Development Team"!!
--Team members both Frick, and Frack!!
----------------------------------------------------
function checkval(rc)
if (rc <= 1e-009 or rc >= 1e009) then
rc2 = 0;
else
rc2 = rc;
end
return rc2
end
function m700(hVars)
local macroname = "m700"
local rc
local inst = mc.mcGetInstance() -- Get the current instance
local nilPoundVar = mc.mcCntlGetPoundVar(inst,0)
local message = ""
if hVars ~= nil then
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_A)
checkval(rc)
message = message .. "A" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_B)
checkval(rc)
message = message .. "B" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_C)
checkval(rc)
message = message .. "C" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_D)
checkval(rc)
message = message .. "D" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_E)
checkval(rc)
message = message .. "E" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_F)
checkval(rc)
message = message .. "F" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_H)
checkval(rc)
message = message .. "H" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_I)
checkval(rc)
message = message .. "I" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_J)
checkval(rc)
message = message .. "J" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_K)
checkval(rc)
message = message .. "K" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_L)
checkval(rc)
message = message .. "L" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_P)
checkval(rc)
message = message .. "P" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_Q)
checkval(rc)
message = message .. "Q" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_R)
checkval(rc)
message = message .. "R" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_S)
checkval(rc)
message = message .. "S" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_T)
checkval(rc)
message = message .. "T" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_U)
checkval(rc)
message = message .. "U" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_V)
checkval(rc)
message = message .. "V" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_W)
checkval(rc)
message = message .. "W" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_X)
checkval(rc)
message = message .. "X" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_Y)
checkval(rc)
message = message .. "Y" .. ":" .. tostring(rc2) .. ", "
rc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_Z)
checkval(rc)
message = message .. "Z" .. ":" .. tostring(rc2)
wx.wxMessageBox(message)
end
end
if (mc.mcInEditor() == 1) then
m700(0)
end
----------------------------------------------------
--Brought to you by the: "Mach4^2 Development Team"!!
--Team members both Frick, and Frack!!
----------------------------------------------------
function m701(hVars)
local macroname = "m701"
local aa,bb,cc,dd,ee,ff,hh,ii,jj,kk,ll,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz = 0;
local inst = mc.mcGetInstance() -- Get the current instance
local nilPoundVar = mc.mcCntlGetPoundVar(inst,0)
if hVars ~= nil then
aa = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_A)
mc.mcCntlSetPoundVar(inst, 1, aa);
bb = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_B)
mc.mcCntlSetPoundVar(inst, 2, bb);
cc = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_C)
mc.mcCntlSetPoundVar(inst, 3, cc);
dd = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_D)
mc.mcCntlSetPoundVar(inst, 7, dd);
ee = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_E)
mc.mcCntlSetPoundVar(inst, 8, ee);
ff = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_F)
mc.mcCntlSetPoundVar(inst, 9, ff);
hh = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_H)
mc.mcCntlSetPoundVar(inst, 11, hh);
ii = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_I)
mc.mcCntlSetPoundVar(inst, 4, ii);
jj = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_J)
mc.mcCntlSetPoundVar(inst, 5, jj);
kk = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_K)
mc.mcCntlSetPoundVar(inst, 6, kk);
ll = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_L)
mc.mcCntlSetPoundVar(inst, 12, ll);
pp = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_P)
mc.mcCntlSetPoundVar(inst, 16, pp);
qq = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_Q)
mc.mcCntlSetPoundVar(inst, 17, qq);
rr = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_R)
mc.mcCntlSetPoundVar(inst, 18, rr);
ss = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_S)
mc.mcCntlSetPoundVar(inst, 19, ss);
tt = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_T)
mc.mcCntlSetPoundVar(inst, 20, tt);
uu = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_U)
mc.mcCntlSetPoundVar(inst, 21, uu);
vv = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_V)
mc.mcCntlSetPoundVar(inst, 22, vv);
ww = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_W)
mc.mcCntlSetPoundVar(inst, 23, ww);
xx = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_X)
mc.mcCntlSetPoundVar(inst, 24, xx);
yy = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_Y)
mc.mcCntlSetPoundVar(inst, 25, yy);
zz = mc.mcCntlGetLocalVar(inst, hVars, mc.VAR_Z)
mc.mcCntlSetPoundVar(inst, 26, zz);
--mc.mcCntlSetPoundVar(inst, 13, mm);
--mc.mcCntlSetPoundVar(inst, 14, nn);
--mc.mcCntlSetPoundVar(inst, 15, oo);
end
end
if (mc.mcInEditor() == 1) then
m701(0)
end