如果我想要一个适用于车床和铣床的程序,初始化 Okuma API 的最佳方法是什么? [英] Best method for initializling the Okuma API if I want a program that works for both lathe and mills?

查看:64
本文介绍了如果我想要一个适用于车床和铣床的程序,初始化 Okuma API 的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个可以在车床和加工中心上运行的程序.如何最好地初始化 API 而无需在加载期间进行.我应该为每种机器类型调用一个类,还是可以在同一个类中调用每个类(并关闭它们)?

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();
    }

推荐答案

您需要一个例程来检查当前机器类型.像这样:

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

然后可以根据 MachineType 的值初始化正确的 API 类型.

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

我们现在有一个标准的机器不可知库,非常适合这个.
请查看 SCOUT 的示例程序.

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

这篇关于如果我想要一个适用于车床和铣床的程序,初始化 Okuma API 的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