hexagon logo

Tracefields and Scripts

Anyone out there know how to retrieve a Tracefield Value from a part program in a script? Can't quite find the right command...
Parents
  • You need to check first that the current command is a tracefield command by using the "if cmd.istracefield" logic shown above.

    Otherwise the tracefield member of the current command will be empty resulting in the error you are getting.

    Sent from my SPH-L710 using Tapatalk


    Thanks DJAMS. Now it's throwing the OLE error... no default value.

    But that's the whole point. I don't need a "default value". I want to read in the value from the PRG. I suck at scripts.

    Dim PCDApp As Object
    Dim Part As Object
    Dim Cmds  As Object
    Dim Cmd As Object
    Dim TCmd As Object
    Dim TCmds As Object
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set Part = PCDApp.ActivePartProgram
    Set Cmds = Part.Commands
    Dim VSERIALNUMBER As Object
    
    For Each Cmd In Cmds
       If Cmd.IsTracefield Then
       Set TCmd = Cmd.TraceFieldCommand
    
    Set VSERIALNUMBER = TCmd("Serial Number").GetText
        
    End If
    
    
    Next Cmd
    
Reply
  • You need to check first that the current command is a tracefield command by using the "if cmd.istracefield" logic shown above.

    Otherwise the tracefield member of the current command will be empty resulting in the error you are getting.

    Sent from my SPH-L710 using Tapatalk


    Thanks DJAMS. Now it's throwing the OLE error... no default value.

    But that's the whole point. I don't need a "default value". I want to read in the value from the PRG. I suck at scripts.

    Dim PCDApp As Object
    Dim Part As Object
    Dim Cmds  As Object
    Dim Cmd As Object
    Dim TCmd As Object
    Dim TCmds As Object
    Set PCDApp = CreateObject("PCDLRN.Application")
    Set Part = PCDApp.ActivePartProgram
    Set Cmds = Part.Commands
    Dim VSERIALNUMBER As Object
    
    For Each Cmd In Cmds
       If Cmd.IsTracefield Then
       Set TCmd = Cmd.TraceFieldCommand
    
    Set VSERIALNUMBER = TCmd("Serial Number").GetText
        
    End If
    
    
    Next Cmd
    
Children
No Data