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
  • Alright, so to try to figure out some of my problems, I have been using this code to see what it actually gives me before I try to manipulate it.
    Dim App As Object
    Dim Part As Object
    Dim Cmds As Object
    Dim Cmd As Object
    Dim MyID As String
    Dim MyNom As String
    Dim MyDev As String
    Dim MyAx As String
    Dim Meas As String 
    Sub Main()
    Set App = CreateObject("PCDLRN.Application")
    Set Part = App.ActivePartProgram
    Set Cmds = Part.Commands
    
    For Each Cmd In Cmds
    If Cmd.IsDimension Then
    MyID = Cmd.DimensionCommand.ID
    Meas = Cmd.DimensionCommand.Measured
    MyAx = Cmd.DimensionCommand.AxisLetter
    MsgBox MyID & Meas & MyAx
    End If
    Next
    End Sub


    And on some of my variables, like Diameters and Planes, I have a 0 or a blank after the name then the measurement and the axis letter. So previously when I would import it, I would pull in that blank as the measurement hence giving me a zero in the space that I wanted the information in. Does anyone know what would cause that or maybe have an idea on how to compensate for it?

    And I probably should add that if you run the above script with just the ID varialbe, after every diameter or plane, there is a blank message box, so I am not sure that the blank is part of the ID, but it is for some reason giving it to me.
Reply
  • Alright, so to try to figure out some of my problems, I have been using this code to see what it actually gives me before I try to manipulate it.
    Dim App As Object
    Dim Part As Object
    Dim Cmds As Object
    Dim Cmd As Object
    Dim MyID As String
    Dim MyNom As String
    Dim MyDev As String
    Dim MyAx As String
    Dim Meas As String 
    Sub Main()
    Set App = CreateObject("PCDLRN.Application")
    Set Part = App.ActivePartProgram
    Set Cmds = Part.Commands
    
    For Each Cmd In Cmds
    If Cmd.IsDimension Then
    MyID = Cmd.DimensionCommand.ID
    Meas = Cmd.DimensionCommand.Measured
    MyAx = Cmd.DimensionCommand.AxisLetter
    MsgBox MyID & Meas & MyAx
    End If
    Next
    End Sub


    And on some of my variables, like Diameters and Planes, I have a 0 or a blank after the name then the measurement and the axis letter. So previously when I would import it, I would pull in that blank as the measurement hence giving me a zero in the space that I wanted the information in. Does anyone know what would cause that or maybe have an idea on how to compensate for it?

    And I probably should add that if you run the above script with just the ID varialbe, after every diameter or plane, there is a blank message box, so I am not sure that the blank is part of the ID, but it is for some reason giving it to me.
Children
No Data