玉环普天1 发表于 2022-10-10 12:52:07

海斯斯康PCDIMS二次开发资料

找了好久,才找到这个资料,原来在安装盘上就有。看懂这个资料,需要有VB程序基础。不过功能确实强大。在此,分享给大家

gfdsa.12345 发表于 2022-10-13 09:51:29

你这是4.3版的啊

玉环普天1 发表于 2022-10-14 16:25:34

4.3版能学好就很厉害了。2021版更复杂。我认为还是从简单开始,更容易入门。

lyjever 发表于 2022-10-14 16:48:40

感谢分享,以后有二次开发的问题还要向您请教

huangwang 发表于 2024-10-9 11:46:02

using PCDLRN;
namespace PCDMIS
{
    internal static class ConnectPcDMIS
    {
      public static Application? Application;
      public static PartProgram? PartProgram;
      public static Commands? Commands;
      public static bool PCdmisState;

      public static Commands? GetCommands()
      {
            Type? comType = null;
            object? comObj = null;
            try
            {

                comType = Type.GetTypeFromProgID("PCDLRN.Application");
                //从进程中获取正在运行的PCDMIS程序

                comObj = Activator.CreateInstance(comType);
                //创建一个实例。

                Application = comObj as PCDLRN.Application;
                //将这个实例强制转换成 PCDMIS的Application对象。

                PartProgram = Application.ActivePartProgram;
                //获取到Application对象当前处于激活状态的 PartProgram对象。

                if (PartProgram != null)
                {
                  //如果PartProgram对象不为空。

                  Commands = PartProgram.Commands;
                  //获取到Commands对象。
                  // Debug.WriteLine(Commands.Count);
                  PCdmisState = true;
                }



                else
                {
                  PCdmisState = false;
                  return null;
                }


            }
            catch (System.Exception em)
            {
                PCdmisState = false;
                return null;
            }

            return Commands;
      }
    }
}
页: [1]
查看完整版本: 海斯斯康PCDIMS二次开发资料