Hello Guest it is April 19, 2024, 12:33:33 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 - Plasma629

Pages: 1
1
Double post.

2
Hey guys I have a custom M6 macro which has been working for about a year, i recently upgraded Mach 4 and ESS (likely not following best practices) and now the same M6 does not work the same, my Z does not even move and Mach 4 gives message "ESS Starting Probe 0" and system is stuck at this point.

I also had the functionality to adjust the X & Y location along with feed rate for probe move and probe thickness offset easily by going to Mach 4 top left menu -> diagnostic -> Regfile - New fangled Solutions and a popup would pop up where the above variables were listed with the option of editing, now when i do the same nothing opens up... i feel like i shot myself in the leg.
M6:
Quote
function m6()
    local inst = mc.mcGetInstance('M6 Manual Tool Change Macro')
   local selectedtool = mc.mcToolGetSelected(inst)
   local currenttool = mc.mcToolGetCurrent(inst)
   
   -- Get register handles, add the registers if they don't exist
   local hXpos, hYpos, hZpos, hPfeed, rc, response
   hXpos, rc = mc.mcRegGetHandle(inst, "iRegs0/M6/m6Xpos")
   if (rc ~= mc.MERROR_NOERROR) then
      -- Register does not exis add it
      mc.mcCntlSetLastError(inst, "M6: Xpos register does not exist, adding")
      response, rc = mcRegAddDel(inst, "ADD", "iRegs0", "M6/m6Xpos", "Machine position for tool change, X Axis", 0, 1)
   end
   hYpos, rc = mc.mcRegGetHandle(inst, "iRegs0/M6/m6Ypos")
   if (rc ~= mc.MERROR_NOERROR) then
      -- If register does not exis add it
      mc.mcCntlSetLastError(inst, "M6: Ypos register does not exist, adding")
      response, rc = mcRegAddDel(inst, "ADD", "iRegs0", "M6/m6Ypos", "Machine position for tool change, Y Axis", 0, 1)
   end
   hZpos, rc = mc.mcRegGetHandle(inst, "iRegs0/M6/m6Zpos")
   if (rc ~= mc.MERROR_NOERROR) then
      -- If register does not exis add it
      mc.mcCntlSetLastError(inst, "M6: Zpos register does not exist, adding")
      response, rc = mcRegAddDel(inst, "ADD", "iRegs0", "M6/m6Zpos", "Machine position for tool change, Z Axis", 0, 1)
   end
   hPfeed, rc = mc.mcRegGetHandle(inst, "iRegs0/M6/m6Pfeed")
   if (rc ~= mc.MERROR_NOERROR) then
      -- If register does not exist add it
      mc.mcCntlSetLastError(inst, "M6: Probe feed register does not exist, adding")
      response, rc = mcRegAddDel(inst, "ADD", "iRegs0", "M6/m6Pfeed", "Probe feed rate for tool touch off, manual tool change", 10, 1)
   end
   hTouchHeight, rc = mc.mcRegGetHandle(inst, "iRegs0/M6/m6TouchHeight")
   if (rc ~= mc.MERROR_NOERROR) then
      -- If register does not exist add it
      mc.mcCntlSetLastError(inst, "M6: Touch height register does not exist, adding")
      response, rc = mcRegAddDel(inst, "ADD", "iRegs0", "M6/m6TouchHeight", "Touch height of the probe, manual tool change", 0, 1)
   end
   
   if selectedtool == currenttool then -- Tool already selected, so do nothing
      mc.mcCntlSetLastError(inst, "M6: Current tool = selected tool")
   else
      -- Start tool change sequence
      -- Get values for park position for manual tool change
      local Zpos = mc.mcRegGetValue(hZpos)
      local Xpos = mc.mcRegGetValue(hXpos)
      local Ypos = mc.mcRegGetValue(hYpos)
      -- Set up gcode line to move machine to the park position
      local gline = string.format("G0 G90 G53 Z%.3f\nG0 G53 X%.3f Y%.3f", Zpos, Xpos, Ypos)
      -- Execute the gcode line and move machine to the park position
      mc.mcCntlGcodeExecuteWait(inst, gline)
      -- Execute manual tool change and wait for user to press cycle start button to continue
      mc.mcCntlToolChangeManual(inst)
      -- Notify user of the tool change and set the current tool to the new tool
      mc.mcCntlSetLastError(inst, "M6: Current tool == " .. tostring(selectedtool) .. "   Previous Tool == " .. tostring(currenttool))
      mc.mcToolSetCurrent(inst, selectedtool)
      
      -- Start tool touch off sequence
      local pFeed = mc.mcRegGetValue(hPfeed)
      if (pFeed == nil) or (pFeed <= 0) then
         -- If pFeed if not specifed or zero or negative, then set a default value
         pFeed = 10
      end
      -- Get Z axis softlimit minimum
      local zMin = mc.mcAxisGetSoftlimitMin(inst, mc.Z_AXIS)
      zMin = zMin + .001
      -- Start probe move
      gline = string.format("G31 G90 Z%.3f F%.3f", zMin, pFeed)
      mc.mcCntlGcodeExecuteWait(inst, gline)
      -- Get probed machine position
      local probePos = mc.mcCntlGetPoundVar(inst, 5073)
      -- Check that we contacted the probe before reaching the end of the move, with a 0.001 tolerance window
      if (math.abs(probePos - zMin) < .001) then
         mc.mcCntlEStop(inst)
         mc.mcCntlSetLastError(inst, "M6: Tool probing failed, reached end of travel")
         do return end
      end
      -- Set the offset
      XVar, YVar, ZVar, FixNum, CurrentFixture = GetFixOffsetVars() -- Get current fixture information
      local touchHeight = mc.mcRegGetValue(hTouchHeight)
      local zOffset = tonumber(probePos) - tonumber(touchHeight)
      mc.mcCntlSetPoundVar(inst, ZVar, zOffset)
      mc.mcCntlSetLastError(inst, string.format("M6: Z axis %s offset set to %.3f", CurrentFixture, probePos))
      -- Return to previous Z level
      gline = string.format("G0 G53 Z%.3f", Zpos)
      mc.mcCntlGcodeExecuteWait(inst, gline)
      -- End m6 macro
   end
