cncdrive wrote:Yes, there is one in the macro capability detailed document in the /Documentation folder of the UCCNC.
I'm copying the example below:
Function: void Codelist(List<string> codelist)
Description: This function is similar to the Code function, but it executes not only a single, but multiply lines of g-codes from inside a macro. The g-code lines are sent as a string List in the parameter of the function and are interpreted in execution time. This function differs from calling multiply Code functions, because the Codelist function loads all the code lines the same time into the motion control API, so the lines are optimised by the Constant velocity interpolator while the multiply Code function calls are executed one-by-one separately.
Example:
List<string> codelist = new List<string>(); //Create a new List of strings.
codelist.Add("G0 Z-25"); //Add g-code lines to the List.
codelist.Add("M3");
codelist.Add("G1 X0 Y0 F500");
codelist.Add("#5 = 12.23");
codelist.Add("G1 X#5 Y2");
exec.Codelist(codelist); //Execute the List of g-codes.
How it works is simple, you create a List of strings and you add the code lines to the list and finally pass the list as parameter to the exec.Codelist function.
This is great! So we only need to define the code list once and inside the same macro just call the list any number of times like this:
List<string> codelist = new List<string>(); //Create a new List of strings.
codelist.Add("G0 Z-25"); //Add g-code lines to the List.
codelist.Add("M3");
codelist.Add("G1 X0 Y0 F500");
codelist.Add("#5 = 12.23");
codelist.Add("G1 X#5 Y2");
... some lines of macro code ...
exec.Codelist(codelist); // First execution the List of g-codes
... some more lines of macro code ...
exec.Codelist(codelist); // Second execution the List of g-codes
...and so on.
Very useful. Right now I am busy writing probe macro codes, and in some of them I need to repeatedly add the same code, but with this new feature that's simply done. Makes the code nicer looking. Just one question... do we need while(exec.IsMoving()) or is that included in the exec.Codelist(codelist)? It would be nice if it was included...