Macro Question

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

cbb1962
Posts: 349
Joined: Wed Jan 03, 2018 10:04 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 38D2695C8301-0122180576
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: NW Arkansas

Macro Question

Post by cbb1962 »

I know that there are no stupid questions; just stupid people. :roll:

Is there a tool like intercon to help create macros and debug them? I know that Mach3 had a tool that did this. Or is the CNC11 programmer's manual the best resource to learn?

Thanks,
Clint
Clint in NW Arkansas

The more I learn, the more I realize I don't know...


martyscncgarage
Community Expert
Posts: 9951
Joined: Tue Mar 28, 2017 12:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Location: Mesa, AZ

Re: Macro Question

Post by martyscncgarage »

cbb1962 wrote: Tue Jun 12, 2018 9:29 am I know that there are no stupid questions; just stupid people. :roll:

Is there a tool like intercon to help create macros and debug them? I know that Mach3 had a tool that did this. Or is the CNC11 programmer's manual the best resource to learn?

Thanks,
Clint
Not that I am aware of Clint.
I would suggest posting what you are trying to do on the forum under its own thread.
Marty
Reminder, for support please follow this post: viewtopic.php?f=20&t=383
We can't "SEE" what you see...
Mesa, AZ


cbb1962
Posts: 349
Joined: Wed Jan 03, 2018 10:04 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 38D2695C8301-0122180576
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: NW Arkansas

Re: Macro Question

Post by cbb1962 »

Thank you, Marty.

I have nothing specific in mind, I'm just trying to understand the syntax on the tool setting macros. Do you know if there a macro creation tool in the works? Since Acorn is going after the DIY/Hobbyist market this could be useful.

I've looked at the Tech Bulletin #300 titled: "Creating a Custom Macro (All)" but once you open it the actual title is: "How to Setup Auxiliary Key Functionality using Canned and Custom M-codes" Nothing to help me learn how to program Macros.

In the meantime could someone that is familiar with creating Macros OR Centroid Tech Support make a video about the syntax, logic, and testing of macros? Or at least a Tech Bulletin that really does teach how to create custom macros?

Thanks.
Clint in NW Arkansas

The more I learn, the more I realize I don't know...


cbb1962
Posts: 349
Joined: Wed Jan 03, 2018 10:04 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 38D2695C8301-0122180576
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: NW Arkansas

Re: Macro Question

Post by cbb1962 »

I am wanting to display additional information about the tool to be changed during a tool change macro.

Code: Select all

M225 #106 "#)Please change tool to tool #%.0f\nPress Cycle Start to continue" #4120
This will display only the tool number.

I'm using Fusion360 to create g-code. This is how the post processor displays tool information in the G-Code:

Code: Select all

:T7  D=0.25 CR=0. - ZMIN=0. - flat end mill
I would like to display this additional information in the dialog box. Is this possible to pull this information from a g-code program? or can this functionality be added to the Router version?

I would like to display something like this:
"Please change tool to T7 D=0.25 CR=0. - ZMIN=0. - flat end mill"
Press Cycle Start to continue.
Clint in NW Arkansas

The more I learn, the more I realize I don't know...


cncsnw
Community Expert
Posts: 4558
Joined: Wed Mar 24, 2010 5:48 pm

Re: Macro Question

Post by cncsnw »

There is no way to extract text from a comment line in the CNC file.

You could potentially change your Fusion 360 postprocessor so that it stores that piece of text in a string variable instead. Then you could refer to that string variable in the M225 prompt string.

E.g.

Code: Select all

#300 = "T7  D=0.25 CR=0. - ZMIN=0. - flat end mill"
; ...
M225 #106 "#)Please change tool to tool #%s\nPress Cycle Start to continue" #300
or, if you want the descriptions for multiple tools to all appear at the top of the program, and provided you do not use any tool above T99:

Code: Select all

#307 = "T7  D=0.25 CR=0. - ZMIN=0. - flat end mill"
; ...
M225 #106 "#)Please change tool to tool #%s\nPress Cycle Start to continue" #[300+#4120]


cbb1962
Posts: 349
Joined: Wed Jan 03, 2018 10:04 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 38D2695C8301-0122180576
DC3IOB: No
CNC11: No
CPU10 or CPU7: No
Location: NW Arkansas

