I am working on an app for an Okuma lathe.
I would like to be able to put the lathe into an alarm state from the app. I am not getting any errors and the app runs on the machine, but it doesn't go into an NC alarm state.
The line before it does change the text of alarmLabel.
I am using alarmLabel for troubleshooting.
Can anyone provide an example of SetUserAlarm in C#?
Does anyone see what is wrong with my code?
alarmLabel.Text = "Alarm ON";
objCMDMachine.SetUserAlarm(
Okuma.CLCMDAPI.Enumerations.UserAlarmEnum.C,
"Test Alarm",
Okuma.CLCMDAPI.Enumerations.UserAlarmSubSystemEnum.All
);
Your example code there looks okay to me.
To successfully generate a machine alarm, the API must have the licensed feature UserAlarm
.
(Okuma.Lathe.UserAlarm in the okuma.api.lic license file).
You can confirm that a machine has this option by using the SCOUT library:
UserAlarmLathe = Okuma.Scout.LicenseChecker.License_UserAlarm_L; if (UserAlarmLathe.Status == Enums.LicenseStatus.Valid) { // ... }
Additionally, the machine on which the API resides must also have the THiNC ALARM
option.
If your machine does not have the option, it can be ordered by contacting your Okuma Distributor and asking for option code " :911-0010 - THiNC ALARM "
The presence of this option can be confirmed by checking the Lathe Spec Code NC-B No. 4, Bit 3
. You can check this spec code in your application using either THINC API or SCOUT.
Okuma.CLDATAPI.DataAPI.CSpec SpecCodeClass = new Okuma.CLDATAPI.DataAPI.CSpec(); bool THiNK_ALARM = SpecCodeClass.GetBSpecCode(4, 3); if (THiNK_ALARM) { // ... }
if (Okuma.Scout.SpecCode.NCB.MachineSpecCodeFileExists) { if (Okuma.Scout.SpecCode.NCB.SpecFileIsValid) { bool THiNK_ALARM = Okuma.Scout.SpecCode.NCB.Bit( Okuma.Scout.Enums.NCBSpecGroup.NCB1MG, 4, 3); if (THiNK_ALARM) { // ... } } }