Hello Guest it is April 24, 2024, 09:34:11 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 - Cbyrdtopper

601
I agree with Craig,
Keep it out of the screen load until a final revision is made. 
I like the stripped down code.  I appreciate the thought to put the TLO addition in the Touch Module.  But I wish it were on the home screen or in the offsets screen as a stand alone button.  I went through and did this same thing with the TLO code.  I didn't like having to open up the module and be sure that TLO is selected, then push the probe button.

602
I Just looked at Craig's code.  The last modal call for Absolute/Increment is Increment.  It is the move after the Probe move.

"mc.mcCntlGcodeExecuteWait(inst, 'G00 G91 Z1');  --Rapid move to 1 inch above current pos"

In the code you need to have it change back to absolute mode.
Just put this line after the G91 line.

mc.mcCntlGcodeExecute(inst, "G90") 

603
cv580,
Somewhere along the line you have used a "G91"
This puts Mach in incremental mode. 
You need to be in Absolute Mode ... "G90"

604
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 21, 2018, 07:59:09 PM »
Alrighty,
I've found a solution.
This snippet of code gets the core/inst register of CmdEnable count.  
When it is "1" then it will run my SetCurrentTool() function and adds 1 to the CmdEnable register so it doesn't keep looping.
Here is the Screen Load Script and the PLC Script that I'm using to accomplish this task.

--Set Current Tool Screen Load Script.
function SetCurrentTool()
     local inst = mc.mcGetInstance()
     local ActualTool = wx.wxGetNumberFromUser("What tool is in the turret?", "Tool # ","Current Tool", 1, 1, 6) -- Default, Min, Max.
     local rc = ActualTool
     if rc == -1 then
         wx.wxMessageBox("Set the current tool to the actual tool.")
     else
         mc.mcToolSetCurrent(inst, ActualTool)
         mc.mcCntlSetLastError(inst, "T" .. tostring(ActualTool) .. "0" .. tostring(ActualTool))
         mc.mcCntlGcodeExecute(inst, "T" .. tostring(ActualTool) .. "0" .. tostring(ActualTool))  --This uses the Tool Number that was entered into the Dialogue Box and pieces together a T### Command real fast.
     end
end--SetCurrentTool()

--Set Current Tool PLC Script
local hReg = mc.mcRegGetHandle(inst, "core/inst/CmdEnable");
local EnableCount = mc.mcRegGetValue(hReg)
if EnableCount == 1 then
     SetCurrentTool()
     mc.mcRegSetValue(hReg, 2)
end

605
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 21, 2018, 07:03:24 PM »
Here is a screenshot of the register I can use.

606
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 21, 2018, 06:55:53 PM »
Hey Craig,
Just to let you know what I'm doing...
I'm having my PLC Script run my SetCurrentTool() function on the 25th run.  This way the operator can tell Mach what tool is in the turret.  
I need to activate the tool offset while I'm doing this.

I've used the OSIG_MACHINE_ENABLED output handle before.  

.......................

While writing this post I thought of a possibility.  I remember a register I can access.    
There is a register counting how many times the Mach has been enabled and disabled.  I can just grab the first instance of this in the PLC Script and run my Function.  


Craig,
Do you know the command to get the core registers?  I've only gotten Var# and Registers I've made.

607
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 21, 2018, 06:15:53 PM »
Anyone has any ideas about this?

608
I moved the tabs in the design tree.  It doesn't work perfect.  But I was able to get them in the order I liked by moving them there.

609
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 16, 2018, 04:36:48 PM »
It doesn't work because the machine is not enabled.   I wonder if there is a way to capture the first instance the machine is enabled so it can run the SetCurrentToolFunction()

610
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 16, 2018, 04:24:49 PM »
So..
This works in a macro.
It doesn't work when it is run from the Screen Script.

I have this function in the Screen Load script.  The PLC Script calls this function on its 25th run.  It will Set the current tool and give me a message.  But it does not run the GcodeExecute or the MDIExecute.  I tried it with both.