SetSystemVariable?

Make your own CNC Control Apps

Moderator: cnckeith

Post Reply
Gerral
Posts: 33
Joined: Fri Nov 22, 2024 4:25 pm
Acorn CNC Controller: Yes
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: B4107B77A373-0905248481
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

SetSystemVariable?

Post by Gerral »

I know how to get a user variable using GetSystemVariable.

Is there a way to Set a user variable before a job is run. I can't find a SetSystemVariable.

Thanks!


ASPeters
Posts: 36
Joined: Thu Feb 10, 2022 5:55 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: SetSystemVariable?

Post by ASPeters »

Yes, CNCPipe.Job.SetSystemVariable(...) which has an overload for the string variables as well. Please note that #1-#149 are initialized to 0 before the beginning of a job and not every variable is writeable.

More information on variables can be found in the manual in section 11.2.16: https://www.centroidcnc.com/centroid_di ... manual.pdf


Gerral
Posts: 33
Joined: Fri Nov 22, 2024 4:25 pm
Acorn CNC Controller: Yes
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: B4107B77A373-0905248481
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: SetSystemVariable?

Post by Gerral »

I'm not finding it in the documentation when trying to use SetSystemVariable.

Code: Select all

public CentroidAPI.CNCPipe.ReturnCode SetUserVariable(int variableNumber, double newValue)
 {
     var cncPipe = new CentroidAPI.CNCPipe.Job(m_pipe);
     return cncPipe.SetSystemVariable(variableNumber, newValue);

 }
Results in:
'CNCPipe.Job' does not contain a definition for 'SetSystemVariable' and no accessible extension method 'SetSystemVariable' accepting a first argument of type 'CNCPipe.Job' could be found (are you missing a using directive or an assembly reference?)


ASPeters
Posts: 36
Joined: Thu Feb 10, 2022 5:55 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: SetSystemVariable?

Post by ASPeters »

What version of software are you using? The SetSystemVariable call was added in CNC12 v5.24


Gerral
Posts: 33
Joined: Fri Nov 22, 2024 4:25 pm
Acorn CNC Controller: Yes
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: B4107B77A373-0905248481
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: SetSystemVariable?

Post by Gerral »

We're using 5.22 ... time to upgrade?


ASPeters
Posts: 36
Joined: Thu Feb 10, 2022 5:55 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: SetSystemVariable?

Post by ASPeters »

If you want the single line call, yes. If you're not interested in upgrading, you can cheese it a little with

Code: Select all

public CentroidAPI.CNCPipe.ReturnCode SetUserVariable(int variableNumber, double newValue)
 {
     var cncPipe = new CentroidAPI.CNCPipe.Job(m_pipe);
     string command = "#" + variableNumber + " = " + newValue;
     return cncPipe.RunCommand(command, "C:\\cncm", false);

 }
which would have the same effect though is much slower to perform.


Gerral
Posts: 33
Joined: Fri Nov 22, 2024 4:25 pm
Acorn CNC Controller: Yes
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: B4107B77A373-0905248481
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: SetSystemVariable?

Post by Gerral »

No thank you, I'm already writing multiline "macros" to do something similar... this is too good.


Post Reply