Re: Macro Question

Post by cbb1962 »

Your idea is intriguing, I like it!

I found the section in the Post that creates the comment, but I don't have a clue on how to do as you suggested. Are there any post guru's that could help me?

Code: Select all

    var tools = getToolTable();
    if (tools.getNumberOfTools() > 0) {
      for (var i = 0; i < tools.getNumberOfTools(); ++i) {
        var tool = tools.getTool(i);
        var comment = "T" + toolFormat.format(tool.number) + "  " +
          "D=" + xyzFormat.format(tool.diameter) + " " +
          localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
        if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
          comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
        }
        if (zRanges[tool.number]) {
          comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum());
        }
        comment += " - " + getToolTypeName(tool.type);
        writeComment(comment);
      }
    }
  }
Clint in NW Arkansas

The more I learn, the more I realize I don't know...


swissi
Posts: 603
Joined: Wed Aug 29, 2018 11:15 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 985DADEB24D5-0309180716
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Macro Question

Post by swissi »

It's been a while since this questions was asked but if you are still looking for a solution, this here will work:

Search in your Post Processor file for the "function onSection()" (around line 400) and in that function, look for the line "writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));"
Right above that line, insert the following code:

Code: Select all

    var toolinfo = "#300 = "
    toolinfo += "\"T" + toolFormat.format(tool.number) + "  " +
      "D=" + xyzFormat.format(tool.diameter) + " " +
      localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
    if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
      toolinfo += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
    }
    toolinfo += " - " + getToolTypeName(tool.type) + "\"";
    writeln(toolinfo);
This will add the Tool Info from Fusion360 in front of each M6 Tool-Change command. The G-Code file will look like this:
N10 G90 G94 G17
N15 G21
N20 G28 G91 Z0.
N25 G90
:Face1
#300 = "T1 D=50. CR=0. - face mill"
N30 T1 M6
Add the following command into your mfunc6.mac file:

Code: Select all

M225 #106 "#)Insert Tool #%.0f\n%s\nD:%.3f    H:%.3f\n\nPress Cycle Start to continue" #4120 #300 #[11000 + #4120] #[10000 + #4120]
This will add the tool info from Fusion360 onto the first line and the 2nd line does have the tool diameter and Tool Height Offset from the CNC12 Tool library so you can compare if the info matches.

The prompt in CNC12 looks like this:

ScreenshotToolChangeCrop.jpg
Hope this helps.

BTW if anybody knows how to access the tool description from the CNC12 Tool Library, please let me know.

-swissi
If you are using any Probing Device, a Rack ATC or want a more efficient Work Flow, check out CHIPS

Contact me at swissi2000@gmail.com


cnckeith
Site Admin
Posts: 8924
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: Macro Question

Post by cnckeith »

swissi wrote: Thu Oct 18, 2018 4:41 pm

BTW if anybody knows how to access the tool description from the CNC12 Tool Library, please let me know.

-swissi
fyi...I submitted this as a feature request to be added to future release of cnc12.
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html


swissi
Posts: 603
Joined: Wed Aug 29, 2018 11:15 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 985DADEB24D5-0309180716
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Macro Question

Post by swissi »

Thanks Keith for the info regarding the new feature request to get access to the CNC12 Tool Description.

I made some improvements to the Post Processor code I posted above.

With this code, the "#300 = " line will also get a N-sequence-number when the Property "Use sequence numbers" is set to "Yes" and the whole line will be suppressed when the Property "Write tool list" is set to "No".

Here's the improved code:

Code: Select all

if (properties.writeTools) {
       var toolinfo = "#300 = "
       toolinfo += "\"T" + toolFormat.format(tool.number) + "  " +
         "D=" + xyzFormat.format(tool.diameter) + " " +
         localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
       if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
        toolinfo += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
       }
       toolinfo += " - " + getToolTypeName(tool.type) + "\"";
       writeBlock(toolinfo);
}
-swissi
If you are using any Probing Device, a Rack ATC or want a more efficient Work Flow, check out CHIPS

Contact me at swissi2000@gmail.com


cnckeith
Site Admin
Posts: 8924
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: Macro Question

Post by cnckeith »

very nice! thanks for posting. k
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html


Post Reply