apiokuma

Best method for initializling the Okuma API if I want a program that works for both lathe and mills?


I am writing a program that will run on both lathe and machining centers. How best can I initialize the API without doing during loading. Should I call a class for each machine type or can I call each (and close them) within the same class?

Added example of current method for just Lathe...

 using Okuma.CLDATAPI.DataAPI;
 using Okuma.CLDATAPI.Enumerations;
 using Okuma.CLDATAPI.Structures;
 using Okuma.CLDATAPI.DataAPI.MacMan;

 public class LatheDutyOnline
 {
 private CMachine Objl;
 private CVariables Objlv;
 private CIO IO;
 private CATC ObjAtc;
 private CAxis objaxis;
 private CBallScrew objBS;
 private CProgram objProgram;
 private CSpec objSpec;
 private CSpindle objSpindle;

 private void Form1_Load(System.Object sender, System.EventArgs e)
    {
        Objl = new CMachine();
        Objl.Init();
        Objlv = new CVariables();
        IO = new CIO();
        ObjAtc = new CATC();
        objaxis = new CAxis();
        objBS = new CBallScrew();
        objProgram = new CProgram();
        objSpec = new CSpec();
        objSpindle = new CSpindle();
    }

Solution

  • You need a routine to check the current machine type. Something like this:

    Private Sub CheckMachineType()  
        If System.IO.File.Exists("C:\OSP-P\SHAREDDLL\LDATAPI.DLL") And   System.IO.File.Exists("C:\OSP-P\VOLANTE\CRAD\LCMDAPI.EXE") Then  
            MachineType = Lathe  
        ElseIf System.IO.File.Exists("C:\OSP-P\SHAREDDLL\MDATAPI.DLL") And System.IO.File.Exists("C:\OSP-P\VOLANTE\CRAD\MCMDAPI.EXE") Then    
            MachineType = MachiningCenter  
        Else  
            MachineType = NonOSP  
        End If
    End Sub
    

    Then you can initialize the correct API type based on the value of MachineType.


    UPDATE

    We now have a standard machine agnostic library that is perfect for this.
    Please have a look at the sample program for SCOUT.