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!
SetSystemVariable?
Moderator: cnckeith
-
- 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?
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- 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?
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
More information on variables can be found in the manual in section 11.2.16: https://www.centroidcnc.com/centroid_di ... manual.pdf
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- 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?
I'm not finding it in the documentation when trying to use SetSystemVariable.
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?)
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);
}
'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?)
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- 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?
What version of software are you using? The SetSystemVariable call was added in CNC12 v5.24
1 user liked this post
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- 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?
We're using 5.22 ... time to upgrade?
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- 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?
If you want the single line call, yes. If you're not interested in upgrading, you can cheese it a little with
which would have the same effect though is much slower to perform.
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);
}
1 user liked this post
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- 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?
No thank you, I'm already writing multiline "macros" to do something similar... this is too good.
(Note: Liking will "up vote" a post in the search results helping others find good information faster)