Hello Guest it is April 19, 2024, 01:06:42 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

611
Mach4 General Discussion / Re: How to set an active tool offset.
« on: March 16, 2018, 04:09:33 PM »
This will work.  
But I am still want to know if you are able to do this another way.

Here is the macro for proof of concept.
function m202()
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 --m202

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


612
Mach4 General Discussion / How to set an active tool offset.
« on: March 16, 2018, 03:34:23 PM »
Once Mach4 Lathe is opened; I have a Dialogue Box that pops up asking the operator which tool in the turret is active.  

We don't have any gang style tools so our offsets are straight forward.  T101 T202 .... T606.  What I need to do is go ahead and set the current offset active to whatever tool is active.  How can I do this in the PLC Script.

I found this in the PLC Script:  m_currentOffset = mc.mcCntlGetPoundVar(inst, mc.SV_CUR_LENGTH_INDEX)

I changed it to "SetPoundVar" and it did change the Active Offset Number that is on the screen.  But it didn't update the current offset position like I thought it would.

I could probably call a tool change to T101 .... T606, but now I'm curious to see if I can do this in code.

613
Mach4 General Discussion / Re: mach 4 plasma
« on: March 08, 2018, 08:21:12 AM »
Jeff,
Again, Like I said in the other post, you can adjust your X, Y, and Z offsets for T2 in the Tool Table.  It's pretty easy to do.  You just need to be sure that your CAM posts out a G43 H2 for T2. 

What you're wanting, so I can clarify, is when T2 is called up, your X, Y, and Z offset is updated and the engraver is turned on.  When T1 is called back up (Plasma torch) your X, Y, and Z, offsets are adjusted and the engraver is shut off?

614
Jeff.   I understand your frustration.   It just takes time to learn things.
Mach4 is very powerful and very flexible.   There is an entire thread on the forum about people's opinions. In whether Mach is hobby or not.   Part of your frustration you have mentioned has not be uncommon among users.   It's the amount of time you want to spend making something to fit your exact needs.   
I'm still willing to help you get this engraver working.   Maybe send over your plasma profile that is working without the engraver and I can see if I can add in a tab for the engraver information.   I'm and an advocate for Mach4, and I want to see them grow more.

615
Okay.  I'll walk you through it.
Open the screen editor.  Operator --> Edit Screen
Then look at the attached pictures.
1.  Be sure that you highlight the screen name at the top of the "screen tree manager".
2.  Select the 2nd tab of the "Properties".
3.  Open the PLC Script.

Put the code at the end of the PLC Script, just above the Last Line stuff from Mach4.  As good practice.  Put the Date and your initials by your new code to keep track of what you added.  Exp.  CB 3-7-18

616
Okay.

Still.  Just because, it's good to learn new things.   Here is the new PLC Script Code

local tool = mc.mcToolGetCurrent(inst)
local Engraver = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)

local hSig = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1)
local Input1State = mc.mcSignalGetState(hSig)
if Input1State == 1 then
     if tool == 2 then
         mc.mcSignalSetState(Engraver, 1)
     else
         mc.mcSignalSetState(Engraver, 0)
     end
else       
     mc.mcSignalSetState(Engraver, 0)
end


and then make a button that has this code in it.  It will toggle Input1 on and off.  Input 1 on allows the engraver to be turned on.  Input 1 off overrides the engraver and shuts it off.

local inst = mc.mcGetInstance()

local Input1 = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1)
local hSig = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1)
local State = mc.mcSignalGetState(hSig)
if State == 1 then
     mc.mcSignalSetState(Input1, 0)
else
     mc.mcSignalSetState(Input1, 1)
end       

617
Here is the code to turn the engraver on while T2 is active.  Add this towards the end of the PLC Script in the screen editor.

local tool = mc.mcToolGetCurrent(inst)
local Engraver = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
if tool == 2 then
     mc.mcSignalSetState(Engraver, 1)
else
     mc.mcSignalSetState(Engraver, 0)
end       


What I would also do is add a button that will toggle an input on and off.  This input will override the engraver output.
That way you can turn off the engraver if you don't need it on while T2 is active. 
I'll work on some code for this and get back with you.

618
I don't do plasma.  I'm using the HiCON Controller from Vital System for some mills and lathes.

You can set the X, Y, and Z Offsets in the tool table in Mach4.  You will have to open the tool table; open the view tab; and select the Optional Fields.  This allows you to see and utilize the X and Y Offsets.  The Z offset is the tool length.

As far as turning on and off the engraver.  You can add some code to the PLC script in the Mach4 screen that turns on the Engraver Output while T2 is active and will shut off while T2 is not active.   This will be a very easy snippet of code to add to the PLC script.

There is a potential problem with this code, this will keep the engraver on as long as T2 is active.  So anytime T2 is active, your engraver will be on.  Is that okay?

619
One way to do it is to add an M64 P# (# being the output for your engraver) to turn on your engraver.  M65 P# to turn off your engraver.

Example:
T2M6
G43 H2
M64 P1 (Output 1 On)
ENGRAVE CODE HERE
M65 P1 (Output 1 Off)
M30

620
jcoldon,
As far as the offset for X, Y, and Z; Yes.  When you're Sheet Cam posts out code, make sure it outputs a G43 H2 after the T2M6 line; this will turn on cutter compensation.  It also adjust the X and Y position.  I just tested this myself.

There are more than a couple ways to turn on and off the engraver.  Turning it on should be pretty easy.  Turning it off will be the challenge.

When do you want it to turn off?