Page 1 of 2
Macro Question
Posted: Tue Jun 12, 2018 9:29 am
by cbb1962
I know that there are no stupid questions; just stupid people.
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
Re: Macro Question
Posted: Wed Jun 13, 2018 8:02 am
by martyscncgarage
cbb1962 wrote: ↑Tue Jun 12, 2018 9:29 am
I know that there are no stupid questions; just stupid people.
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
Re: Macro Question
Posted: Wed Jun 13, 2018 9:46 am
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.
Re: Macro Question
Posted: Mon Jul 16, 2018 7:23 pm
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.
Re: Macro Question
Posted: Tue Jul 17, 2018 12:13 am
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]
Re: Macro Question
Posted: Tue Jul 17, 2018 7:13 pm
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);
}
}
}
Re: Macro Question
Posted: Thu Oct 18, 2018 4:41 pm
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:
Hope this helps.
BTW if anybody knows how to access the tool description from the CNC12 Tool Library, please let me know.
-swissi
Re: Macro Question
Posted: Fri Oct 19, 2018 1:12 pm
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.
Re: Macro Question
Posted: Sat Oct 20, 2018 4:40 pm
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
Re: Macro Question
Posted: Sat Oct 20, 2018 5:29 pm
by cnckeith
very nice! thanks for posting. k