Hello Guest it is May 17, 2024, 01:17:47 PM

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 - Brian Barker

261
Mach4 General Discussion / Re: Modbus Programming guidance needed
« on: January 02, 2021, 04:59:52 PM »
Some of the modbus devices need to see communication . So read a status of something and it should be good.

262
Mach4 General Discussion / Re: M6 Script Problem
« on: January 02, 2021, 04:56:26 PM »
When you see the properties for the button. You will see a properties with a lightning bolt through it. You just copy and past the code in the on clicked script.

263
Mach4 General Discussion / Re: How to display C axis in Lathe graphics?
« on: January 02, 2021, 04:53:54 PM »
Si, I could expose the OpenGL context and let you go nuts in the toolpath. Or I can make a way to dead data out one move at a time ... just thinking

264
Mach4 General Discussion / Re: M6 Script Problem
« on: January 02, 2021, 11:09:03 AM »
https://www.machsupport.com/mach4-screen-editing-custom-button-functions/

I think that will get you close, and I think we did a video of simple screen edits.

Edit: check his out https://m.youtube.com/watch?v=P1xZkFgS5cQ

265
Mach4 General Discussion / Re: M6 Script Problem
« on: January 01, 2021, 05:48:56 PM »
—Private will make it run in its own thread. So it will not effect the GUI Lua chunk. I did that so we could use the execute wait commands. This should be used when you don’t need it to work with the GUI.  Also the message boxes will not hault the execution of the GUI chunk. I think you see where I am going with this ...

—Private must be on the first line

266
Mach4 General Discussion / Re: M6 Script Problem
« on: January 01, 2021, 10:09:44 AM »
This Code goes into a button on the screen. It will set the offset of the current tool and the Tool setter is mounted on the table.



Code: [Select]
--PRIVATE this is it runs as it's own chunk outside of the screen
local inst = mc.mcGetInstance()
local ProbeDownDist = -15--distance to look down to find the part
local posmode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3) --get the current mode so we can return to it when macro ends
local currenttool = mc.mcToolGetCurrent(inst)
local curpos = mc.mcCntlGetValue(inst,mc.VAL_AXIS_MACHINE_POS,mc.Z_AXIS)
local rc = 0
local MyChoice = wx.wxMessageBox("Click Ok to Begin Probing the New Tool","Click OK to continue" , 16)
if(MyChoice == 4)then
    mc.mcCntlSetLastError(inst, "Probing in Progress!")
rc = mc.mcCntlGcodeExecuteWait(inst, string.format("G91 G31 Z%.3f F100.", ProbeDownDist))--probe the new tool Change F to set the Feed
if(rc ~= mc.MERROR_NOERROR)then
return;
end

local probedz = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_MACH_POS_Z) -- Z Probe position in Machine coords
local Retract = string.format("G00 G90 G53 Z%.3f\nG%.0f", curpos, posmode)
rc = mc.mcCntlGcodeExecuteWait(inst, Retract)--Retract
if(rc ~= mc.MERROR_NOERROR)then
return;
end

if(math.abs(curpos + ProbeDownDist - probedz) <.01)then
wx.wxMessageBox("Probe did not contact Probe","ERROR" );
else
local OffsetToMasterTool = 100.406;
local NewOffset = probedz - OffsetToMasterTool
mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, currenttool, NewOffset)
end
end

Please tell me if this works for you . .Now if you want to change where the setter is located we can do that but the script will need to change.

Thanks
Brian

267
Mach4 General Discussion / Re: M6 Script Problem
« on: December 31, 2020, 07:05:58 PM »
I will post one here tomorrow that I made working with a user. We just did a simple button on the screen

268
Mach4 General Discussion / Re: help with homing please
« on: December 31, 2020, 06:57:40 PM »
Maybe next year will be better ? Good luck we are all in this together, keep your stick on the ice.

Red green!

269
Mach4 General Discussion / Re: How to display C axis in Lathe graphics?
« on: December 31, 2020, 11:20:04 AM »
Can of worms that I don't know if it will work.. you can wrap the path around an axis in Mill and I think I did it for the A .. Lathe.. Well I don't think I ever added that code :(  Can it be done. Yup the issue is time! Is this a one off machine or for something that will be used many times over?

Thanks
Brian

270
Mach4 General Discussion / Re: Adding Physical button check code Take 2
« on: December 31, 2020, 11:17:54 AM »
Better way would be to look at the state machine in Mach4.. You can see if you are in Idle or not.