hexagon logo

Help with OLE Automation

Now that I have information in a way that imports and exports the information correctly, I have been tasked with creating an OLE to automatically import the data into the SPC software. I have one that sort of works (as in opens the program, logs in, opens the right collection plan, etc) and I can get put in static information, but I am unsure how to call the information out of PC DMIS to have it be placed in the spots we need in the SPC software being used.

Has anyone else done this? Can anyone explain to me how find the variable and the measurement output in PC DMIS? I am using version 4.2 if that helps any.

Thanks so much.
Parents
  • Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 0.0034
    retval = DmisCommand.PutText ("0.0034", THEO_X, 0)
    ' Set Theoretical Y = 1.7866
    retval = DmisCommand.PutText ("1.7866", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = 0
    retval = DmisCommand.PutText ("0", THEO_I, 0)
    ' Set Theoretical J = 1
    retval = DmisCommand.PutText ("1", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = 0.0033
    retval = DmisCommand.PutText ("0.0033", MEAS_X, 0)
    ' Set Measured Y = 1.8212
    retval = DmisCommand.PutText ("1.8212", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.0016691
    retval = DmisCommand.PutText ("0.0016691", MEAS_I, 0)
    ' Set Measured J = 0.9999986
    retval = DmisCommand.PutText ("0.9999986", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = -1.2846
    retval = DmisCommand.PutText ("-1.2846", THEO_X, 0)
    ' Set Theoretical Y = 1.2531
    retval = DmisCommand.PutText ("1.2531", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_I, 0)
    ' Set Theoretical J = 0.7071068
    retval = DmisCommand.PutText ("0.7071068", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = -1.3032
    retval = DmisCommand.PutText ("-1.3032", MEAS_X, 0)
    ' Set Measured Y = 1.2725
    retval = DmisCommand.PutText ("1.2725", MEAS_Y, 0)
    ' Set Measured Z = 0.1675
    retval = DmisCommand.PutText ("0.1675", MEAS_Z, 0)
    ' Set Measured I = -0.7155769
    retval = DmisCommand.PutText ("-0.7155769", MEAS_I, 0)
    ' Set Measured J = 0.698534
    retval = DmisCommand.PutText ("0.698534", MEAS_J, 0)
    End Sub

    Sub Part3

    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = -1.8181
    retval = DmisCommand.PutText ("-1.8181", THEO_X, 0)
    ' Set Theoretical Y = -0.0349
    retval = DmisCommand.PutText ("-0.0349", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = -1
    retval = DmisCommand.PutText ("-1", THEO_I, 0)
    ' Set Theoretical J = 0
    retval = DmisCommand.PutText ("0", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = -1.8209
    retval = DmisCommand.PutText ("-1.8209", MEAS_X, 0)
    ' Set Measured Y = -0.0337
    retval = DmisCommand.PutText ("-0.0337", MEAS_Y, 0)
    ' Set Measured Z = 0.1676
    retval = DmisCommand.PutText ("0.1676", MEAS_Z, 0)
    ' Set Measured I = -0.9998281
    retval = DmisCommand.PutText ("-0.9998281", MEAS_I, 0)
    ' Set Measured J = -0.0185432
    retval = DmisCommand.PutText ("-0.0185432", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = -1.2846
    retval = DmisCommand.PutText ("-1.2846", THEO_X, 0)
    ' Set Theoretical Y = -1.3229
    retval = DmisCommand.PutText ("-1.3229", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_I, 0)
    ' Set Theoretical J = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = -1.2689
    retval = DmisCommand.PutText ("-1.2689", MEAS_X, 0)
    ' Set Measured Y = -1.3062
    retval = DmisCommand.PutText ("-1.3062", MEAS_Y, 0)
    ' Set Measured Z = 0.1675
    retval = DmisCommand.PutText ("0.1675", MEAS_Z, 0)
    ' Set Measured I = -0.6968683
    retval = DmisCommand.PutText ("-0.6968683", MEAS_I, 0)
    ' Set Measured J = -0.7171992
    retval = DmisCommand.PutText ("-0.7171992", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 0.0034
    retval = DmisCommand.PutText ("0.0034", THEO_X, 0)
    ' Set Theoretical Y = -1.8564
    retval = DmisCommand.PutText ("-1.8564", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = 0
    retval = DmisCommand.PutText ("0", THEO_I, 0)
    ' Set Theoretical J = -1
    retval = DmisCommand.PutText ("-1", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = 0.003
    retval = DmisCommand.PutText ("0.003", MEAS_X, 0)
    ' Set Measured Y = -1.8217
    retval = DmisCommand.PutText ("-1.8217", MEAS_Y, 0)
    ' Set Measured Z = 0.1676
    retval = DmisCommand.PutText ("0.1676", MEAS_Z, 0)
    ' Set Measured I = 0.0014683
    retval = DmisCommand.PutText ("0.0014683", MEAS_I, 0)
    ' Set Measured J = -0.9999989
    retval = DmisCommand.PutText ("-0.9999989", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 1.2914
    retval = DmisCommand.PutText ("1.2914", THEO_X, 0)
    ' Set Theoretical Y = -1.3229
    retval = DmisCommand.PutText ("-1.3229", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = 0.7071068
    retval = DmisCommand.PutText ("0.7071068", THEO_I, 0)
    ' Set Theoretical J = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = 1.2723
    retval = DmisCommand.PutText ("1.2723", MEAS_X, 0)
    ' Set Measured Y = -1.3034
    retval = DmisCommand.PutText ("-1.3034", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.6984213
    retval = DmisCommand.PutText ("0.6984213", MEAS_I, 0)
    ' Set Measured J = -0.7156869
    retval = DmisCommand.PutText ("-0.7156869", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(END_MEASURED_FEATURE, TRUE)
    DmisCommand.Marked = TRUE
Reply
  • Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 0.0034
    retval = DmisCommand.PutText ("0.0034", THEO_X, 0)
    ' Set Theoretical Y = 1.7866
    retval = DmisCommand.PutText ("1.7866", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = 0
    retval = DmisCommand.PutText ("0", THEO_I, 0)
    ' Set Theoretical J = 1
    retval = DmisCommand.PutText ("1", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = 0.0033
    retval = DmisCommand.PutText ("0.0033", MEAS_X, 0)
    ' Set Measured Y = 1.8212
    retval = DmisCommand.PutText ("1.8212", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.0016691
    retval = DmisCommand.PutText ("0.0016691", MEAS_I, 0)
    ' Set Measured J = 0.9999986
    retval = DmisCommand.PutText ("0.9999986", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = -1.2846
    retval = DmisCommand.PutText ("-1.2846", THEO_X, 0)
    ' Set Theoretical Y = 1.2531
    retval = DmisCommand.PutText ("1.2531", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_I, 0)
    ' Set Theoretical J = 0.7071068
    retval = DmisCommand.PutText ("0.7071068", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = -1.3032
    retval = DmisCommand.PutText ("-1.3032", MEAS_X, 0)
    ' Set Measured Y = 1.2725
    retval = DmisCommand.PutText ("1.2725", MEAS_Y, 0)
    ' Set Measured Z = 0.1675
    retval = DmisCommand.PutText ("0.1675", MEAS_Z, 0)
    ' Set Measured I = -0.7155769
    retval = DmisCommand.PutText ("-0.7155769", MEAS_I, 0)
    ' Set Measured J = 0.698534
    retval = DmisCommand.PutText ("0.698534", MEAS_J, 0)
    End Sub

    Sub Part3

    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = -1.8181
    retval = DmisCommand.PutText ("-1.8181", THEO_X, 0)
    ' Set Theoretical Y = -0.0349
    retval = DmisCommand.PutText ("-0.0349", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = -1
    retval = DmisCommand.PutText ("-1", THEO_I, 0)
    ' Set Theoretical J = 0
    retval = DmisCommand.PutText ("0", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = -1.8209
    retval = DmisCommand.PutText ("-1.8209", MEAS_X, 0)
    ' Set Measured Y = -0.0337
    retval = DmisCommand.PutText ("-0.0337", MEAS_Y, 0)
    ' Set Measured Z = 0.1676
    retval = DmisCommand.PutText ("0.1676", MEAS_Z, 0)
    ' Set Measured I = -0.9998281
    retval = DmisCommand.PutText ("-0.9998281", MEAS_I, 0)
    ' Set Measured J = -0.0185432
    retval = DmisCommand.PutText ("-0.0185432", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = -1.2846
    retval = DmisCommand.PutText ("-1.2846", THEO_X, 0)
    ' Set Theoretical Y = -1.3229
    retval = DmisCommand.PutText ("-1.3229", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_I, 0)
    ' Set Theoretical J = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = -1.2689
    retval = DmisCommand.PutText ("-1.2689", MEAS_X, 0)
    ' Set Measured Y = -1.3062
    retval = DmisCommand.PutText ("-1.3062", MEAS_Y, 0)
    ' Set Measured Z = 0.1675
    retval = DmisCommand.PutText ("0.1675", MEAS_Z, 0)
    ' Set Measured I = -0.6968683
    retval = DmisCommand.PutText ("-0.6968683", MEAS_I, 0)
    ' Set Measured J = -0.7171992
    retval = DmisCommand.PutText ("-0.7171992", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 0.0034
    retval = DmisCommand.PutText ("0.0034", THEO_X, 0)
    ' Set Theoretical Y = -1.8564
    retval = DmisCommand.PutText ("-1.8564", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = 0
    retval = DmisCommand.PutText ("0", THEO_I, 0)
    ' Set Theoretical J = -1
    retval = DmisCommand.PutText ("-1", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = 0.003
    retval = DmisCommand.PutText ("0.003", MEAS_X, 0)
    ' Set Measured Y = -1.8217
    retval = DmisCommand.PutText ("-1.8217", MEAS_Y, 0)
    ' Set Measured Z = 0.1676
    retval = DmisCommand.PutText ("0.1676", MEAS_Z, 0)
    ' Set Measured I = 0.0014683
    retval = DmisCommand.PutText ("0.0014683", MEAS_I, 0)
    ' Set Measured J = -0.9999989
    retval = DmisCommand.PutText ("-0.9999989", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(MOVE_CIRCULAR, TRUE)
    DmisCommand.Marked = TRUE

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 1.2914
    retval = DmisCommand.PutText ("1.2914", THEO_X, 0)
    ' Set Theoretical Y = -1.3229
    retval = DmisCommand.PutText ("-1.3229", THEO_Y, 0)
    ' Set Theoretical Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", THEO_Z, 0)
    ' Set Theoretical I = 0.7071068
    retval = DmisCommand.PutText ("0.7071068", THEO_I, 0)
    ' Set Theoretical J = -0.7071068
    retval = DmisCommand.PutText ("-0.7071068", THEO_J, 0)
    ' Set Theoretical K = 0
    retval = DmisCommand.PutText ("0", THEO_K, 0)
    ' Set Measured X = 1.2723
    retval = DmisCommand.PutText ("1.2723", MEAS_X, 0)
    ' Set Measured Y = -1.3034
    retval = DmisCommand.PutText ("-1.3034", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.6984213
    retval = DmisCommand.PutText ("0.6984213", MEAS_I, 0)
    ' Set Measured J = -0.7156869
    retval = DmisCommand.PutText ("-0.7156869", MEAS_J, 0)
    ' Set Measured K = 0
    retval = DmisCommand.PutText ("0", MEAS_K, 0)
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Use Theoretical Vector = YES
    retval = DmisCommand.SetToggleString (2, USE_THEO, 0)

    Set DmisCommand = DmisCommands.Add(END_MEASURED_FEATURE, TRUE)
    DmisCommand.Marked = TRUE
Children
No Data