工欲善其事 必先利其器
PC-Dmis 二次开发
首先要对VB熟悉
PC-DMIS的自动化功能使您能够在定制的应用程序中自动执行PC-DMIS中的重复任务,甚至使用PC-DMIS功能的元素。
PC-DMIS Automation具有以下优点:
dim a! '定义单精度Single型变量a
dim a@ '定义Currence型变量a
dim a# '定义双精度Double型变量a
dim a$ '定义a为字符串tring
dim a% '定义a为整型变量integer
dim a& '定义a为长整型变量long
IF 条件 THEN
语句
END IF
实例:
If a > 0 Then
Msgbox "a>0"
Else
Msgbox "a<0"
End If
一般PC-Dmis开发涉及到获取 Properties,Events,Methods。用的最多的是Properties,Method。
有两个方法获取
不管用哪种方法都需要: –创建变量-----然后并指向对应Objects
示例代码如下
'Step 1: Declare the pointer variable name for the application by using the "DIM" statement. For example:
Dim App As Object
'Step 2: Set the pointer variable to the PCDLRN Application using CreateObject. For example:
Set App = CreateObject("PCDLRN.Application")
'Step 3: Declare and set additional pointer variable names for any needed sub objects found within the Application object. For example if you wanted to access commands available for the active measurement routine, you're code would look something like this:
Dim Part As Object
Set Part = App.ActivePartProgram
Dim Cmds As Object
Set Cmds = Part.Commands
Dim Cmd As Object
Set Cmd = Cmds.Add(SET_COMMENT, True)
凡事必留名