Page 1 of 2

Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Mon Nov 25, 2024 5:56 pm
by mikes
I suspect what I'm about to present has already been contributed by another forum member, but I couldn't find anything like it, so I am sharing it here.

I wanted a simple and safe tool touch off workflow that would be compatible with my normally closed (NC) touch-off device. It's an inexpensive mechanical unit from my friend Amazon. I found one of the shared macros (thanks Scott), but it had some extras I didn't think necessary, and one missing part I thought very important. That is, checking to make sure the touch-off device was connected and not accidentally or defectively in a tripped state. Now, you should know, this is my first macro, but I have what one may say is a fairly extensive programing background. However, I'm not sure that help, as the Centroid macro language is a bit of an odd duck. No offence, and I am sure it has lots of history, and engineering thought went into its design, but man it's a throwback to BASIC without all the good things BASIC has :lol: :P ;) . That said, it is what it is, and I'm more interested in making what I want work, then bad mouthing (I know to late).

There are some things to point out about the macro. It makes extensive use of the DEFINE statement. From a programing constructs perspective, there is much lacking in the macro language, but the DEFINE statement is one of the jewels, I don't see it used anywhere near it should, even the macros from Centroid. I don't know about you, but I don't think #4014 is very descriptive, and adding a comment everywhere a parameter is used to explain what #4014 is, just doesn't make sense. Ok, ok, off my soapbox.

Back to what is different about this macro. With a NC tool touch off device, you know if its connected, as you will see a high (set) input when its is connected and not tripped. Testing for this before moving forward with the actual touch-off, I propose is a safer workflow. The macro looks to see if a NC touch-off device has been configured, and if so checks as described. For a NO (normally open) device, no checks are performed. Have a look and use it if you like. I think I will be enhancing it more to use some of the other configuration parameters, like turning off validations, and not subtracting the height of the touch of device. Not sure when these are useful, but the Wizard give the option.

Last but not least, below is a video of the macro in action. Please let me know if you like it, or think I got something wrong. As I said it is my first.


Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Mon Nov 25, 2024 6:31 pm
by cncsnw
"Video unavailable" / "This video is private"

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Mon Nov 25, 2024 7:37 pm
by corbin
I wish I would have known about DEFINES a little earlier..I think that helps clean up the macro programming a lot!

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Mon Nov 25, 2024 8:27 pm
by cnckeith
Right on, thanks for posting, looking forward to seeing the video.

Centroid Macro's are not the answer to everything. It is an 'easy' way (Stage 1) for most newbies to modify existing or create new custom feature instructions from the simple to moderately complex to suit the application and individual tastes for how they want things to work.

Stage 2: Centroid's PLC Programming Language which is much more than just ladder logic programming and has powerful controls that can be used to manipulate CNC12 functionality in wide variety of ways. Centroid put a lot of the "control" into the PLC program so the user/integrator can tailor CNC12 to the application at hand. https://www.centroidcnc.com/centroid_di ... manual.pdf

Stage 3: Centroid APi. https://centroidcncforum.com/viewforum.php?f=72

All three of these Centroid CNC control tools (macro programming, plc programming language/compiler/detective , and CNC APi calls) are Free.

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Mon Nov 25, 2024 10:03 pm
by mikes
Sorry about the video. I'm not much of a YouTuber. I had it all configured, and neglected to click the publish button. Next time I'll verify in an incognito session. Please try now.

Keith,

Thanks for pointing out the additional tools. I will look deeper. I must say I'm impressed with all the effort Centroid has put into the Acorn and its siblings and cousins. It is nice to see how both the hardware and software have grown since the Acon's introduction. I have no regrets in selecting it for my build.

Mike

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Wed Nov 27, 2024 2:43 pm
by cnckeith
corbin wrote: Mon Nov 25, 2024 7:37 pm I wish I would have known about DEFINES a little earlier..I think that helps clean up the macro programming a lot!
page 231 in the CNC12 Mill Operator Manual. :D

https://www.centroidcnc.com/centroid_di ... manual.pdf

i'll add it to the introduction to macro programming guide as well since this is a nice way to make the macro more human readable.

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Wed Nov 27, 2024 2:56 pm
by cnckeith
mikes wrote: Mon Nov 25, 2024 10:03 pm Sorry about the video. I'm not much of a YouTuber. I had it all configured, and neglected to click the publish button. Next time I'll verify in an incognito session. Please try now.

Keith,

Thanks for pointing out the additional tools. I will look deeper. I must say I'm impressed with all the effort Centroid has put into the Acorn and its siblings and cousins. It is nice to see how both the hardware and software have grown since the Acon's introduction. I have no regrets in selecting it for my build.

Mike

right on thanks for the stoke, we try hard. and thanks for getting the video working. this is great! always love to see what our customers do with the tools we provide. looking forward to more!

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Wed Nov 27, 2024 2:58 pm
by suntravel
cnckeith wrote: Wed Nov 27, 2024 2:43 pm
corbin wrote: Mon Nov 25, 2024 7:37 pm I wish I would have known about DEFINES a little earlier..I think that helps clean up the macro programming a lot!
page 231 in the CNC12 Mill Operator Manual. :D

https://www.centroidcnc.com/centroid_di ... manual.pdf

i'll add it to the introduction to macro programming guide as well since this is a nice way to make the macro more human readable.
Chapter 11.4.4

Page 231 ;)

Uwe

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Wed Nov 27, 2024 3:33 pm
by cnckeith
thanks for catching the typo! fixed. 231 it is!

You can define your own text aliases using angle brackets (<>). This is a pure text replacement tool (with one
exception – any text found after a semicolon (‘;’) will be ignored as a comment), but can be quite useful.
To define an alias in your G-code program, use the word DEFINE followed by the name of your alias (in angled
brackets) and the text it will be replacing.
For example, consider the following G-code program:
G17 G90 F25
G00 X1 .0 Y1 .0 Z0 .0
G02 X2 .0 Y2 .0 Z0 .0 R -1.0
Using the angle bracket defines, we could write:
; Definitions begin here
DEFINE <XY_PLANE > G17
DEFINE <ABSOLUTE_POSITIONING > G90
DEFINE <FEEDRATE > F
DEFINE <RAPID_POSITIONING > G0
DEFINE <START_POSITION > X1 .0 Y1 .0 Z0 .0
DEFINE <CLOCKWISE_ARC > G02
DEFINE <END_POSITION > X2 .0 Y2 .0 Z0 .0
DEFINE <BIG_ARC_RADIUS > R -1.0
; Actual job begins below
<XY_PLANE > <ABSOLUTE_POSITIONING > <FEEDRATE >25
<RAPID_POSITIONING > <START_POSITION >
<CLOCKWISE_ARC > <END_POSITION > <BIG_ARC_RADIUS >
This can make your G-code programs both more readable and understandable.

Re: Enhanced Tool Touch Off Macro (mfunc6.mac)

Posted: Wed Nov 27, 2024 6:43 pm
by corbin
Yeah, it was my fault! I had grabbed an old copy of the manual that I first read before I saw this; It might have been from Avid's site.

Corbin