macro to write point to file in cnc12 with Acorn

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
Timothy Clement
Posts: 7
Joined: Sat Mar 11, 2023 6:45 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: acorn 6810
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

macro to write point to file in cnc12 with Acorn

Post by Timothy Clement »

Hello all,
I want to use a laser mounted in the non-rotating spindle as a pointer for digitizing where a probe cannot do the job (with my Acorn controlled mill). I move the spindle to the point with jogging and want to write the point to a file, move to the next point and write to file, etc. I have tried using the macro "probe_write_point_to_file.cnc" that is included with CNC12 v5.04but without success.
Does anyone have an example of a successful macro implementation of writing a point to a file?
Thanks
Tim


centroid467
Posts: 786
Joined: Thu Apr 14, 2022 2:46 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: No
CNC11: No
CPU10 or CPU7: No

Re: macro to write point to file in cnc12 with Acorn

Post by centroid467 »

probe_write_point_to_file.cnc is only used for internal probing routines and requires some extra setup if you were going to call it yourself.

You should probably write your own for this one. The macro should be pretty simple: open/create the file in append mode with M121 and write positions to it with M122. If you need formatting other than M122 provides then you can access the position variables (X is #26101, Y is #26102, etc) and print them to the file with M123 or M223 calls. You'll have to change the filename in the macro every time you do a different job if you go this simple route.

Something like this:

Code: Select all

M121 "my_file_name.cnc"	; Create or open file
M122 ; This comment will be written to the file
or this:

Code: Select all

M121 "my_file_name.cnc"	; Create or open file
M223 "X distance: %9.6f Y distance: %9.6f Z height: %9.6f" #26101 #26102 #26103
should do what you want.


Timothy Clement
Posts: 7
Joined: Sat Mar 11, 2023 6:45 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: acorn 6810
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: macro to write point to file in cnc12 with Acorn

Post by Timothy Clement »

Thanks for the reply centroid467. That was just the information I needed to get a macro working properly.

Tim


centroid467
Posts: 786
Joined: Thu Apr 14, 2022 2:46 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: No
CNC11: No
CPU10 or CPU7: No

Re: macro to write point to file in cnc12 with Acorn

Post by centroid467 »

No problem, happy to help!


Post Reply