Macro for writing X,Y position to file

I’ve been diving into macros as a first time user of this code and have found it super interesting (and difficult).

I do a lot of slab furniture work and often times, I need to plot points for locations of cracks that I need to patch. I have been doing this manually - jogging the machine to the crack, writing down the X,Y coordinates, and plot several points in my CAD file to manually probe the location of the crack.

Ideally, I could set up one of the macro keys on my WMPG-6 (Pro5x10/EX/Centroid/CNC12) to write the current X,Y position and create a list in Notepad++. I would take that list into Rhino/Grasshopper where I would plot the points at once.

Looking around the forum, I had found an interesting thread regarding custom macros, and found it to be a great intro into how these codes work.

I thought I had found a possible solution from this thread. There is an existing macro in the “\cncm\system” folder named “probe_write_point_to_file” and I used that to rewrite “wmpgmacro4” in my macros folder for my user profile. Code below:

; Filename: probe_write_point_to_file.cnc
; Purpose: Write a point to the currently open data file
; Programmer: John Popovich
; Date: Nov 9, 2010
; Usage: G65 “/cncm/system/probe_write_point_to_file.cnc” X[x_position] Y[y_position] Z[z_position] D[skip_new_line]
; Where: x_position = x point
; y_position = y point
; z_position = z point
; skip_new_line = 1 to skip the new line
; Notes: A file must be open for output
; Copyright (C) 2011 Centroid Corporation, Howard, PA 16841

if [#24901] then M223 "%c %f " #20101 #24
if [#24902] then M223 "%c %f " #20102 #25
if [#24903] then M223 "%c %f " #20103 #26
if [#24904] then M223 "%c %f " #20104 #5044
if [#24905] then M223 "%c %f " #20105 #5045
if [#d != 1] then m223 “\n”

The macro won’t run when I have my machine on and notepad open. Is this something that will only run with a probe attached? Or am I going about this in the completely wrong way?

I have greatly appreciated all the knowledge in this forum - super inspiring!

Mahalo,

Scott

I would like to have a macro also like you describe
I had a program I ran with Mach 4 that recorded the position to a file each time I pressed the enter button on the keyboard. I could then upload that file to Vcarve and it would plot the vectors defined by the points.

I did a little research and was thinking about trying the:

M121: open data file append

M124: record machine position

I just have not had time to go any further.

Standing by

You’re on the write track here… You can open a data file and you can write the current machine position out to a file. That’s a classic digitizing workflow.

You can use something like G code ripper to take your digitized moves and turn them into DXFs that you can bring back into your CAM tool

Thanks guys, I’ll keep trying things.

One question on the code I posted above:

Does the code above rely on a probing macro to initiate? Or is this type of code able to run from the home screen when I hit the WPMG button assigned to this code? I’m having trouble deciphering the workflow in the code.

Thanks again