end

-- Function to get the current fixture offset variables
function GetFixOffsetVars()
   local FixOffset = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_14)
    local Pval = mc.mcCntlGetPoundVar(inst, mc.SV_BUFP)
    local FixNum, whole, frac
   
   if (FixOffset ~= 54.1) then --G54 through G59
      whole, frac = math.modf (FixOffset)
        FixNum = (whole - 53)
        PoundVarX = ((mc.SV_FIXTURES_START - mc.SV_FIXTURES_INC) + (FixNum * mc.SV_FIXTURES_INC))
      CurrentFixture = string.format('G' .. tostring(FixOffset))
   else --G54.1 P1 through G54.1 P100
      FixNum = (Pval + 6)
      CurrentFixture = string.format('G54.1 P' .. tostring(Pval))
      if (Pval > 0) and (Pval < 51) then -- G54.1 P1 through G54.1 P50
         PoundVarX = ((mc.SV_FIXTURE_EXPAND - mc.SV_FIXTURES_INC) + (Pval * mc.SV_FIXTURES_INC))
      elseif (Pval > 50) and (Pval < 101) then -- G54.1 P51 through G54.1 P100
         PoundVarX = ((mc.SV_FIXTURE_EXPAND2 - mc.SV_FIXTURES_INC) + (Pval * mc.SV_FIXTURES_INC))   
      end
   end
   PoundVarY = (PoundVarX + 1)
    PoundVarZ = (PoundVarX + 2)
    return PoundVarX, PoundVarY, PoundVarZ, FixNum, CurrentFixture
   --PoundVar(Axis) returns the pound variable for the current fixture for that axis (not the pound variables value).
   --CurrentFixture returned as a string (examples G54, G59, G54.1 P12).
   --FixNum returns a simple number (1-106) for current fixture (examples G54 = 1, G59 = 6, G54.1 P1 = 7, etc).
