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(MOVE_POINT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Theoretical X = 2.8233
    retval = DmisCommand.PutText ("2.8233", THEO_X, 0)
    ' Set Theoretical Y = 0.3198
    retval = DmisCommand.PutText ("0.3198", THEO_Y, 0)
    ' Set Theoretical Z = 1.1771
    retval = DmisCommand.PutText ("1.1771", THEO_Z, 0)

    Set DmisCommand = DmisCommands.Add(MEASURED_CIRCLE, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 0.0034
    retval = DmisCommand.PutText ("0.0034", 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 = 0
    retval = DmisCommand.PutText ("0", THEO_I, 0)
    ' Set Theoretical J = 0
    retval = DmisCommand.PutText ("0", THEO_J, 0)
    ' Set Theoretical K = 1
    retval = DmisCommand.PutText ("1", THEO_K, 0)
    ' Set Theoretical Diameter = 3.643
    retval = DmisCommand.PutText ("3.643", THEO_DIAM, 0)
    ' Set Measured X = 0.0003
    retval = DmisCommand.PutText ("0.0003", MEAS_X, 0)
    ' Set Measured Y = 0
    retval = DmisCommand.PutText ("0", MEAS_Y, 0)
    ' Set Measured Z = 0.1675
    retval = DmisCommand.PutText ("0.1675", MEAS_Z, 0)
    ' Set Measured I = 0
    retval = DmisCommand.PutText ("0", MEAS_I, 0)
    ' Set Measured J = 0
    retval = DmisCommand.PutText ("0", MEAS_J, 0)
    ' Set Measured K = 1
    retval = DmisCommand.PutText ("1", MEAS_K, 0)
    ' Set Measured Diameter = 3.643
    retval = DmisCommand.PutText ("3.643", MEAS_DIAM, 0)
    ' Set Id = CIR3- RADIUS OF STEP OUTER EDGE
    retval = DmisCommand.PutText ("CIR3- RADIUS OF STEP OUTER EDGE", ID, 0)
    ' Set Coordinate Type = CARTESIAN
    retval = DmisCommand.SetToggleString (1, COORD_TYPE, 0)
    ' Set Inner/Outer = OUT
    retval = DmisCommand.SetToggleString (1, INOUT_TYPE, 0)
    ' Set Best Fit Math Type = LEAST_SQR
    retval = DmisCommand.SetToggleString (1, BF_MATH_TYPE, 0)
    ' Set 2D/3D = WORKPLANE
    retval = DmisCommand.SetToggleString (3, MEASURED_2D3D_TYPE, 0)
    ' Set Number of Hits = 8
    retval = DmisCommand.PutText ("8", N_HITS, 0)

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 1.8249
    retval = DmisCommand.PutText ("1.8249", 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.8214
    retval = DmisCommand.PutText ("1.8214", MEAS_X, 0)
    ' Set Measured Y = -0.0337
    retval = DmisCommand.PutText ("-0.0337", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.9998279
    retval = DmisCommand.PutText ("0.9998279", MEAS_I, 0)
    ' Set Measured J = -0.0185529
    retval = DmisCommand.PutText ("-0.0185529", 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.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.3068
    retval = DmisCommand.PutText ("1.3068", MEAS_X, 0)
    ' Set Measured Y = 1.2696
    retval = DmisCommand.PutText ("1.2696", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.717163
    retval = DmisCommand.PutText ("0.717163", MEAS_I, 0)
    ' Set Measured J = 0.6969054
    retval = DmisCommand.PutText ("0.6969054", 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
Reply
  • Set DmisCommand = DmisCommands.Add(MOVE_POINT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Learn Mode = NORMAL
    retval = DmisCommand.SetToggleString (1, NORM_RELEARN, 0)
    ' Set Theoretical X = 2.8233
    retval = DmisCommand.PutText ("2.8233", THEO_X, 0)
    ' Set Theoretical Y = 0.3198
    retval = DmisCommand.PutText ("0.3198", THEO_Y, 0)
    ' Set Theoretical Z = 1.1771
    retval = DmisCommand.PutText ("1.1771", THEO_Z, 0)

    Set DmisCommand = DmisCommands.Add(MEASURED_CIRCLE, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 0.0034
    retval = DmisCommand.PutText ("0.0034", 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 = 0
    retval = DmisCommand.PutText ("0", THEO_I, 0)
    ' Set Theoretical J = 0
    retval = DmisCommand.PutText ("0", THEO_J, 0)
    ' Set Theoretical K = 1
    retval = DmisCommand.PutText ("1", THEO_K, 0)
    ' Set Theoretical Diameter = 3.643
    retval = DmisCommand.PutText ("3.643", THEO_DIAM, 0)
    ' Set Measured X = 0.0003
    retval = DmisCommand.PutText ("0.0003", MEAS_X, 0)
    ' Set Measured Y = 0
    retval = DmisCommand.PutText ("0", MEAS_Y, 0)
    ' Set Measured Z = 0.1675
    retval = DmisCommand.PutText ("0.1675", MEAS_Z, 0)
    ' Set Measured I = 0
    retval = DmisCommand.PutText ("0", MEAS_I, 0)
    ' Set Measured J = 0
    retval = DmisCommand.PutText ("0", MEAS_J, 0)
    ' Set Measured K = 1
    retval = DmisCommand.PutText ("1", MEAS_K, 0)
    ' Set Measured Diameter = 3.643
    retval = DmisCommand.PutText ("3.643", MEAS_DIAM, 0)
    ' Set Id = CIR3- RADIUS OF STEP OUTER EDGE
    retval = DmisCommand.PutText ("CIR3- RADIUS OF STEP OUTER EDGE", ID, 0)
    ' Set Coordinate Type = CARTESIAN
    retval = DmisCommand.SetToggleString (1, COORD_TYPE, 0)
    ' Set Inner/Outer = OUT
    retval = DmisCommand.SetToggleString (1, INOUT_TYPE, 0)
    ' Set Best Fit Math Type = LEAST_SQR
    retval = DmisCommand.SetToggleString (1, BF_MATH_TYPE, 0)
    ' Set 2D/3D = WORKPLANE
    retval = DmisCommand.SetToggleString (3, MEASURED_2D3D_TYPE, 0)
    ' Set Number of Hits = 8
    retval = DmisCommand.PutText ("8", N_HITS, 0)

    Set DmisCommand = DmisCommands.Add(BASIC_HIT, TRUE)
    DmisCommand.Marked = TRUE
    ' Set Theoretical X = 1.8249
    retval = DmisCommand.PutText ("1.8249", 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.8214
    retval = DmisCommand.PutText ("1.8214", MEAS_X, 0)
    ' Set Measured Y = -0.0337
    retval = DmisCommand.PutText ("-0.0337", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.9998279
    retval = DmisCommand.PutText ("0.9998279", MEAS_I, 0)
    ' Set Measured J = -0.0185529
    retval = DmisCommand.PutText ("-0.0185529", 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.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.3068
    retval = DmisCommand.PutText ("1.3068", MEAS_X, 0)
    ' Set Measured Y = 1.2696
    retval = DmisCommand.PutText ("1.2696", MEAS_Y, 0)
    ' Set Measured Z = 0.1674
    retval = DmisCommand.PutText ("0.1674", MEAS_Z, 0)
    ' Set Measured I = 0.717163
    retval = DmisCommand.PutText ("0.717163", MEAS_I, 0)
    ' Set Measured J = 0.6969054
    retval = DmisCommand.PutText ("0.6969054", 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
Children
No Data