hexagon logo

Accessing FCF True Position in VB

Hello,

Does anyone know the commands to access the True Position Measured values using VB? The typical "Commands.DimensionCommands.Measured" does not apply to TP. I am writing a new macro for Excel to import data from PC-DMIS. All of the current examples only refer to location type dimensions. Also, please advise if there is a better place to post this.

Thanks!

t.
  • Tp

    Try this! I think this is what your asking for.

    cmd.DimensionCommand.Deviation
    cmd.DimensionCommand.Bonus

    Bill
  • Returns object variable or with block variable not set. I think it has something to do with the new way (v4.0 and up) in which TP is calculated in a set of features. It is almost like once the dimension is found you have to loop through all of the elements withing that tp set to get to the individual tp deviations.
  • I suppose I could try going back to legacy dimensions. Then I could probable use the standard commands to retrieve the deviation. Just thinking out loud.

    t.
  • Just looking though the Object browser have your tried using the

    "DimensionCmd" Class?

    The members of this class look like they are all about GD&T.
  • Just looking though the Object browser have your tried using the

    "DimensionCmd" Class?

    The members of this class look like they are all about GD&T.



    Yes - I get the all too familiar "object doesn't support this property of method" Sample code follows...

    Private Sub CommandButton1_Click()
    Dim app As Object, cmds As Object, Cmd As Object, part As Object, PartProgram As Object
    Set app = CreateObject("PCDLRN.Application")
    Set part = app.ActivePartProgram
    Set cmds = part.Commands

    Dim irow As Integer, icol As Integer, currentcol As Integer
    Dim s As String
    s = ""
    irow = 10
    icol = ActiveSheet.Cells(2, 14)
    currentcol = icol + 4

    For Each Cmd In cmds
    ActiveSheet.Cells(irow, 16) = Cmd.ID
    ActiveSheet.Cells(irow, 17) = Cmd.Type
    ActiveSheet.Cells(irow, 18) = Cmd.TypeDescription
    If Cmd.Type = 184 Then ' Its a TP Dimension
    ActiveSheet.Cells(irow, currentcol) = part.DimensionCmd.Measured

    ElseIf Cmd.Type = DIMENSION_X_LOCATION Or Cmd.Type = DIMENSION_Y_LOCATION Or Cmd.Type = DIMENSION_Z_LOCATION Then
    ActiveSheet.Cells(irow, currentcol) = Cmd.DimensionCommand.Measured
    End If
    irow = irow + 1
    Next Cmd
    icol = icol + 1
    ActiveSheet.Cells(2, 14) = icol
    End Sub

    *** Also tried Cmd.DimensionCmd.Measured