I'm new at VB programming inside PCDMIS. The first thing I'm trying to do is to get a variable from the part program and use it inside the script. What I've done is to follow the example wich comes in the pcdmis basic help file:
Inside the part program:
C1=COMMENT/INPUT,Please type an integer value.
ASSIGN/V1 = INT(C1.INPUT)
COMMENT/OPER,BEFORE SCRIPT: Variable is: ,V1
CS1=SCRIPT/FILENAME= D:\PROGRAM FILES\PCDMIS35\TEST2.BAS
FUNCTION/Main,,
STARTSCRIPT/
ENDSCRIPT/
and the script is the following:
Sub Main
Dim App As Object
Set App = CreateObject ("PCDLRN.Application")
Dim Part As Object
Set Part = App.ActivePartProgram
Dim Var As Object
Set Var = Part.GetVariableValue ("V1")
Dim I As Object
If Not Var Is Nothing Then
Var.LongValue = Var.LongValue + 1
Part.SetVariableValue "V1", Var
MsgBox "V1 is now: " & Var
Else
Msgbox "Could Not find variable"
End If
End Sub
the problem is that when I run the program, or the script from inside the basic editor, i get this error
OLE Automation object does not have a default value