end
-- Function to add or delete registers
function mcRegAddDel(hInst, mode, device, path, desc, intialVal, persistent) --"mode = ADD" or "DEL",
   local hReg
   local rc
   --local inst = bit32.band(hInst, 0xFF)
   local inst = hInst
   local cmdstring = mode .. "|" .. path
   device = tostring(device)
   desc = tostring(desc)
   local val = tostring(intialVal)
   local persist = "0"
   if (type(persistent) == "boolean") then
      if (persistent ~= false) then
         persist = "1"
      end
   elseif (type(persistent) == "number") then
      if (persistent ~= 0) then
         persist = "1"
      end
   end

   --Check to see if the device is available
   hReg, rc = mc.mcRegGetHandle(inst, device .. "/command")
   if (rc ~= mc.MERROR_NOERROR) then --The device is not available.
      return "The command register for the instance registers is not available. Device = " .. device, mc.MERROR_NOT_IMPLEMENTED
   end
   
   --Check to see if the register exist
   hReg, rc = mc.mcRegGetHandle(inst, device .. "/" .. path)
   if (rc == mc.MERROR_NOERROR) and (mode == "ADD") then --Reg already exist so don't create it
      --mc.mcCntlSetLastError(inst, device .. "/" .. path .. " Register already exist so we won't try to create it")
      return "The register already exist.", mc.MERROR_NOERROR
   elseif (rc == mc.MERROR_REG_NOT_FOUND) and (mode == "DEL") then --Reg does not exist so don't try to delete it
      --mc.mcCntlSetLastError(inst, device .. "/" .. path .. " Register does not exist so we won't try to delete it")
      return "The register does not exist.", mc.MERROR_NOERROR
   elseif (rc == mc.MERROR_REG_NOT_FOUND) and (mode == "ADD") then --Reg doesn't exist so add the rest of the parameters and create it.
      cmdstring = cmdstring .. "|" .. desc .. "|" .. val  .. "|" .. persist
   else
   end
      
   hReg, rc = mc.mcRegGetHandle(inst, device .. "/command")
   response, rc = mc.mcRegSendCommand(hReg, cmdstring)
   
   return response, rc
end

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

As always any help would be appreciated!

3
My probe is about .33" thick, how can i accommodate this offset within the M6 macro?
Any & all help is appreciated!
The code below is very similar to the default above. Only instead of just pausing the Gcode it allows you to jog to a probing position and once over the probe, click cycle start. This will begin a probing move. If that probe move is successful it will update the tools height in the tool table. It is very important to have the default move after the probing in the Gcode....... or you could add this default move to the m6 itself but it is not in it as is.
Code: [Select]
function m6()

local inst = mc.mcGetInstance()
local selectedTool = mc.mcToolGetSelected(inst)
local currentTool = mc.mcToolGetCurrent(inst)
local maxDown = -4.0000 --Max distance Z will go down in the touch routine
local rate = 30 --Feed rate the Z will go down in the touch routine
local safeZ = 0 --Machine coordinates the Z will rapid to after touch move

if selectedTool == currentTool then
mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
else
--mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 Z0.0") --Uncomment this line if you would like to move the Z axis to machine coords 0
mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to touch off") --Message at beginning of tool change
mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
mc.mcToolSetCurrent(inst, selectedTool)
mc.mcCntlSetLastError(inst, "Performing touch routine")
mc.mcCntlGcodeExecuteWait(inst, string.format("G31 Z%0.4f F%0.4f\nG0 G53 Z%0.4f", tostring(maxDown), tostring(rate), tostring(safeZ))) --Probe move
mc.mcCntlSetLastError(inst, "Touch move complete")
mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
local didStrike, rc = mc.mcCntlProbeGetStrikeStatus(inst)
if (didStrike == 1) then
--#5063 = User position #5073 = Machine position
value, rc = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_POS_Z)
--value, rc = mc.mcCntlGetPoundVar(inst, 5063) --Same as line above but line above uses the Mach constant instead of the #var
mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, selectedTool, value) --Set the tool height to what was determined by probe move
mc.mcCntlGcodeExecute(inst, string.format("G43 H" .. tostring(selectedTool)))
mc.mcCntlSetLastError(inst, string.format("Tool " .. tostring(selectedTool) .. " H offset set to %0.4f", value))
else
mc.mcCntlSetLastError(inst, "The touch move did not touch so we did not set a tool offset.") --Message that shows after Cycle Start
end
end
end

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

4
Mach4 General Discussion / Re: Mach4 Arc OK THCON signal programming
« on: July 25, 2019, 01:33:54 PM »
Hi Jamie,

I am trying to get my M3 & M5 to start and stop my plasma from firing and using arc ok as well. mind sharing your M5 code as well? 

I am trying to make the M3 code you shared work for my use, will update if it works!

5

The THC3T is a hardware controller, it adds or subtracts pulses in addition to those coming from the Bob/ESS to the pulse stream
going to the Z axis driver. You realize that the Z axis will lose reference in Mach. Mach has no way to know how many extra
pulses have been added or subtracted and thus the Z axis will lose reference.


How would you suggest I connect this?
I have see youtube videos and read people using this THC but no one sharing how they got it to work with Mach 4...

Another issue I noticed is without the THC connected I can jog the Z up and down BUT with the THC connected (wired) Mach will only let me Jog the Z axis up, not down...if i press up it goes up, if i press down it still goes up...any clue as to why?

6

Thanks for your reply Craig! I have a couple clarifications below:

Hi,

Quote
2 start plasma (type:input) -> I have these 2 wired to input pins # 11 & 15 of BoB

