hexagon logo

Modifying PCDMIS Array Variable with External Command

I want to build PCDMIS array variables externally using an EXE. As we all know, doing so within PCDMIS with a loop is slooowwwww. 

I can change simple String or Long value variables.  However, arrays are an issue.

PCDMIS Basic and PCDMIS Automation reference the methods GetVariableValue, SetVariableValue, GetArrayIndexValue, and SetArrayIndexValue.

The first two animals work.

The latter two (GetArrayIndexValue, and SetArrayIndexValue) do NOT seem to work. I get Server Automation errors with SetArrayIndexValue and zero values using GetArrayIndexValue.

Any thoughts? Clever ideas and insults welcome.

Thanks,

-Mike

Parents
  • The "GetArrayIndexValue" method returns an object of variable type. Accessing the property "DoubleValue" of that object gets you the values. See below ...

    // PC-DMIS
    ASSIGN/ARRAY_VAR=ARRAY(4, 3, 1, 0, 6, 2)
    
    //BAS MODULE
    Option Explicit
    
    Public pcdApp As Object
    Public pcdProgram As Object
    Public pcdVariable As Object
    Public pcdArray As Object
    
    Sub Main()
    Dim I As Long
    
    Set pcdApp = GetObject(Chr$(0), "PCDLRN.Application")
    Set pcdProgram = pcdApp.ActivePartProgram
    Set pcdVariable = pcdProgram.GetVariableValue("ARRAY_VAR")
    
    For I = 1 To (pcdVariable.GetArrayUpperBound - 1)
      Set pcdArray = pcdVariable.GetArrayIndexValue(I)
      MsgBox pcdArray.DoubleValue, 0, "Title"
    Next I
    
    Set pcdArray = Nothing
    Set pcdVariable = Nothing
    Set pcdProgram = Nothing
    Set pcdApp = Nothing
    End Sub

Reply
  • The "GetArrayIndexValue" method returns an object of variable type. Accessing the property "DoubleValue" of that object gets you the values. See below ...

    // PC-DMIS
    ASSIGN/ARRAY_VAR=ARRAY(4, 3, 1, 0, 6, 2)
    
    //BAS MODULE
    Option Explicit
    
    Public pcdApp As Object
    Public pcdProgram As Object
    Public pcdVariable As Object
    Public pcdArray As Object
    
    Sub Main()
    Dim I As Long
    
    Set pcdApp = GetObject(Chr$(0), "PCDLRN.Application")
    Set pcdProgram = pcdApp.ActivePartProgram
    Set pcdVariable = pcdProgram.GetVariableValue("ARRAY_VAR")
    
    For I = 1 To (pcdVariable.GetArrayUpperBound - 1)
      Set pcdArray = pcdVariable.GetArrayIndexValue(I)
      MsgBox pcdArray.DoubleValue, 0, "Title"
    Next I
    
    Set pcdArray = Nothing
    Set pcdVariable = Nothing
    Set pcdProgram = Nothing
    Set pcdApp = Nothing
    End Sub

Children