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
  • For Each ObjCmd In ObjCmds
    
    [COLOR="#008000"]StrDimDiameter = ObjDimCmd.GetText (MEAS_DIAM, 0)
    MeasZ = ObjDimCmd.GetText (DIM_MEASURED, 0)[/COLOR]If ObjCmd.IsDimension Then
    
    [COLOR="#FF0000"]Set ObjDimCmd = ObjCmds.DimensionCommand[/COLOR]
    
    StrDimID = ObjDimCmd.DimensionCommand.ID
    StrDimFeature = ObjDimCmd.DimensionCommand.Feat1
    StrDimType = ObjDimCmd.DimensionCommand.AxisLetter
    StrDimNominal = ObjDimCmd.DimensionCommand.Nominal
    StrDimUTol = ObjDimCmd.DimensionCommand.Plus
    StrDimLTol = ObjDimCmd.DimensionCommand.Minus
    StrDimMeasure = ObjDimCmd.DimensionCommand.Measured
    End If


    You cast it as a DimensionCommand regardless of what command you have found.
    In the code above, I have moved the set below the IsDimension check.

    The green marked code also does the same, not all commands holds these properties.
    You want to pull the MEAS_DIAM and DIM_MEASURED regardless of what kind of command
    you are at (could be an alignment or comment or...). So, first you must iterate through
    all the commands and check what commandtype you have and based on that, grab whatever
    properties that specific commandtype holds. Check the code I sent you, there you will see
    how to check for the different types.
Reply
  • For Each ObjCmd In ObjCmds
    
    [COLOR="#008000"]StrDimDiameter = ObjDimCmd.GetText (MEAS_DIAM, 0)
    MeasZ = ObjDimCmd.GetText (DIM_MEASURED, 0)[/COLOR]If ObjCmd.IsDimension Then
    
    [COLOR="#FF0000"]Set ObjDimCmd = ObjCmds.DimensionCommand[/COLOR]
    
    StrDimID = ObjDimCmd.DimensionCommand.ID
    StrDimFeature = ObjDimCmd.DimensionCommand.Feat1
    StrDimType = ObjDimCmd.DimensionCommand.AxisLetter
    StrDimNominal = ObjDimCmd.DimensionCommand.Nominal
    StrDimUTol = ObjDimCmd.DimensionCommand.Plus
    StrDimLTol = ObjDimCmd.DimensionCommand.Minus
    StrDimMeasure = ObjDimCmd.DimensionCommand.Measured
    End If


    You cast it as a DimensionCommand regardless of what command you have found.
    In the code above, I have moved the set below the IsDimension check.

    The green marked code also does the same, not all commands holds these properties.
    You want to pull the MEAS_DIAM and DIM_MEASURED regardless of what kind of command
    you are at (could be an alignment or comment or...). So, first you must iterate through
    all the commands and check what commandtype you have and based on that, grab whatever
    properties that specific commandtype holds. Check the code I sent you, there you will see
    how to check for the different types.
Children
No Data