Hello Guest it is April 25, 2024, 01:20:12 AM

Show Posts

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.


Messages - hanfre

Pages: 1
1
Mach4 General Discussion / M6 and auto tool measure script.
« on: February 03, 2020, 03:14:48 PM »
Hi all!
I'm struggeling with my tool measurement. I've developed my own probe and tested that everything works.
I've also made a fully functional M6 tool change macro. Btw, my mill is a Emco VMC-100, with 10 tools.
And now I would like to make a tool measure macro that I can call in the MDI and it will run through all my tools before I start.
I've called it M10. But there seems to be a problem. My first tool, tool 1, is always shorter, or the other tools are longer....

what's wrong here??
(some of the comments in norwegian...(not important)
Code: [Select]
function m6()

local inst = mc.mcGetInstance()
local selectedTool = mc.mcToolGetSelected(inst)
local currentTool = mc.mcToolGetCurrent(inst)
local toolPos = {0,36,72,108,144,180,216,252,288,324}


-----------------------------NYTT HERFRA----------------------------
mc.mcCntlGcodeExecuteWait(inst, "M5")
mc.mcCntlGcodeExecuteWait(inst, "G04 1")

if selectedTool == currentTool then
mc.mcCntlSetLastError(inst,"No need for tool change, go on!")
return
else
-----------Get current state-----------------
local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)
local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)
local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)
---------------------------------------------
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 Z0.0")
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 X0.0 Y0.0")
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 Z87.0")
mc.mcCntlGcodeExecuteWait(inst, "G90 G54 G40 G0 A"..toolPos[selectedTool].."")
mc.mcCntlGcodeExecuteWait(inst, "G43 H"..selectedTool.."")

local sigh1 = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1) --Steppermotor i posisjon
local sigState1 = mc.mcSignalGetState(sigh1)
if (sigState1 == 1) then
mc.mcCntlSetLastError(inst,"Toolchange is finished, going down")
mc.mcCntlSetLastError(inst, "ToolNo. "..currentTool.." changed to ToolNo. "..selectedTool.." with position "..toolPos[selectedTool].."")
else
mc.mcCntlEStop(inst)
wx.wxMessageBox("Is the tool wheel in the correct position?")
return
end
end

mc.mcCntlGcodeExecuteWait(inst, "G04 1")

--local sigh0 = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT0)
--local sigState0 = mc.mcSignalGetState(sigh0)

--if (sigState0 == 1) then
-- mc.mcCntlSetLastError("Tool 1 is in position")
--mc.mcAxisSetMachinePos(inst, 3, 0)
--end

mc.mcToolSetCurrent(inst, selectedTool)
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G01 F200 Z87.0")
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G01 F1200 Z0.0") --Går tilbake til Z0.0

local sigh2 = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2)
local sigState2 = mc.mcSignalGetState(sigh2)
if (sigState2 == 1) then
mc.mcCntlSetLastError(inst,"Tool is in position, Spindle can start")
------ Reset state ------
mc.mcCntlSetPoundVar(inst, 2134, CurFeed)
mc.mcCntlSetPoundVar(inst, 4001, CurFeedMode)
mc.mcCntlSetPoundVar(inst, 4003, CurAbsMode)
-------------------------
else
mc.mcCntlEStop(inst)
wx.wxMessageBox("The toolhead is not on position")
end
mc.mcCntlGcodeExecuteWait(inst, "G40")

end


if (mc.mcInEditor() == 1) then
m6()
end

Code: [Select]
function m10()

local inst = mc.mcGetInstance()

--wx.wxMessageBox("Have you Referenced all axis?")

for i =1,10,1 do
mc.mcCntlGcodeExecuteWait(inst, "M6 t"..i.."")
mc.mcCntlGcodeExecuteWait(inst, " g53 G40 G90 G0 Z0.0")
mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 x-8 y-32")
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 F300 Z-100")
mc.mcCntlGcodeExecuteWait(inst, "G91 G0 Z2")
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 F25 Z-3")
local probedz = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_POS_Z)
local NewOffset = probedz
mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, i, NewOffset)
mc.mcCntlGcodeExecuteWait(inst, "G53 G90 g0 Z0")
end
mc.mcCntlGcodeExecuteWait(inst, "M6 t1")
end

if (mc.mcInEditor() == 1) then
m10()
end

2
Mach4 General Discussion / 1kW servo as spindle. Steps overflow HELP!
« on: June 07, 2019, 04:32:48 PM »
Hi all!

Has anyone tried this?

I've monted this in an Emco VMC-100, and it's working great! As long as I'm controlling this with 0-10V input, but wanted to try to use STEP/DIR as this is a possiblilty both in Mach 4 and in the servo, my goal is to do rigid tapping :) and with this method I'm able to go both CW and CCW.

But after a whole lot of setup and connections I finaly got it running CW/CCW!
But if I run it with M3/4 and finnish off with M5 after a while I get a warning+e-stop and the message "Motion steps overflow (-some number) check motor speed parameters"
the number in (-some number) is:
RPM=1000, some number=271
RPM=1000, some number=543( seems to double...)

anyone have encountered this?

mach4 ,pokeys57cnc (I'm only having trouble with this motor, rest working fine)

HanFre

3
Mach4 General Discussion / Re: G41 is reloaded after starting G-code.
« on: June 07, 2019, 04:16:50 PM »
made a quick fix...
Think it happens in my tool change macro/script(don't know why), but I put in G40 under each tool change and then voila, it worked!

HanFre

4
Mach4 General Discussion / G41 is reloaded after starting G-code.
« on: June 03, 2019, 06:55:39 PM »
Hi you all!
Hope someone can help me!

Just got me an Emco VMC-100 and have upgraded this with new electronics, pokeys57cnc controller and ofcourse mach4.

But I encounter a strange problem. If I write "G40" in the MDI and run this line, the G41 disapears.
But if I run a G-code  with toolchange, it suddenly comes back to G41. (it stops when "G43 Z15. H10")

This is frustrating because the program then stops because of G28/G30.

What I use is SolidWorks with HSMworks U., Mach 4 postprosessor.

Code used:
Code: [Select]
(1_SOFT_JAWS_FOR SETTER)
(T3  D=4. CR=0. - ZMIN=-5. - FLAT END MILL)
(T10  D=6. CR=0. TAPER=118DEG - ZMIN=-11.813 - DRILL)
G90 G94 G91.1 G40 G49 G17
G21 G40
G28 G91 Z0.
G90

(DRILL1)
M5
T10 M6
S2500 M3
G54
G0 X50.2 Y-11.4
G43 Z15. H10
Z5.
G98 G81 X50.2 Y-11.4 Z-11.813 R0. F250.
X10.2
G80
Z15.
G28 G91 Z0.
G90

(2D POCKET1)
M5
M1
T3 M6
S2500 M3
G54
G0 X11.025 Y-11.78
G43 Z15. H3
Z5.
G1 Z0.2 F350.
X11.044 Y-11.763 Z0.102 F333.
X11.091 Y-11.711 Z0.029


I've tried changing the values in configuration -initialization values(only use G40)
changed the modal values in the screen editor...

So why is it returning to G41 after my toolchange?

I've added my M6.mcs-file

Sorry for my bad english :-[

hanfre

Pages: 1