Hello Guest it is December 06, 2019, 12:35:41 PM

Author Topic: Digitizing in Mach 4  (Read 241 times)

0 Members and 1 Guest are viewing this topic.

Digitizing in Mach 4
« on: July 19, 2019, 01:03:39 AM »
I've just finished a new CNC router (CNCRP Benchtop Pro 2436) and I've yet to install the control software. 

I'm using the Ethernet Smoothstepper for machine control and I'd like to use Mach 4 but digitizing is a large part of my intended work flow, using a touch probe and the point-of-nails method of point cloud generation.

I can't seem to find any information on if Mach 4 includes a digitizing wizard or if there is a plugin available for it.  Can someone confirm that this is possible with Mach 4 or one of its plugins and possibly point me in the right direction?   

I can use Mach3 if I have to but I'd really rather utilize the newer and fully-supported software if possible.

Thanks!

Offline Chaoticone

*
  • *
  •  5,633 5,633
  • Precision Chaos
    • View Profile
Re: Digitizing in Mach 4
« Reply #1 on: July 19, 2019, 10:14:53 AM »
It is definitely doable in Mach4 but there is no plugin or script included that will. You will have to do some scripting. I did post some script on this forum sometime ago that does most of what you want though. It should get you off to a real good start. See what you can do and myself and others will try to help.

https://www.machsupport.com/forum/index.php?topic=35896.msg246530;topicseen#msg246530
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Digitizing in Mach 4
« Reply #2 on: July 19, 2019, 06:11:15 PM »
More learning curve, yay!

Seriously though, thanks for the info and the link.  As I have 0 scripting knowledge I'd better get started.

Offline dws

*
  •  18 18
    • View Profile
Re: Digitizing in Mach 4
« Reply #3 on: August 07, 2019, 11:12:16 PM »
I used a slightly different approach to digitizing an item using "mc.mcCntlProbeFileOpen". This code works for me. I am new to scripting; and, am suprised about how little code this requires. However, it will grow if a user interface is added to obtain parameters. I have just been editing the parameters within the script. I may add a user interface if I were to use this more frequently.

Code: [Select]
ProbeSurface = coroutine.create(function()
 
  inst=mc.mcGetInstance()
  local GridX = 0.1  -- Spacing of X probing
  local GridY = 0.1  -- Spacing of Y probing
  local ProbeX = 0   -- X Work Coordinates of Probe Start
  local ProbeY = 0   -- Y Work Coordinates of Probe Start
  local ProbeZ = mc.mcAxisGetPos(inst,mc.Z_AXIS) -- work coordinate starting location 
  local ProbeXmax = 2 -- Width of Part
  local ProbeYmax = 0.2 -- Height of Part
  local ProbeZdist = .5   -- Distance to probe Z axis 
  local ProbeRate = 5.0 -- Inches per Minute
  local JogRate = 20 -- Inches per Minute
  local File = "C:\\Mach4Hobby\\GcodeFiles\\ProbeValues.csv" -- Path and filename to save the mapped points
 
  mc.mcCntlProbeFileOpen(inst, File, "%.3AXIS_X, %.3AXIS_Y, %.4AXIS_Z \n" ,true)  -- Open and format the file to write the XYZ coordinates

  wx.wxMessageBox("This will map the surface of a part and save the XYZ coordinates to the file.")
     
repeat

ProbeX = 0

-- Jog to Y probe Location
mc.mcCntlGcodeExecute(inst,"G90 G01 Y" ..ProbeY.. " F" .. JogRate)
coroutine.yield()

repeat
-- Jog to X probe Location
mc.mcCntlGcodeExecute(inst,"G90 G01 X" ..ProbeX.. " F" .. JogRate)
coroutine.yield()

-- Probe for Z
mc.mcCntlGcodeExecute(inst,"G91 G31.0 Z-" ..ProbeZdist .. " F".. ProbeRate) 
coroutine.yield()

mc.mcCntlGcodeExecute(inst,"G90 G01 Z" ..ProbeZ.." F" .. JogRate)
coroutine.yield() 
 
ProbeX = ProbeX + GridX

until (ProbeX > ProbeXmax + 0.001)

ProbeY = ProbeY + GridY
until (ProbeY > ProbeYmax + 0.001) 

mc.mcCntlProbeFileClose(inst) --close probe file

   
  mc.mcCntlSetLastError(inst, "Probing Complete")
 
  mc.mcCntlReset(0)

end)


Code: [Select]
-----------------------------------------------------------
--Coroutine ProbeSurface
-------------------------------------------------------------
if (ProbeSurface ~= nil) and (machState == 0) then --ProbeSurface exist and state == idle
local state = coroutine.status(ProbeSurface)
    if state == "suspended" then --ProbeSurface is suspended
        coroutine.resume(ProbeSurface)
    end
end

-David
David