Re: Macro to except a String Variable
Posted: Fri Feb 02, 2018 2:09 pm
I think it already Excepts the string. But you probably want it to Accept it.
UCCNC machine control software support forum
https://forum.cncdrive.com/
M1000 (this all text will go to variable msg)
// ================================================================================================
string myLine = exec.Getcurrgcodelinetext();
string msg = "";
int posF = 0;
int posL = 0;
if (myLine != null)
{
posF = myLine.IndexOf("(");
if (posF != -1)
{
posL = myLine.LastIndexOf(")");
if (posL > posF)
msg = myLine.Substring(posF + 1, posL - posF - 1);
}
}
if (msg != "")
{
// --- Now msg contains the full text of the remark between ( and ) ---
// WRITE YOUR CODE HERE
}
// ================================================================================================
Vmax549 wrote:HI Dezsoe, LinuxCNC has been handling strings for a long time now as are other controllers.
The only value type supported by parameters is floating-point; there are no string, boolean or integer types in G-code like in other programming languages.
The command is calling a NAME(string) then it refers to a number internally
<holediam> = 25.33
Also I believe they used teh same approach with M98
M98<BoltCircle> L1 Calls a remote sub named BoltCircle
A lot of controls use strings for various features.