No, that is not correct. The manual tells you that you need  a dry contact between the two wires. That does not
mean two pins on your BoB. You need one pin on your BoB to turn on a relay and a normally open contact pair
of the relay are hooked to the two start wires of the plasma.
Are you able to guide me as to which pins/relay i should use on my BoB? I have the attachment with all the pins identified
Quote
2 start machine motion (Type:output)-> I have these 2 wired to output pins # 16 & 17 of BoB

No, that is not correct. The manual tells you that this signal is the same as 'Arc OK' and it is signaled by a dry contact closure
between the two wires of the plasma. You would hook one to the 0V of your BoB and the other to one input pin of your
BoB assuming a pull up resistor at the input pin.
Can you guide me as to which pin is 0V? im assuming the 0-10V pin on my BoB?
Quote
DIR_IN -> Wired to BoB same pin which is connected to Z axis servo motor DIR-
STEP_IN -> Wired to BoB same pin which is connected to Z axis servo motor STEP-

The THC3T is a hardware controller, it adds or subtracts pulses in addition to those coming from the Bob/ESS to the pulse stream
going to the Z axis driver. You realize that the Z axis will lose reference in Mach. Mach has no way to know how many extra
pulses have been added or subtracted and thus the Z axis will lose reference.

Quote
ARC_OK -> Wired to BoB input pin # 12
EXT_COM -> BoB ground pin

You could hoo these direct to the 'Arc OK' dry contact closure of the plasma OR have the 'Arc OK' hooked to a Mach input
and have that input reflected to a Mach output which in turn signals the THC3T.
So hook the "Arc OK" from THC to on of the wires from"start plasma input"?
Craig

looking forward to your reply

7
Thanks for your inputs Joeaverage. I stopped playing shortcut and started Mach 4 and ESS profile from scratch.

I am happy to say I got E-Stop working, the machine jogging & referencing home (home switches FTW) along the X,Y,Z axis.

I left out the Spindle pins since we will be using Plasma.

Now here is where I am a little stuck/confused:

Hypertherm 45 XP connection- There are 7 wires coming out the CPC port of the hypertherm...(Attached a picture of the wire connection diagram)

2 wires (+-) voltage divider -> I have these wired to my THC3T-02 (see manual in first post)
2 start plasma (type:input) -> I have these 2 wired to input pins # 11 & 15 of BoB
2 start machine motion (Type:output)-> I have these 2 wired to output pins # 16 & 17 of BoB
1 ground -> wired to ground pin in BoB

THC3T-02-> This according to the manual (screenshot attached) has the following wires (->& where I connected them):

DIR_IN -> Wired to BoB same pin which is connected to Z axis servo motor DIR-
STEP_IN -> Wired to BoB same pin which is connected to Z axis servo motor STEP-
+5V_IN -> BoB pin 5V OUT
DIR_OUT -> Wired to the Z axis servo motor DIR- 
STEP_OUT -> Wired to the Z axis servo motor STEP-
+5V_OUT -> Wired to Z axis servo motor DIR+ & STEP+ (2 wires)
ARC_OK -> Wired to BoB input pin # 12
EXT_COM -> BoB ground pin

Basically can anyone tell me if the above wiring is done correctly before I go into Mach/ESS settings and mess things up?

I have a small feeling the hypertherm CPC wires, specifically the start plasma (15VDC) and start machine motion (120VAC/1A) might need to be connected differently (see the machine interface cable signals picture)

Also attaching my ESS pins config & ESS H.C. tab settings, do I need to make changes in this tab?
Again any and all help will be appreciated..

-Regards P629

8
+Adding ESS Config Screenshots

9
Hello All,

I have spent a few weeks trying to 'convert' a working CNC spindle router into a plasma CNC table.
Equipment:
KL-1313 CNC Chinese router w/ ESS

THC3T-02 THC Controller
(https://drive.google.com/file/d/1I95619O-7Mhk3wCAXPJCjCMFu-Y32xKL/view)

Hypertherm powermax 45xp w/ machine torch and CPC interface cable.


Below is the breakout board my CNC has:
(https://www.automationtechnologiesinc.com/products-page/motion-controllers/cnc-6-axis-interface-breakout/)
 
Currently I cannot even jog my machine correctly (after upgrading smoothstepper) and i forgot to back up my old settings smh.

Any help would be greatly appreciated, If anyone is willing enough to get on screen share (or local to chicago area) i do have the means to make that possible.

im attaching screenshots of my wiring and configurations in Mach/ESS.

Please advise this blind man

-Regards P629

Pages: 1